00001
00002
00003
00004
00005
00006
00007
00008 #ifndef APFNUMBERING_H
00009 #define APFNUMBERING_H
00010
00014 #include "apf.h"
00015 #include "apfDynamicArray.h"
00016 #include "apfMesh.h"
00017
00018 namespace apf {
00019
00021 typedef NumberingOf<long> GlobalNumbering;
00022
00025 Numbering* createNumbering(Field* f);
00026
00032 Numbering* createNumbering(
00033 Mesh* mesh,
00034 const char* name,
00035 FieldShape* shape,
00036 int components);
00037
00040 void destroyNumbering(Numbering* n);
00041
00051 void fix(Numbering* n, MeshEntity* e, int node, int component, bool fixed);
00052
00055 bool isFixed(Numbering* n, MeshEntity* e, int node, int component);
00056
00059 bool isNumbered(Numbering* n, MeshEntity* e, int node, int component);
00060
00063 void number(Numbering* n, MeshEntity* e, int node, int component, int number);
00064
00067 int getNumber(Numbering* n, MeshEntity* e, int node, int component);
00068
00071 Field* getField(Numbering* n);
00072
00074 FieldShape* getShape(Numbering* n);
00076 const char* getName(Numbering* n);
00078 Mesh* getMesh(Numbering* n);
00079 int countComponents(Numbering* n);
00080
00085 int getElementNumbers(Numbering* n, MeshEntity* e, NewArray<int>& numbers);
00086
00088 int countFixed(Numbering* n);
00089
00095 void synchronize(Numbering * n, Sharing* shr = 0);
00096
00098 Numbering* numberOwnedDimension(Mesh* mesh, const char* name, int dim);
00100 Numbering* numberOverlapDimension(Mesh* mesh, const char* name, int dim);
00102 Numbering* numberElements(Mesh* mesh, const char* name);
00106 Numbering* numberOverlapNodes(
00107 Mesh* mesh,
00108 const char* name,
00109 FieldShape* s = 0);
00115 Numbering* numberOwnedNodes(
00116 Mesh* mesh,
00117 const char* name,
00118 FieldShape* s = 0,
00119 Sharing* shr = 0);
00121 int countNodes(Numbering* n);
00122 int countNodes(GlobalNumbering* n);
00123
00125 struct Node
00126 {
00127 Node():entity(0),node(0) {}
00128 Node(MeshEntity* e, int n):entity(e),node(n) {}
00130 MeshEntity* entity;
00132 int node;
00133 };
00134
00138 void getNodes(Numbering* n, DynamicArray<Node>& nodes);
00139
00148 void getNodesOnClosure(
00149 Mesh* m,
00150 ModelEntity* me,
00151 DynamicArray<Node>& on,
00152 FieldShape* sh = 0);
00153
00157 GlobalNumbering* createGlobalNumbering(
00158 Mesh* mesh,
00159 const char* name,
00160 FieldShape* shape,
00161 int components=1);
00162 FieldShape* getShape(GlobalNumbering* n);
00163 const char* getName(GlobalNumbering* n);
00165 Mesh* getMesh(GlobalNumbering* n);
00167 int countComponents(GlobalNumbering* n);
00169 void number(GlobalNumbering* n, Node node, long number, int component=0);
00171 long getNumber(GlobalNumbering* n, Node node, int component=0);
00173 long getNumber(GlobalNumbering* n, MeshEntity* e, int node, int component=0);
00175 int getElementNumbers(GlobalNumbering* n, MeshEntity* e,
00176 NewArray<long>& numbers);
00177
00196 GlobalNumbering* makeGlobal(Numbering* n, bool destroy=true);
00197
00199 void synchronize(GlobalNumbering* n, Sharing* shr = 0);
00200
00202 void destroyGlobalNumbering(GlobalNumbering* n);
00203
00205 void getNodes(GlobalNumbering* n, DynamicArray<Node>& nodes);
00206
00210 MeshTag* reorder(Mesh* mesh, const char* name);
00211
00212 void globalize(Numbering* n);
00213
00216 int NaiveOrder(Numbering * num);
00217
00220 int AdjReorder(Numbering * num);
00221
00224 void SetNumberingOffset(Numbering * num, int off);
00225
00226 }
00227
00228 #endif