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 /* Desired length bounds in metric space to replace hard coded values. Right now
23 these values are const, since we are not sure it is worth while to have the user,
24 modify these in addition to desired length. Future testing in need because Li's
25 thesis describes there might be utility to having the user modify them */
26 const double MAXLENGTH = 1.5;
27 const double MINLENGTH = .5;
28 const double MAXLENGTHRATIO = 1.2;
29 
30 class SizeField
31 {
32  public:
33  virtual ~SizeField();
34  virtual double measure(Entity* e) = 0;
35  virtual bool shouldSplit(Entity* edge) = 0;
36  virtual bool shouldCollapse(Entity* edge) = 0;
37  virtual void interpolate(
38  apf::MeshElement* parent,
39  Vector const& xi,
40  Entity* newVert) = 0;
41  virtual void getTransform(
43  Vector const& xi,
44  Matrix& t) = 0;
45  virtual double getWeight(Entity* e) = 0;
46  virtual void onRefine(
47  Entity* parent,
48  EntityArray& newEntities);
49  virtual void onCavity(
50  EntityArray& oldElements,
51  EntityArray& newEntities);
52  virtual int getTransferDimension();
53  virtual bool hasNodesOn(int dimension);
54 };
55 
56 struct IdentitySizeField : public SizeField
57 {
58  IdentitySizeField(Mesh* m);
59  double measure(Entity* e);
60  bool shouldSplit(Entity*);
61  bool shouldCollapse(Entity*);
62  void interpolate(
63  apf::MeshElement* parent,
64  Vector const& xi,
65  Entity* newVert);
66  void getTransform(
68  Vector const&,
69  Matrix& t);
70  double getWeight(Entity*);
71  Mesh* mesh;
72 
73 };
74 
75 struct UniformRefiner : public IdentitySizeField
76 {
77  UniformRefiner(Mesh* m):
78  IdentitySizeField(m)
79  {
80  }
81  bool shouldSplit(Entity*)
82  {
83  return true;
84  }
85 };
86 
89 {
90  public:
91  virtual ~AnisotropicFunction();
96  virtual void getValue(Entity* vert, Matrix& r, Vector& h) = 0;
97 };
98 
101 {
102  public:
103  virtual ~IsotropicFunction();
105  virtual double getValue(Entity* vert) = 0;
106 };
107 
108 SizeField* makeSizeField(Mesh* m, apf::Field* sizes, apf::Field* frames,
109  bool logInterpolation = false);
110 SizeField* makeSizeField(Mesh* m, AnisotropicFunction* f,
111  bool logInterpolation = false);
112 SizeField* makeSizeField(Mesh* m, apf::Field* size);
113 SizeField* makeSizeField(Mesh* m, IsotropicFunction* f);
114 
115 double getAverageEdgeLength(Mesh* m);
116 double getMaximumEdgeLength(Mesh* m, SizeField* sf = 0);
117 
118 }
119 
120 #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:89
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:101
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