SCOREC core
Parallel unstructured mesh tools
maSize.h
Go to the documentation of this file.
1 /******************************************************************************
2 
3  Copyright 2013 Scientific Computation Research Center,
4  Rensselaer Polytechnic Institute. All rights reserved.
5 
6  The LICENSE file included with this distribution describes the terms
7  of the SCOREC Non-Commercial License this program is distributed under.
8 
9 *******************************************************************************/
10 #ifndef MA_SIZE_H
11 #define MA_SIZE_H
12 
16 #include <apf.h>
17 #include "maMesh.h"
18 
19 namespace ma {
20 
21 typedef apf::Matrix3x3 Matrix;
22 
23 class SizeField
24 {
25  public:
26  virtual ~SizeField();
27  virtual double measure(Entity* e) = 0;
28  virtual bool shouldSplit(Entity* edge) = 0;
29  virtual bool shouldCollapse(Entity* edge) = 0;
30  virtual void interpolate(
31  apf::MeshElement* parent,
32  Vector const& xi,
33  Entity* newVert) = 0;
34  virtual void getTransform(
36  Vector const& xi,
37  Matrix& t) = 0;
38  virtual double getWeight(Entity* e) = 0;
39  virtual void onRefine(
40  Entity* parent,
41  EntityArray& newEntities);
42  virtual void onCavity(
43  EntityArray& oldElements,
44  EntityArray& newEntities);
45  virtual int getTransferDimension();
46  virtual bool hasNodesOn(int dimension);
47 };
48 
49 struct IdentitySizeField : public SizeField
50 {
51  IdentitySizeField(Mesh* m);
52  double measure(Entity* e);
53  bool shouldSplit(Entity*);
54  bool shouldCollapse(Entity*);
55  void interpolate(
56  apf::MeshElement* parent,
57  Vector const& xi,
58  Entity* newVert);
59  void getTransform(
61  Vector const&,
62  Matrix& t);
63  double getWeight(Entity*);
64  Mesh* mesh;
65 
66 };
67 
68 struct UniformRefiner : public IdentitySizeField
69 {
70  UniformRefiner(Mesh* m):
71  IdentitySizeField(m)
72  {
73  }
74  bool shouldSplit(Entity*)
75  {
76  return true;
77  }
78 };
79 
82 {
83  public:
84  virtual ~AnisotropicFunction();
89  virtual void getValue(Entity* vert, Matrix& r, Vector& h) = 0;
90 };
91 
94 {
95  public:
96  virtual ~IsotropicFunction();
98  virtual double getValue(Entity* vert) = 0;
99 };
100 
101 SizeField* makeSizeField(Mesh* m, apf::Field* sizes, apf::Field* frames,
102  bool logInterpolation = false);
103 SizeField* makeSizeField(Mesh* m, AnisotropicFunction* f,
104  bool logInterpolation = false);
105 SizeField* makeSizeField(Mesh* m, apf::Field* size);
106 SizeField* makeSizeField(Mesh* m, IsotropicFunction* f);
107 
108 double getAverageEdgeLength(Mesh* m);
109 double getMaximumEdgeLength(Mesh* m, SizeField* sf = 0);
110 
111 }
112 
113 #endif
The APF Field interface.
convenience wrapper over apf::Matrix<3,3>
Definition: apfMatrix.h:179
Extended mesh interface for modification.
Definition: apfMesh2.h:30
convenience wrapper over apf::Vector<3>
Definition: apfVector.h:151
User-defined Anisotropic size function.
Definition: maSize.h:82
virtual void getValue(Entity *vert, Matrix &r, Vector &h)=0
get the size field value at this vertex
User-defined Isotropic size function.
Definition: maSize.h:94
virtual double getValue(Entity *vert)=0
get the desired element size at this vertex
mesh functions for MeshAdapt
VectorElement MeshElement
Mesh Elements represent the mesh coordinate vector field.
Definition: apf.h:43
double measure(MeshElement *e)
Measures the volume, area, or length of a Mesh Element.
All MeshAdapt symbols.
apf::MeshEntity Entity
convenient mesh entity name
Definition: maMesh.h:29
apf::Mesh2 Mesh
convenient mesh name
Definition: maMesh.h:27
apf::Matrix3x3 Matrix
convenient matrix name
Definition: maMesh.h:25
apf::DynamicArray< Entity * > EntityArray
convenient mesh entity array name
Definition: maMesh.h:35
apf::Vector3 Vector
convenient vector name
Definition: maMesh.h:23