SCOREC core
Parallel unstructured mesh tools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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 };
40 
41 struct IdentitySizeField : public SizeField
42 {
43  IdentitySizeField(Mesh* m);
44  double measure(Entity* e);
45  bool shouldSplit(Entity*);
46  bool shouldCollapse(Entity*);
47  void interpolate(
48  apf::MeshElement* parent,
49  Vector const& xi,
50  Entity* newVert);
51  void getTransform(
53  Vector const&,
54  Matrix& t);
55  double getWeight(Entity*);
56  Mesh* mesh;
57 };
58 
59 struct UniformRefiner : public IdentitySizeField
60 {
61  UniformRefiner(Mesh* m):
62  IdentitySizeField(m)
63  {
64  }
65  bool shouldSplit(Entity*)
66  {
67  return true;
68  }
69 };
70 
73 {
74  public:
75  virtual ~AnisotropicFunction();
80  virtual void getValue(Entity* vert, Matrix& r, Vector& h) = 0;
81 };
82 
85 {
86  public:
87  virtual ~IsotropicFunction();
89  virtual double getValue(Entity* vert) = 0;
90 };
91 
92 SizeField* makeSizeField(Mesh* m, apf::Field* sizes, apf::Field* frames,
93  bool logInterpolation = false);
94 SizeField* makeSizeField(Mesh* m, AnisotropicFunction* f,
95  bool logInterpolation = false);
96 SizeField* makeSizeField(Mesh* m, apf::Field* size);
97 SizeField* makeSizeField(Mesh* m, IsotropicFunction* f);
98 
99 double getAverageEdgeLength(Mesh* m);
100 double getMaximumEdgeLength(Mesh* m, SizeField* sf = 0);
101 
102 }
103 
104 #endif
The APF Field interface.
virtual double getValue(Entity *vert)=0
get the desired element size at this vertex
User-defined Anisotropic size function.
Definition: maSize.h:72
apf::Matrix3x3 Matrix
convenient matrix name
Definition: maMesh.h:25
convenience wrapper over apf::Matrix&lt;3,3&gt;
Definition: apfMatrix.h:178
apf::Vector3 Vector
convenient vector name
Definition: maMesh.h:23
double measure(MeshElement *e)
Measures the volume, area, or length of a Mesh Element.
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:84
apf::Mesh2 Mesh
convenient mesh name
Definition: maMesh.h:27
mesh functions for MeshAdapt
convenience wrapper over apf::Vector&lt;3&gt;
Definition: apfVector.h:150
apf::MeshEntity Entity
convenient mesh entity name
Definition: maMesh.h:29
Extended mesh interface for modification.
Definition: apfMesh2.h:29
VectorElement MeshElement
Mesh Elements represent the mesh coordinate vector field.
Definition: apf.h:37