00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef SUNDANCE_MESH_H
00043 #define SUNDANCE_MESH_H
00044
00045 #include "SundanceDefs.hpp"
00046 #include "SundanceMeshBase.hpp"
00047 #include "SundanceMaximalCofacetBatch.hpp"
00048 #include "SundanceIncrementallyCreatableMesh.hpp"
00049 #include "SundanceIdentityReorderer.hpp"
00050 #include "SundanceCellReorderer.hpp"
00051 #include "PlayaHandle.hpp"
00052
00053 namespace Sundance
00054 {
00055 using namespace Teuchos;
00056
00057
00058
00059
00060
00061
00062
00063 class Mesh : public Playa::Handle<MeshBase>
00064 {
00065 public:
00066
00067
00068 HANDLE_CTORS(Mesh, MeshBase);
00069
00070
00071 int id() const {return ptr()->id();}
00072
00073
00074 const MeshEntityOrder& meshOrder() const {return ptr()->meshOrder();}
00075
00076
00077
00078
00079 int spatialDim() const {return ptr()->spatialDim();}
00080
00081
00082
00083
00084 int numCells(int dim) const {return ptr()->numCells(dim);}
00085
00086
00087
00088
00089 Point nodePosition(int i) const {return ptr()->nodePosition(i);}
00090
00091
00092
00093
00094 const double* nodePositionView(int i) const {return ptr()->nodePositionView(i);}
00095
00096
00097
00098
00099
00100 Point centroid(int cellDim, int cellLID) const
00101 {return ptr()->centroid(cellDim, cellLID);}
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114 void outwardNormals(
00115 const Array<int>& cellLIDs,
00116 Array<Point>& outwardNormals
00117 ) const
00118 {ptr()->outwardNormals(cellLIDs, outwardNormals);}
00119
00120
00121
00122
00123
00124
00125
00126
00127 void tangentsToEdges(
00128 const Array<int>& cellLIDs,
00129 Array<Point>& tangentVectors
00130 ) const
00131 {ptr()->tangentsToEdges(cellLIDs, tangentVectors);}
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146 void getJacobians(int cellDim, const Array<int>& cellLID,
00147 CellJacobianBatch& jBatch) const
00148 {ptr()->getJacobians(cellDim, cellLID, jBatch);}
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160 virtual void getCellDiameters(int cellDim, const Array<int>& cellLID,
00161 Array<double>& diameters) const
00162 {ptr()->getCellDiameters(cellDim, cellLID, diameters);}
00163
00164
00165
00166
00167
00168
00169 void pushForward(int cellDim, const Array<int>& cellLID,
00170 const Array<Point>& refQuadPts,
00171 Array<Point>& physQuadPts) const
00172 {ptr()->pushForward(cellDim, cellLID, refQuadPts, physQuadPts);}
00173
00174
00175
00176
00177
00178
00179 int ownerProcID(int cellDim, int cellLID) const
00180 {return ptr()->ownerProcID(cellDim, cellLID);}
00181
00182
00183
00184
00185
00186 int numFacets(int cellDim, int cellLID,
00187 int facetDim) const
00188 {return ptr()->numFacets(cellDim, cellLID, facetDim);}
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198 int facetLID(int cellDim, int cellLID,
00199 int facetDim, int facetIndex,
00200 int& facetOrientation) const
00201 {return ptr()->facetLID(cellDim, cellLID,
00202 facetDim, facetIndex,
00203 facetOrientation);}
00204
00205
00206
00207
00208
00209
00210 void getFacetArray(int cellDim, int cellLID, int facetDim,
00211 Array<int>& facetLIDs,
00212 Array<int>& facetOrientations) const
00213 {ptr()->getFacetArray(cellDim, cellLID,
00214 facetDim, facetLIDs,
00215 facetOrientations);}
00216
00217
00218
00219
00220 const int* elemZeroFacetView(int cellLID) const
00221 {return ptr()->elemZeroFacetView(cellLID);}
00222
00223
00224
00225
00226
00227
00228 void getFacetLIDs(int cellDim,
00229 const Array<int>& cellLID,
00230 int facetDim,
00231 Array<int>& facetLID,
00232 Array<int>& facetOrientations) const
00233 {ptr()->getFacetLIDs(cellDim, cellLID,
00234 facetDim, facetLID, facetOrientations);}
00235
00236
00237
00238
00239
00240 int numMaxCofacets(int cellDim, int cellLID) const
00241 {return ptr()->numMaxCofacets(cellDim, cellLID);}
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253 int maxCofacetLID(int cellDim, int cellLID,
00254 int cofacetIndex,
00255 int& facetIndex) const
00256 {return ptr()->maxCofacetLID(cellDim, cellLID, cofacetIndex, facetIndex);}
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266 void getMaxCofacetLIDs(const Array<int>& cellLIDs,
00267 MaximalCofacetBatch& cofacets) const
00268 {ptr()->getMaxCofacetLIDs(cellLIDs, cofacets);}
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280 void getCofacets(int cellDim, int cellLID,
00281 int cofacetDim, Array<int>& cofacetLIDs) const
00282 {ptr()->getCofacets(cellDim, cellLID, cofacetDim, cofacetLIDs);}
00283
00284
00285
00286
00287 int mapGIDToLID(int cellDim, int globalIndex) const
00288 {return ptr()->mapGIDToLID(cellDim, globalIndex);}
00289
00290
00291
00292
00293 bool hasGID(int cellDim, int globalIndex) const
00294 {return ptr()->hasGID(cellDim, globalIndex);}
00295
00296
00297
00298
00299
00300
00301 int mapLIDToGID(int cellDim, int localIndex) const
00302 {return ptr()->mapLIDToGID(cellDim, localIndex);}
00303
00304
00305
00306
00307 CellType cellType(int cellDim) const
00308 {return ptr()->cellType(cellDim);}
00309
00310
00311 int label(int cellDim, int cellLID) const
00312 {return ptr()->label(cellDim, cellLID);}
00313
00314
00315 void getLabels(int cellDim, const Array<int>& cellLID, Array<int>& labels) const
00316 {ptr()->getLabels(cellDim, cellLID, labels);}
00317
00318
00319 void setLabel(int cellDim, int cellLID, int label)
00320 {ptr()->setLabel(cellDim, cellLID, label);}
00321
00322
00323 Set<int> getAllLabelsForDimension(int cellDim) const
00324 {return ptr()->getAllLabelsForDimension(cellDim);}
00325
00326
00327
00328
00329 virtual int numLabels(int cellDim) const
00330 {return getAllLabelsForDimension(cellDim).size();}
00331
00332
00333
00334
00335
00336
00337 void getLIDsForLabel(int cellDim, int label, Array<int>& cellLIDs) const
00338 {ptr()->getLIDsForLabel(cellDim, label, cellLIDs);}
00339
00340
00341 const MPIComm& comm() const {return ptr()->comm();}
00342
00343
00344
00345
00346 void estimateNumVertices(int nPts)
00347 {creatableMesh()->estimateNumVertices(nPts);}
00348
00349
00350 void estimateNumElements(int nElems)
00351 {creatableMesh()->estimateNumElements(nElems);}
00352
00353
00354
00355 int addVertex(int globalIndex, const Point& x,
00356 int ownerProcID, int label)
00357 {return creatableMesh()->addVertex(globalIndex, x, ownerProcID, label);}
00358
00359
00360 int addElement(int globalIndex, const Array<int>& vertLID,
00361 int ownerProcID, int label)
00362 {return creatableMesh()->addElement(globalIndex, vertLID,
00363 ownerProcID, label);}
00364
00365
00366 void freezeTopology()
00367 {creatableMesh()->freezeTopology();}
00368
00369
00370
00371
00372
00373 void setReorderer(const CellReorderer& reorderer)
00374 {ptr()->setReorderer(reorderer);}
00375
00376
00377 const CellReordererImplemBase* reorderer() const
00378 {return ptr()->reorderer();}
00379
00380
00381
00382 static CellReorderer& defaultReorderer()
00383 {
00384 static CellReorderer rtn = new IdentityReorderer();
00385 return rtn;
00386 }
00387
00388
00389 void assignIntermediateCellGIDs(int cellDim)
00390 {
00391 if (!hasIntermediateGIDs(cellDim))
00392 ptr()->assignIntermediateCellGIDs(cellDim);
00393 }
00394
00395
00396 bool hasIntermediateGIDs(int cellDim) const
00397 {
00398 return ptr()->hasIntermediateGIDs(cellDim);
00399 }
00400
00401
00402 void dump(const std::string& filename) const ;
00403
00404
00405
00406
00407 bool checkConsistency(const std::string& filename) const ;
00408
00409
00410
00411
00412 bool checkConsistency(std::ostream& os) const ;
00413
00414
00415
00416
00417 bool allowsHangingHodes() const { return ptr()->allowsHangingHodes(); }
00418
00419
00420
00421 bool isElementHangingNode(int cellDim , int cellLID) const
00422 { return ptr()->isElementHangingNode(cellDim , cellLID); }
00423
00424
00425
00426 int indexInParent(int maxCellLID) const
00427 { return ptr()->indexInParent(maxCellLID); }
00428
00429
00430
00431 int maxChildren() const { return ptr()->maxChildren();}
00432
00433
00434 void returnParentFacets( int childCellLID , int dimFacets ,
00435 Array<int> &facetsLIDs , int &parentCellLIDs ) const {
00436 ptr()->returnParentFacets( childCellLID , dimFacets , facetsLIDs , parentCellLIDs );
00437 }
00438
00439
00440
00441
00442
00443
00444
00445 bool IsSpecialWeightValid() const {return ptr()->IsSpecialWeightValid();}
00446
00447
00448
00449 void setSpecialWeightValid(bool val) const { ptr()->setSpecialWeightValid(val);}
00450
00451
00452 void flushSpecialWeights() const { ptr()->flushSpecialWeights(); }
00453
00454
00455 bool hasSpecialWeight(int dim, int cellLID) const {return ptr()->hasSpecialWeight( dim, cellLID); }
00456
00457
00458 void setSpecialWeight(int dim, int cellLID, Array<double>& w) const {ptr()->setSpecialWeight(dim, cellLID, w);}
00459
00460
00461 void getSpecialWeight(int dim, int cellLID, Array<double>& w) const {ptr()->getSpecialWeight(dim, cellLID, w);}
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472 bool IsCurvePointsValid() const {return ptr()->IsCurvePointsValid();}
00473
00474
00475 void setCurvePointsValid(bool val) const {ptr()->setCurvePointsValid(val); }
00476
00477
00478 void flushCurvePoints() const { ptr()->flushCurvePoints(); }
00479
00480
00481 bool hasCurvePoints(int maxCellLID , int curveID) const { return ptr()->hasCurvePoints( maxCellLID , curveID); }
00482
00483
00484 void setCurvePoints(int maxCellLID, int curveID , Array<Point>& points , Array<Point>& derivs , Array<Point>& normals) const
00485 {ptr()->setCurvePoints( maxCellLID, curveID , points , derivs , normals); }
00486
00487
00488 void getCurvePoints(int maxCellLID, int curveID , Array<Point>& points , Array<Point>& derivs , Array<Point>& normals) const
00489 {ptr()->getCurvePoints( maxCellLID, curveID , points , derivs , normals); }
00490
00491
00492
00493 private:
00494
00495 IncrementallyCreatableMesh* creatableMesh();
00496
00497
00498
00499 bool checkVertexConsistency(std::ostream& os) const ;
00500
00501 bool checkCellConsistency(std::ostream& os, int dim) const ;
00502
00503
00504 bool checkRemoteEntity(std::ostream& os, int p, int dim, int gid,
00505 int owner, bool mustExist, int& lid) const ;
00506
00507
00508 bool testIdentity(std::ostream& os, int a, int b, const std::string& msg) const ;
00509
00510
00511 bool testIdentity(std::ostream& os,
00512 const Array<int>& a,
00513 const Array<int>& b, const std::string& msg) const ;
00514 };
00515 }
00516
00517 #endif