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 #include "starMesh.H"
00028 #include "emptyPolyPatch.H"
00029 #include "demandDrivenData.H"
00030 #include "cellModeller.H"
00031
00032
00033
00034
00035
00036 const scalar starMesh::smallMergeTol_ = 1e-3;
00037 const scalar starMesh::cpMergePointTol_ = 1e-4;
00038
00039
00040
00041
00042
00043 const cellModel* starMesh::unknownPtr_ = cellModeller::lookup("unknown");
00044 const cellModel* starMesh::tetPtr_ = cellModeller::lookup("tet");
00045 const cellModel* starMesh::pyrPtr_ = cellModeller::lookup("pyr");
00046 const cellModel* starMesh::tetWedgePtr_ = cellModeller::lookup("tetWedge");
00047 const cellModel* starMesh::prismPtr_ = cellModeller::lookup("prism");
00048 const cellModel* starMesh::wedgePtr_ = cellModeller::lookup("wedge");
00049 const cellModel* starMesh::hexPtr_ = cellModeller::lookup("hex");
00050
00051 const cellModel* starMesh::sammTrim1Ptr_ = cellModeller::lookup("sammTrim1");
00052 const cellModel* starMesh::sammTrim2Ptr_ = cellModeller::lookup("sammTrim2");
00053 const cellModel* starMesh::sammTrim3Ptr_ = cellModeller::lookup("sammTrim3");
00054 const cellModel* starMesh::sammTrim4Ptr_ = cellModeller::lookup("sammTrim4");
00055 const cellModel* starMesh::sammTrim5Ptr_ = cellModeller::lookup("sammTrim5");
00056 const cellModel* starMesh::sammTrim8Ptr_ = cellModeller::lookup("hexagonalPrism");
00057
00058
00059
00060 const label starMesh::regularAddressingTable[6][8] =
00061 {
00062 { 0, 1, 2, 4, -1, -1, -1, -1},
00063 { 0, 1, 2, 3, 4, -1, -1, -1},
00064 { 0, 1, 2, 4, 6, -1, -1, -1},
00065 { 0, 1, 2, 4, 5, 6, -1, -1},
00066 { 7, 6, 5, 3, 2, 1, 0, -1},
00067 { 0, 1, 2, 3, 4, 5, 6, 7}
00068 };
00069
00070
00071
00072 const label starMesh::sammAddressingTable[9][12] =
00073 {
00074 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
00075 { 3, 2, 6, 7, 11, 9, 1, 5, 4, 12, -1, -1},
00076 {13, 5, 6, 2, 10, 12, 4, 7, 3, 11, -1, -1},
00077 { 2, 3, 0, 1, 10, 11, 12, 4, 8, 9, -1, -1},
00078 { 0, 1, 3, 4, 13, 8, 9, 10, 11, 12, -1, -1},
00079 {12, 7, 6, 5, 8, 11, 10, 9, -1, -1, -1, -1},
00080 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
00081 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
00082 {11, 3, 15, 12, 4, 8, 10, 2, 14, 13, 5, 9}
00083 };
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 const label starMesh::sammFacePermutationTable[24][8] =
00101 {
00102 {-1, 1, 2, 3, 4, 5, 6, 7},
00103 {-1, 3, 4, 5, 6, 1, 2, 7},
00104 {-1, 5, 6, 1, 2, 3, 4, 7},
00105 {-1, 1, 2, 5, 6, 4, 3, 7},
00106 {-1, 3, 4, 1, 2, 6, 5, 7},
00107 {-1, 5, 6, 3, 4, 2, 1, 7},
00108 {-1, 1, 2, 4, 3, 6, 5, 7},
00109 {-1, 3, 4, 6, 5, 2, 1, 7},
00110 {-1, 5, 6, 2, 1, 4, 3, 7},
00111 {-1, 1, 2, 6, 5, 3, 4, 7},
00112 {-1, 3, 4, 2, 1, 5, 6, 7},
00113 {-1, 5, 6, 4, 3, 1, 2, 7},
00114 {-1, 2, 1, 5, 6, 3, 4, 7},
00115 {-1, 4, 3, 1, 2, 5, 6, 7},
00116 {-1, 6, 5, 3, 4, 1, 2, 7},
00117 {-1, 2, 1, 3, 4, 6, 5, 7},
00118 {-1, 4, 3, 5, 6, 2, 1, 7},
00119 {-1, 6, 5, 1, 2, 4, 3, 7},
00120 {-1, 2, 1, 6, 5, 4, 3, 7},
00121 {-1, 4, 3, 2, 1, 6, 5, 7},
00122 {-1, 6, 5, 4, 3, 2, 1, 7},
00123 {-1, 2, 1, 4, 3, 5, 6, 7},
00124 {-1, 4, 3, 6, 5, 1, 2, 7},
00125 {-1, 6, 5, 2, 1, 3, 4, 7}
00126 };
00127
00128 const label starMesh::shapeFaceLookup[19][9] =
00129 {
00130 {-1, -1, -1, -1, -1, -1, -1, -1, -1},
00131 {-1, -1, -1, -1, -1, -1, -1, -1, -1},
00132 {-1, -1, -1, -1, -1, -1, -1, -1, -1},
00133 {-1, 4, 5, 2, 3, 0, 1, -1, -1},
00134 {-1, 1, 0, 5, 4, 2, 3, -1, -1},
00135 {-1, 0, 1, 4, -1, 2, 3, -1, -1},
00136 {-1, 0, -1, 4, 2, 1, 3, -1, -1},
00137 {-1, 3, -1, 2, -1, 1, 0, -1, -1},
00138 {-1, -1, -1, -1, -1, -1, -1, -1, -1},
00139 {-1, 0, -1, 1, -1, 2, 3, -1, -1},
00140 {-1, -1, -1, -1, -1, -1, -1, -1, -1},
00141 {-1, 1, 0, 3, 2, 5, 4, 6, -1},
00142 {-1, 5, 4, 1, 0, 3, 2, 6, -1},
00143 {-1, 2, 3, 0, 1, 4, 5, 6, -1},
00144 {-1, 2, 3, 0, 1, 4, 5, 6, -1},
00145 {-1, 5, 2, 4, 3, 1, 0, -1, -1},
00146 {-1, -1, -1, -1, -1, -1, -1, -1, -1},
00147 {-1, -1, -1, -1, -1, -1, -1, -1, -1},
00148 {-1, 1, 0, 6, 7, 2, 3, 4, 5}
00149 };
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189 void starMesh::createPolyMeshData()
00190 {
00191 Info << "Creating a polyMesh" << endl;
00192
00193 createPolyCells();
00194
00195 Info<< "\nNumber of internal faces: "
00196 << nInternalFaces_ << endl;
00197
00198 createPolyBoundary();
00199 }
00200
00201
00202
00203
00204 void starMesh::clearExtraStorage()
00205 {
00206 Info << "Clearing extra storage" << endl;
00207
00208 starPointLabelLookup_.setSize(0);
00209 starPointID_.setSize(0);
00210 starCellID_.setSize(0);
00211 starCellLabelLookup_.setSize(0);
00212 starCellPermutation_.setSize(0);
00213 cellFaces_.setSize(0);
00214 boundaryCellIDs_.setSize(0);
00215 boundaryCellFaceIDs_.setSize(0);
00216 couples_.clear();
00217
00218 deleteDemandDrivenData(pointCellsPtr_);
00219 }
00220
00221
00222
00223
00224 starMesh::starMesh
00225 (
00226 const fileName& prefix,
00227 const Time& rt,
00228 const scalar scaleFactor
00229 )
00230 :
00231 casePrefix_(prefix),
00232 runTime_(rt),
00233 points_(0),
00234 cellShapes_(0),
00235 boundary_(0),
00236 patchTypes_(0),
00237 defaultFacesName_("defaultFaces"),
00238 defaultFacesType_(emptyPolyPatch::typeName),
00239 patchNames_(0),
00240 patchPhysicalTypes_(0),
00241 starPointLabelLookup_(0),
00242 starPointID_(0),
00243 starCellID_(0),
00244 starCellLabelLookup_(0),
00245 starCellPermutation_(0),
00246 cellFaces_(0),
00247 boundaryCellIDs_(0),
00248 boundaryCellFaceIDs_(0),
00249 meshFaces_(0),
00250 cellPolys_(0),
00251 nInternalFaces_(0),
00252 polyBoundaryPatchStartIndices_(0),
00253 pointCellsPtr_(NULL),
00254 couples_(0),
00255 isShapeMesh_(true)
00256 {
00257 readPoints(scaleFactor);
00258
00259 readCells();
00260
00261 readBoundary();
00262
00263 fixCollapsedEdges();
00264
00265 readCouples();
00266
00267 if (couples_.size())
00268 {
00269 createCoupleMatches();
00270 }
00271
00272 markBoundaryFaces();
00273
00274 mergeCoupleFacePoints();
00275
00276 purgeCellShapes();
00277
00278 collectBoundaryFaces();
00279 }
00280
00281
00282
00283
00284 starMesh::~starMesh()
00285 {
00286 deleteDemandDrivenData(pointCellsPtr_);
00287 }
00288
00289
00290
00291
00292
00293