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