SCOREC core
Parallel unstructured mesh tools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
apfNumbering.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011 Scientific Computation Research Center
3  *
4  * This work is open source software, licensed under the terms of the
5  * BSD license as described in the LICENSE file in the top-level directory.
6  */
7 
8 #ifndef APFNUMBERING_H
9 #define APFNUMBERING_H
10 
14 #include "apf.h"
15 #include "apfDynamicArray.h"
16 #include "apfMesh.h"
17 
18 namespace apf {
19 
21 typedef NumberingOf<long> GlobalNumbering;
22 
25 Numbering* createNumbering(Field* f);
26 
33  Mesh* mesh,
34  const char* name,
35  FieldShape* shape,
36  int components);
37 
41 
51 void fix(Numbering* n, MeshEntity* e, int node, int component, bool fixed);
52 
55 bool isFixed(Numbering* n, MeshEntity* e, int node, int component);
56 
59 bool isNumbered(Numbering* n, MeshEntity* e, int node, int component);
60 
63 void number(Numbering* n, MeshEntity* e, int node, int component, int number);
64 
67 int getNumber(Numbering* n, MeshEntity* e, int node, int component);
68 
71 Field* getField(Numbering* n);
72 
74 FieldShape* getShape(Numbering* n);
76 const char* getName(Numbering* n);
77 
78 bool isPrintable(Numbering* f);
82 
87 int getElementNumbers(Numbering* n, MeshEntity* e, NewArray<int>& numbers);
88 
90 int countFixed(Numbering* n);
91 
97 void synchronize(Numbering * n, Sharing* shr = 0, bool delete_shr = false);
98 
100 Numbering* numberOwnedDimension(Mesh* mesh, const char* name, int dim, Sharing* shr = 0);
102 Numbering* numberOverlapDimension(Mesh* mesh, const char* name, int dim);
104 Numbering* numberElements(Mesh* mesh, const char* name);
109  Mesh* mesh,
110  const char* name,
111  FieldShape* s = 0);
118  Mesh* mesh,
119  const char* name,
120  FieldShape* s = 0,
121  Sharing* shr = 0);
123 int countNodes(Numbering* n);
125 
127 struct Node
128 {
129  Node():entity(0),node(0) {}
130  Node(MeshEntity* e, int n):entity(e),node(n) {}
132  MeshEntity* entity;
134  int node;
135 };
136 
140 void getNodes(Numbering* n, DynamicArray<Node>& nodes);
141 
150 void getNodesOnClosure(
151  Mesh* m,
152  ModelEntity* me,
153  DynamicArray<Node>& on,
154  FieldShape* sh = 0);
155 
160  Mesh* mesh,
161  const char* name,
162  FieldShape* shape,
163  int components=1);
164 
168 
170 const char* getName(GlobalNumbering* n);
177 void number(GlobalNumbering* n, MeshEntity* e, int node, long number);
179 void number(GlobalNumbering* n, Node node, long number, int component=0);
181 long getNumber(GlobalNumbering* n, Node node, int component=0);
183 long getNumber(GlobalNumbering* n, MeshEntity* e, int node, int component=0);
185 int getElementNumbers(GlobalNumbering* n, MeshEntity* e,
186  NewArray<long>& numbers);
189 Field* getField(GlobalNumbering* n);
190 
209 GlobalNumbering* makeGlobal(Numbering* n, bool destroy=true);
210 
212 void synchronize(GlobalNumbering* n, Sharing* shr = 0);
213 
216 
218 void getNodes(GlobalNumbering* n, DynamicArray<Node>& nodes);
219 
223 MeshTag* reorder(Mesh* mesh, const char* name);
224 
225 void globalize(Numbering* n);
226 
228 int naiveOrder(Numbering * num, Sharing * sharing = NULL);
229 // Exposing capital version for legacy API purposes
231 inline int NaiveOrder(Numbering * num) { return naiveOrder(num); }
232 
234 int adjReorder(Numbering * num, Sharing * sharing = NULL);
235 // Exposing capital version for legacy API purposes
237 inline int AdjReorder(Numbering * num) { return adjReorder(num); }
238 
240 void setNumberingOffset(Numbering * num, int off, Sharing * sharing = NULL);
241 // Exposing capital version for legacy API purposes
243 inline void SetNumberingOffset(Numbering * num, int off) { setNumberingOffset(num,off); }
244 
245 }
246 
247 #endif
void fix(Numbering *n, MeshEntity *e, int node, int component, bool fixed)
Set the fixed/free status of a degree of freedom,.
Numbering * numberOverlapDimension(Mesh *mesh, const char *name, int dim)
number all local entities of a given dimension
int adjReorder(Numbering *num, Sharing *sharing=NULL)
like apf::reorder, but numbers all free nodal components
The APF Field interface.
NumberingOf< long > GlobalNumbering
Global numberings use 64-bit integers.
Definition: apfMesh.h:30
void getNodesOnClosure(Mesh *m, ModelEntity *me, DynamicArray< Node > &on, FieldShape *sh=0)
get nodes on the closure of a model entity
MeshEntity * entity
unique entity to which the node is associated
Definition: apfNumbering.h:132
bool isPrintable(Field *f)
Checks whether a Field/Numbering/GlobalNumbering is complete and therefore printable to visualization...
Numbering * numberElements(Mesh *mesh, const char *name)
number the local elements
Describes field distribution and shape functions.
Definition: apfShape.h:73
void destroyNumbering(Numbering *n)
Destroy a Numbering.
void synchronize(Field *f, Sharing *shr=0)
Synchronize field values along partition boundary.
void destroyGlobalNumbering(GlobalNumbering *n)
destroy a global numbering
Node identifier.
Definition: apfNumbering.h:127
int naiveOrder(Numbering *num, Sharing *sharing=NULL)
number all components by simple iteration
int NaiveOrder(Numbering *num)
todo : mark as deprecated
Definition: apfNumbering.h:231
int getElementNumbers(Numbering *n, MeshEntity *e, NewArray< int > &numbers)
returns the node numbers of an element
Numbering * numberOwnedDimension(Mesh *mesh, const char *name, int dim, Sharing *shr=0)
number the local owned entities of a given dimension
GlobalNumbering * makeGlobal(Numbering *n, bool destroy=true)
converts a local numbering into a global numbering.
int node
which node on the entity it is
Definition: apfNumbering.h:134
Interface to a mesh part.
Definition: apfMesh.h:103
int countNodes(Element *e)
Returns the number of element nodes.
FieldShape * getShape(Field *f)
Retrieve the apf::FieldShape used by a field.
void setNumberingOffset(Numbering *num, int off, Sharing *sharing=NULL)
add an offset to all free nodal component numbers
void number(Numbering *n, MeshEntity *e, int node, int component, int number)
number a degree of freedom
apf::Mesh2 Mesh
convenient mesh name
Definition: maMesh.h:27
abstract description of entity copy sharing
Definition: apfMesh.h:483
void SetNumberingOffset(Numbering *num, int off)
todo : mark as deprecated
Definition: apfNumbering.h:243
Numbering * createNumbering(Field *f)
Create a Numbering of degrees of freedom of a Field.
Numbering * numberOverlapNodes(Mesh *mesh, const char *name, FieldShape *s=0)
number all local nodes
Mesh * getMesh(Field *f)
Retrieve the Mesh over which a Field is defined.
Field * getField(Numbering *n)
get the field being numbered
int countComponents(Field *f)
Count the number of scalar components in the field&#39;s value type.
Numbering * numberOwnedNodes(Mesh *mesh, const char *name, FieldShape *s=0, Sharing *shr=0)
number the local owned nodes
The APF Mesh interface.
GlobalNumbering * createGlobalNumbering(Mesh *mesh, const char *name, FieldShape *shape, int components=1)
create global numbering
int getNumber(Numbering *n, MeshEntity *e, int node, int component)
get a degree of freedom number
NumberingOf< int > Numbering
Numbering is meant to be a 32-bit local numbering.
Definition: apfMesh.h:27
int countFixed(Numbering *n)
return the number of fixed degrees of freedom
const char * getName(Field *f)
Get the name of a Field.
bool isNumbered(Numbering *n, MeshEntity *e, int node, int component)
Check whether a degree of freedom is numbered.
bool isFixed(Numbering *n, MeshEntity *e, int node, int component)
Check whether a degree of freedom is fixed.
MeshTag * reorder(Mesh *mesh, const char *name)
Number by adjacency graph traversal.
void getNodes(Numbering *n, DynamicArray< Node > &nodes)
get an array of numbered nodes
int AdjReorder(Numbering *num)
todo : mark as deprecated
Definition: apfNumbering.h:237