Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef MA_SIZE_H
00011 #define MA_SIZE_H
00012
00016 #include <apf.h>
00017 #include "maMesh.h"
00018
00019 namespace ma {
00020
00021 typedef apf::Matrix3x3 Matrix;
00022
00023 class SizeField
00024 {
00025 public:
00026 virtual ~SizeField();
00027 virtual double measure(Entity* e) = 0;
00028 virtual bool shouldSplit(Entity* edge) = 0;
00029 virtual bool shouldCollapse(Entity* edge) = 0;
00030 virtual void interpolate(
00031 apf::MeshElement* parent,
00032 Vector const& xi,
00033 Entity* newVert) = 0;
00034 virtual void getTransform(
00035 apf::MeshElement* e,
00036 Vector const& xi,
00037 Matrix& t) = 0;
00038 virtual double getWeight(Entity* e) = 0;
00039 };
00040
00041 struct IdentitySizeField : public SizeField
00042 {
00043 IdentitySizeField(Mesh* m);
00044 double measure(Entity* e);
00045 bool shouldSplit(Entity*);
00046 bool shouldCollapse(Entity*);
00047 void interpolate(
00048 apf::MeshElement* parent,
00049 Vector const& xi,
00050 Entity* newVert);
00051 void getTransform(
00052 apf::MeshElement*,
00053 Vector const&,
00054 Matrix& t);
00055 double getWeight(Entity*);
00056 Mesh* mesh;
00057 };
00058
00059 struct UniformRefiner : public IdentitySizeField
00060 {
00061 UniformRefiner(Mesh* m):
00062 IdentitySizeField(m)
00063 {
00064 }
00065 bool shouldSplit(Entity*)
00066 {
00067 return true;
00068 }
00069 };
00070
00072 class AnisotropicFunction
00073 {
00074 public:
00075 virtual ~AnisotropicFunction();
00080 virtual void getValue(Entity* vert, Matrix& r, Vector& h) = 0;
00081 };
00082
00084 class IsotropicFunction
00085 {
00086 public:
00087 virtual ~IsotropicFunction();
00089 virtual double getValue(Entity* vert) = 0;
00090 };
00091
00092 SizeField* makeSizeField(Mesh* m, apf::Field* sizes, apf::Field* frames);
00093 SizeField* makeSizeField(Mesh* m, apf::Field* size);
00094 SizeField* makeSizeField(Mesh* m, AnisotropicFunction* f, int const interpolationOption=0);
00095 SizeField* makeSizeField(Mesh* m, IsotropicFunction* f);
00096
00097 double getAverageEdgeLength(Mesh* m);
00098
00099 }
00100
00101 #endif