SCOREC core
Parallel unstructured mesh tools
apfShape.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 APFSHAPE_H
9 #define APFSHAPE_H
10 
14 #include "apf.h"
15 #include "apfNew.h"
16 #include <sstream>
17 
18 namespace apf {
19 
20 class Mesh;
21 class MeshEntity;
22 
25 {
26  public:
27  virtual ~EntityShape();
31  virtual void getValues(
32  Mesh* m,
33  MeshEntity* e,
34  Vector3 const& xi,
35  NewArray<double>& values) const = 0;
40  virtual void getLocalGradients(
41  Mesh* m,
42  MeshEntity* e,
43  Vector3 const& xi,
44  NewArray<Vector3>& grads) const = 0;
49  virtual void getVectorValues(
50  Mesh* m,
51  MeshEntity* e,
52  Vector3 const& xi,
53  NewArray<apf::Vector3>& values) const = 0;
58  virtual void getLocalVectorCurls(
59  Mesh* m,
60  MeshEntity* e,
61  Vector3 const& xi,
62  NewArray<apf::Vector3>& values) const;
67  virtual int countNodes() const = 0;
84  virtual void alignSharedNodes(Mesh* m,
85  MeshEntity* elem, MeshEntity* shared, int order[]);
86 };
87 
92 {
93  public:
94  virtual ~FieldShape();
97  virtual EntityShape* getEntityShape(int type) = 0;
100  virtual bool hasNodesIn(int dimension) = 0;
106  virtual int countNodesOn(int type) = 0;
109  virtual int getOrder() = 0;
114  virtual void getNodeXi(int type, int node, Vector3& xi);
120  virtual void getNodeTangent(int type, int node, Vector3& t);
122  virtual bool isVectorShape();
124  virtual const char* getName() const = 0;
125  void registerSelf(const char* name);
126 };
127 
131 
134 
138 FieldShape* getConstant(int dimension);
146 FieldShape* getIPShape(int dimension, int order);
152 FieldShape* getVoronoiShape(int dimension, int order);
158 FieldShape* getIPFitShape(int dimension, int order);
159 
164 
168 FieldShape* getNedelec(int order);
169 
173 FieldShape* getL2Shape(int order, int type);
174 
178 FieldShape* getH1Shape(int order);
179 
181 void projectHierarchicField(Field* to, Field* from);
182 
184 void projectNedelecField(Field* to, Field* from);
185 
187 void projectL2Field(Field* to, Field* from);
188 
189 FieldShape* getShapeByName(const char* name);
190 
193 int countElementNodes(FieldShape* s, int type);
194 
200 void getElementNodeXis(FieldShape* s, int type,
201  apf::NewArray<apf::Vector3>& xis);
202 
208 void getElementNodeXis(FieldShape* s, Mesh* m, MeshEntity* e,
209  apf::NewArray<apf::Vector3>& xis);
210 
218  Mesh* m,
219  MeshEntity* boundary,
220  MeshEntity* element,
221  Vector3 const& xi);
222 
223 }
224 
225 #endif
The APF Field interface.
Shape functions over this element.
Definition: apfShape.h:25
virtual void getLocalGradients(Mesh *m, MeshEntity *e, Vector3 const &xi, NewArray< Vector3 > &grads) const =0
evaluate element shape function gradients
virtual void getVectorValues(Mesh *m, MeshEntity *e, Vector3 const &xi, NewArray< apf::Vector3 > &values) const =0
evaluate element vector shape functions
virtual void getValues(Mesh *m, MeshEntity *e, Vector3 const &xi, NewArray< double > &values) const =0
evaluate element shape functions
virtual void getLocalVectorCurls(Mesh *m, MeshEntity *e, Vector3 const &xi, NewArray< apf::Vector3 > &values) const
evaluate element vector curl shape functions
virtual int countNodes() const =0
return the number of nodes affecting this element
virtual void alignSharedNodes(Mesh *m, MeshEntity *elem, MeshEntity *shared, int order[])
convert from shared node order to local element order
Describes field distribution and shape functions.
Definition: apfShape.h:92
virtual int getOrder()=0
Return the polynomial order of the shape functions.
virtual bool isVectorShape()
Returns true if the shape functions are vectors.
virtual void getNodeTangent(int type, int node, Vector3 &t)
Get the parent element tangent vector of an element node.
virtual bool hasNodesIn(int dimension)=0
Return true iff there are nodes on entities of this dimension.
virtual int countNodesOn(int type)=0
Return the number of nodes associated with an entity of this type.
virtual EntityShape * getEntityShape(int type)=0
Get the sub-descriptor for this entity type.
virtual void getNodeXi(int type, int node, Vector3 &xi)
Get the parent element coordinates of an element node.
virtual const char * getName() const =0
Get a unique string for this shape function scheme.
Interface to a mesh part.
Definition: apfMesh.h:105
convenience wrapper over apf::Vector<3>
Definition: apfVector.h:151
All APF symbols are contained in this namespace.
void getElementNodeXis(FieldShape *s, int type, apf::NewArray< apf::Vector3 > &xis)
gets the xi coordinates for all the nodes
FieldShape * getVoronoiShape(int dimension, int order)
Get the Voronoi shape function.
FieldShape * getL2Shape(int order, int type)
Get the L2 shapes of a given order and entity type.
FieldShape * getHierarchic(int order)
Get the quadratic hierarchic shape function.
FieldShape * getIPShape(int dimension, int order)
Get the Integration Point distribution.
FieldShape * getIPFitShape(int dimension, int order)
Get the IP Fit shape function.
Vector3 boundaryToElementXi(Mesh *m, MeshEntity *boundary, MeshEntity *element, Vector3 const &xi)
Reparameterize from boundary entity to element.
void projectL2Field(Field *to, Field *from)
Project a L2 field.
FieldShape * getLagrange(int order)
Get the Lagrangian shape function of some polynomial order.
FieldShape * getNedelec(int order)
Get the Nedelec shape function of a given order.
void projectNedelecField(Field *to, Field *from)
Project a Nedelec field.
FieldShape * getConstant(int dimension)
Get the Constant shape function over some dimension.
void projectHierarchicField(Field *to, Field *from)
Project a hierarchic field.
int countElementNodes(FieldShape *s, int type)
count the number of nodes affecting an element type
FieldShape * getSerendipity()
Get the Serendipity shape functions of second order.
FieldShape * getH1Shape(int order)
Get the H1 shapes of a given order.
apf::Mesh2 Mesh
convenient mesh name
Definition: maMesh.h:27