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 #include <vector>
00017
00023 namespace crv {
00024
00026 static unsigned const MAX_ORDER = 19;
00027
00029 void setOrder(const int order);
00031 int getOrder();
00033 void setBlendingOrder(const int type, const int b);
00035 int getBlendingOrder(const int type);
00036
00038 int countNumberInvalidElements(apf::Mesh2* m);
00039
00045 class MeshCurver
00046 {
00047 public:
00048 MeshCurver(apf::Mesh2* m, int P) : m_mesh(m), m_order(P) {};
00049 virtual ~MeshCurver() {};
00050 virtual bool run() = 0;
00051
00053 void snapToInterpolate(int dim);
00054
00056 void synchronize();
00057
00058 protected:
00059 apf::Mesh2* m_mesh;
00060 int m_order;
00061 };
00062
00067 class InterpolatingCurver : public MeshCurver
00068 {
00069 public:
00070 InterpolatingCurver(apf::Mesh2* m, int P) : MeshCurver(m,P) {};
00071 virtual ~InterpolatingCurver() {};
00072 virtual bool run();
00073
00074 };
00075
00080 class BezierCurver : public MeshCurver
00081 {
00082 public:
00083 BezierCurver(apf::Mesh2* m, int P, int B) : MeshCurver(m,P)
00084 {
00085 setBlendingOrder(apf::Mesh::TYPES,B);
00086 };
00087
00091 virtual bool run();
00093 void convertInterpolatingToBezier();
00094 };
00095
00099 class GregoryCurver : public BezierCurver
00100 {
00101 public:
00102 GregoryCurver(apf::Mesh2* m, int P, int B)
00103 : BezierCurver(m,P,B) {};
00105 virtual bool run();
00107 void setCubicEdgePointsUsingNormals();
00109 void setInternalPointsLocally();
00110 };
00111
00113 ma::Input* configureShapeCorrection(
00114 ma::Mesh* m, ma::SizeField* f=0,
00115 ma::SolutionTransfer* s=0);
00116
00120 void adapt(ma::Input* in);
00121
00126 void stats(ma::Input* in,
00127 std::vector<double> &edgeLengths,
00128 std::vector<double> &linearQualities,
00129 std::vector<double> &curvedQualities,
00130 bool inMetric=true);
00131
00132
00135 apf::FieldShape* getBezier(int order);
00137 apf::FieldShape* getGregory();
00138
00141 double getQuality(apf::Mesh* m,apf::MeshEntity* e);
00142
00155 int checkValidity(apf::Mesh* m, apf::MeshEntity* e,
00156 int algorithm = 2);
00159 class Quality
00160 {
00161 public:
00162
00163
00164
00165
00166 Quality(apf::Mesh* m, int algorithm_);
00167 virtual ~Quality() {};
00169 virtual double getQuality(apf::MeshEntity* e) = 0;
00171 virtual int checkValidity(apf::MeshEntity* e) = 0;
00172 protected:
00173 apf::Mesh* mesh;
00174 int algorithm;
00175 int order;
00176 };
00178 Quality* makeQuality(apf::Mesh* m, int algorithm = 2);
00179
00184 double interpolationError(apf::Mesh* m, apf::MeshEntity* e, int n);
00185
00189 void writeCurvedVtuFiles(apf::Mesh* m, int type, int n, const char* prefix);
00190
00194 void writeCurvedWireFrame(apf::Mesh* m, int n, const char* prefix);
00195
00197 void writeControlPointVtuFiles(apf::Mesh* m, const char* prefix);
00200 void writeInterpolationPointVtuFiles(apf::Mesh* m, const char* prefix);
00201
00203 int getTriNodeIndex(int P, int i, int j);
00204 int getTetNodeIndex(int P, int i, int j, int k);
00205
00207 void fail(const char* why) __attribute__((noreturn));
00208
00209 }
00210
00211 #endif