Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef CRV_H
00009 #define CRV_H
00010
00011 #include "apfMesh2.h"
00012 #include "apfShape.h"
00013 #include <ma.h>
00014 #include <mth.h>
00015 #include <stdio.h>
00016
00022 namespace crv {
00023
00025 static unsigned const MAX_ORDER = 19;
00026
00028 void setOrder(const int order);
00030 int getOrder();
00032 void setBlendingOrder(const int type, const int b);
00034 int getBlendingOrder(const int type);
00035
00037 int countNumberInvalidElements(apf::Mesh2* m);
00038
00044 class MeshCurver
00045 {
00046 public:
00047 MeshCurver(apf::Mesh2* m, int P) : m_mesh(m), m_order(P) {};
00048 virtual ~MeshCurver() {};
00049 virtual bool run() = 0;
00050
00052 void snapToInterpolate(int dim);
00053
00055 void synchronize();
00056
00057 protected:
00058 apf::Mesh2* m_mesh;
00059 int m_order;
00060 };
00061
00066 class InterpolatingCurver : public MeshCurver
00067 {
00068 public:
00069 InterpolatingCurver(apf::Mesh2* m, int P) : MeshCurver(m,P) {};
00070 virtual ~InterpolatingCurver() {};
00071 virtual bool run();
00072
00073 };
00074
00079 class BezierCurver : public MeshCurver
00080 {
00081 public:
00082 BezierCurver(apf::Mesh2* m, int P, int B) : MeshCurver(m,P)
00083 {
00084 setBlendingOrder(apf::Mesh::TYPES,B);
00085 };
00086
00090 virtual bool run();
00092 void convertInterpolatingToBezier();
00093 };
00094
00098 class GregoryCurver : public BezierCurver
00099 {
00100 public:
00101 GregoryCurver(apf::Mesh2* m, int P, int B)
00102 : BezierCurver(m,P,B) {};
00104 virtual bool run();
00106 void setCubicEdgePointsUsingNormals();
00108 void setInternalPointsLocally();
00109 };
00110
00112 ma::Input* configureShapeCorrection(
00113 ma::Mesh* m, ma::SizeField* f=0,
00114 ma::SolutionTransfer* s=0);
00115
00119 void adapt(ma::Input* in);
00120
00123 apf::FieldShape* getBezier(int order);
00125 apf::FieldShape* getGregory();
00126
00129 double getQuality(apf::Mesh* m,apf::MeshEntity* e);
00130
00143 int checkValidity(apf::Mesh* m, apf::MeshEntity* e,
00144 int algorithm = 2);
00147 class Quality
00148 {
00149 public:
00150
00151
00152
00153
00154 Quality(apf::Mesh* m, int algorithm_);
00155 virtual ~Quality() {};
00157 virtual double getQuality(apf::MeshEntity* e) = 0;
00159 virtual int checkValidity(apf::MeshEntity* e) = 0;
00160 protected:
00161 apf::Mesh* mesh;
00162 int algorithm;
00163 int order;
00164 };
00166 Quality* makeQuality(apf::Mesh* m, int algorithm = 2);
00167
00172 double interpolationError(apf::Mesh* m, apf::MeshEntity* e, int n);
00173
00177 void writeCurvedVtuFiles(apf::Mesh* m, int type, int n, const char* prefix);
00178
00180 void writeControlPointVtuFiles(apf::Mesh* m, const char* prefix);
00183 void writeInterpolationPointVtuFiles(apf::Mesh* m, const char* prefix);
00184
00186 int getTriNodeIndex(int P, int i, int j);
00187 int getTetNodeIndex(int P, int i, int j, int k);
00188
00190 void fail(const char* why) __attribute__((noreturn));
00191
00192 }
00193
00194 #endif