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;
00113 virtual void clear_() = 0;
00118 virtual void acceptChanges() = 0;
00119 };
00120
00127 void migrate(Mesh2* m, Migration* plan);
00128
00129 void migrateSilent(Mesh2* m, Migration* plan);
00130
00137 void setMigrationLimit(size_t maxElements);
00138
00139 class Field;
00140
00145 void displaceMesh(Mesh2* m, Field* d, double factor=1.0);
00146
00148 class BuildCallback
00149 {
00150 public:
00152 virtual void call(MeshEntity* e) = 0;
00153 };
00154
00157 MeshEntity* makeOrFind(
00158 Mesh2* m,
00159 ModelEntity* c,
00160 int type,
00161 MeshEntity** down,
00162 BuildCallback* cb = 0,
00163 bool* p_made = 0);
00164
00170 MeshEntity* buildElement(
00171 Mesh2* m,
00172 ModelEntity* c,
00173 int type,
00174 MeshEntity** verts,
00175 BuildCallback* cb = 0);
00176
00180 MeshEntity* buildOneElement(
00181 Mesh2* m,
00182 ModelEntity* c,
00183 int type,
00184 Vector3 const* points);
00185
00188 void initResidence(Mesh2* m, int dim);
00189
00195 void stitchMesh(Mesh2* m);
00196
00198 void clear(Mesh2* m);
00199
00200 void packDataClone(Mesh2* m, int to);
00201 void unpackDataClone(Mesh2* m);
00202
00203
00204 typedef std::vector<MeshEntity*> EntityVector;
00205 void packParts(int to, Parts& parts);
00206 void unpackParts(Parts& parts);
00207 void moveEntities(
00208 Mesh2* m,
00209 EntityVector senders[4]);
00210 void updateMatching(
00211 Mesh2* m,
00212 EntityVector affected[4],
00213 EntityVector senders[4]);
00214 void deleteOldEntities(
00215 Mesh2* m,
00216 EntityVector affected[4]);
00217 void reduceMatchingToSenders(
00218 Mesh2* m,
00219 EntityVector senders[4]);
00220 void getSenders(Mesh2* m,EntityVector affected[4],EntityVector senders[4]);
00221 void split(Copies& remotes, Parts& parts, Parts& newParts);
00222
00223
00224 void packEntity(Mesh2* m, int to, MeshEntity* e, DynamicArray<MeshTag*>& tags, bool ghosting=false);
00225 void unpackRemotes(Mesh2* m, MeshEntity* e);
00226 void unpackTags(Mesh2* m, MeshEntity* e, DynamicArray<MeshTag*>& tags);
00227 void unpackCommon(Mesh2* m, MeshEntity*& sender, ModelEntity*& c, Parts& residence);
00228 MeshEntity* unpackVertex(Mesh2* m, ModelEntity* c);
00229 MeshEntity* unpackNonVertex(Mesh2* m,int type, ModelEntity* c);
00230
00231 }
00232
00233 #endif