00001
00002
00003
00004
00005
00006
00007
00008 #ifndef APF_MESH2_H
00009 #define APF_MESH2_H
00010
00014 #include "apfMesh.h"
00015 #include <set>
00016
00017 namespace apf {
00018
00029 class Mesh2 : public Mesh
00030 {
00031 public:
00036 virtual void setRemotes(MeshEntity* e, Copies& remotes) = 0;
00038 virtual void addRemote(MeshEntity* e, int p, MeshEntity* r) = 0;
00039
00040
00042 virtual void addGhost(MeshEntity* e, int p, MeshEntity* r) = 0;
00043 virtual void deleteGhost(MeshEntity* e) = 0;
00044
00047 virtual void setResidence(MeshEntity* e, Parts& residence) = 0;
00049 virtual void setParam(MeshEntity* e, Vector3 const& p) = 0;
00051 virtual void increment(MeshIterator* it) = 0;
00053 virtual bool isDone(MeshIterator* it) = 0;
00057 virtual MeshEntity* deref(MeshIterator* it) = 0;
00059 void setPoint(MeshEntity* e, int node, Vector3 const& p);
00061 virtual void setPoint_(MeshEntity* e, int node, Vector3 const& p) = 0;
00065 MeshEntity* createVertex(ModelEntity* c, Vector3 const& point,
00066 Vector3 const& param);
00068 void requireUnfrozen()
00069 {
00070 if (hasFrozenFields)
00071 unfreezeFields(this);
00072 }
00074 virtual MeshEntity* createVert_(ModelEntity* c) = 0;
00077 MeshEntity* createVert(ModelEntity* c)
00078 {
00079 requireUnfrozen();
00080 return createVert_(c);
00081 }
00083 virtual MeshEntity* createEntity_(int type, ModelEntity* c,
00084 MeshEntity** down) = 0;
00091 MeshEntity* createEntity(int type, ModelEntity* c, MeshEntity** down)
00092 {
00093 requireUnfrozen();
00094 return createEntity_(type,c,down);
00095 }
00097 virtual void destroy_(MeshEntity* e) = 0;
00101 void destroy(MeshEntity* e)
00102 {
00103 requireUnfrozen();
00104 destroy_(e);
00105 }
00107 virtual void setModelEntity(MeshEntity* e, ModelEntity* c) = 0;
00109 virtual void addMatch(MeshEntity* e, int peer, MeshEntity* match) = 0;
00111 virtual void clearMatches(MeshEntity* e) = 0;
00116 virtual void acceptChanges() = 0;
00117 };
00118
00125 void migrate(Mesh2* m, Migration* plan);
00126
00127 void migrateSilent(Mesh2* m, Migration* plan);
00128
00135 void setMigrationLimit(size_t maxElements);
00136
00137 class Field;
00138
00143 void displaceMesh(Mesh2* m, Field* d, double factor=1.0);
00144
00146 class BuildCallback
00147 {
00148 public:
00150 virtual void call(MeshEntity* e) = 0;
00151 };
00152
00155 MeshEntity* makeOrFind(
00156 Mesh2* m,
00157 ModelEntity* c,
00158 int type,
00159 MeshEntity** down,
00160 BuildCallback* cb = 0);
00161
00167 MeshEntity* buildElement(
00168 Mesh2* m,
00169 ModelEntity* c,
00170 int type,
00171 MeshEntity** verts,
00172 BuildCallback* cb = 0);
00173
00177 MeshEntity* buildOneElement(
00178 Mesh2* m,
00179 ModelEntity* c,
00180 int type,
00181 Vector3 const* points);
00182
00185 void initResidence(Mesh2* m, int dim);
00186
00192 void stitchMesh(Mesh2* m);
00193
00194 void packDataClone(Mesh2* m, int to);
00195 void unpackDataClone(Mesh2* m);
00196
00197
00198 typedef std::vector<MeshEntity*> EntityVector;
00199 void packParts(int to, Parts& parts);
00200 void unpackParts(Parts& parts);
00201 void moveEntities(
00202 Mesh2* m,
00203 EntityVector senders[4]);
00204 void updateMatching(
00205 Mesh2* m,
00206 EntityVector affected[4],
00207 EntityVector senders[4]);
00208 void deleteOldEntities(
00209 Mesh2* m,
00210 EntityVector affected[4]);
00211 void reduceMatchingToSenders(
00212 Mesh2* m,
00213 EntityVector senders[4]);
00214 void getSenders(Mesh2* m,EntityVector affected[4],EntityVector senders[4]);
00215 void split(Copies& remotes, Parts& parts, Parts& newParts);
00216
00217 void packEntity(Mesh2* m, int to, MeshEntity* e, DynamicArray<MeshTag*>& tags, bool ghosting=false);
00218 void unpackRemotes(Mesh2* m, MeshEntity* e);
00219 void unpackTags(Mesh2* m, MeshEntity* e, DynamicArray<MeshTag*>& tags);
00220 void unpackCommon(Mesh2* m, MeshEntity*& sender, ModelEntity*& c, Parts& residence);
00221 MeshEntity* unpackVertex(Mesh2* m, ModelEntity* c);
00222 MeshEntity* unpackNonVertex(Mesh2* m,int type, ModelEntity* c);
00223 }
00224
00225 #endif