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 "sammMesh.H"
00028 #include "emptyPolyPatch.H"
00029 #include "demandDrivenData.H"
00030 #include "cellModeller.H"
00031
00032
00033
00034
00035 const cellModel* sammMesh::unknownPtr_ = cellModeller::lookup("unknown");
00036 const cellModel* sammMesh::hexPtr_ = cellModeller::lookup("hex");
00037 const cellModel* sammMesh::wedgePtr_ = cellModeller::lookup("wedge");
00038 const cellModel* sammMesh::prismPtr_ = cellModeller::lookup("prism");
00039 const cellModel* sammMesh::pyrPtr_ = cellModeller::lookup("pyr");
00040 const cellModel* sammMesh::tetPtr_ = cellModeller::lookup("tet");
00041 const cellModel* sammMesh::tetWedgePtr_ = cellModeller::lookup("tetWedge");
00042
00043 const cellModel* sammMesh::sammTrim1Ptr_ = cellModeller::lookup("sammTrim1");
00044 const cellModel* sammMesh::sammTrim2Ptr_ = cellModeller::lookup("sammTrim2");
00045 const cellModel* sammMesh::sammTrim3Ptr_ = cellModeller::lookup("sammTrim3");
00046 const cellModel* sammMesh::sammTrim4Ptr_ = cellModeller::lookup("sammTrim4");
00047 const cellModel* sammMesh::sammTrim5Ptr_ = cellModeller::lookup("sammTrim5");
00048 const cellModel* sammMesh::sammTrim8Ptr_ = cellModeller::lookup("hexagonalPrism");
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 const label sammMesh::shapeFaceLookup[19][9] =
00063 {
00064 {-1, -1, -1, -1, -1, -1, -1, -1, -1},
00065 {-1, -1, -1, -1, -1, -1, -1, -1, -1},
00066 {-1, -1, -1, -1, -1, -1, -1, -1, -1},
00067 {-1, 4, 5, 2, 3, 0, 1, -1, -1},
00068 {-1, 4, 5, 2, 3, 0, 1, -1, -1},
00069 {-1, 0, 1, 4, -1, 2, 3, -1, -1},
00070 {-1, 0, -1, 4, 2, 1, 3, -1, -1},
00071 {-1, 3, -1, 2, -1, 1, 0, -1, -1},
00072 {-1, -1, -1, -1, -1, -1, -1, -1, -1},
00073 {-1, 0, -1, 1, -1, 2, 3, -1, -1},
00074 {-1, -1, -1, -1, -1, -1, -1, -1, -1},
00075 {-1, 5, 4, 0, 1, 2, 3, 6, -1},
00076
00077 {-1, 1, 0, 2, 4, 3, 5, 6, -1},
00078 {-1, 5, 4, 0, 1, 2, 3, 6, -1},
00079 {-1, 5, 4, 1, 0, 3, 2, 6, -1},
00080 {-1, 4, 3, 2, 5, 1, 0, -1, -1},
00081 {-1, -1, -1, -1, -1, -1, -1, -1, -1},
00082 {-1, -1, -1, -1, -1, -1, -1, -1, -1},
00083 {-1, 0, 1, 2, 5, 3, 6, 4, 7}
00084 };
00085
00086
00087
00088
00089
00090 List<const cellModel*> sammMesh::sammShapeLookup
00091 (
00092 256,
00093 reinterpret_cast<cellModel*>(0)
00094 );
00095
00096 List<const label*> sammMesh::sammAddressingTable
00097 (
00098 256,
00099 reinterpret_cast<label*>(0)
00100 );
00101
00102
00103
00104
00105 void sammMesh::createPolyMeshData()
00106 {
00107 Info << "Creating a polyMesh" << endl;
00108
00109 createPolyCells();
00110
00111 Info<< "\nNumber of internal faces: "
00112 << nInternalFaces_ << endl;
00113
00114 createPolyBoundary();
00115
00116 label nProblemCells = 0;
00117
00118
00119 forAll (cellPolys_, cellI)
00120 {
00121 const labelList& curFaceLabels = cellPolys_[cellI];
00122
00123 forAll (curFaceLabels, faceI)
00124 {
00125 if (curFaceLabels[faceI] == -1)
00126 {
00127 Info << "cell " << cellI
00128 << " has got an unmatched face. "
00129 << "Index: " << cellShapes_[cellI].model().index() << endl
00130
00131
00132 << "cellPolys: " << cellPolys_[cellI] << endl
00133
00134 << endl;
00135
00136 nProblemCells++;
00137
00138 break;
00139 }
00140 }
00141 }
00142
00143 if (nProblemCells > 0)
00144 {
00145 Info << "Number of problem cells: " << nProblemCells << endl;
00146 }
00147 }
00148
00149
00150
00151
00152 sammMesh::sammMesh
00153 (
00154 const fileName& prefix,
00155 const Time& rt,
00156 const scalar scaleFactor
00157 )
00158 :
00159 casePrefix_(prefix),
00160 runTime_(rt),
00161 points_(0),
00162 cellShapes_(0),
00163 boundary_(0),
00164 patchTypes_(0),
00165 defaultFacesName_("defaultFaces"),
00166 defaultFacesType_(emptyPolyPatch::typeName),
00167 patchNames_(0),
00168 patchPhysicalTypes_(0),
00169 starPointLabelLookup_(0),
00170 starCellLabelLookup_(0),
00171 cellFaces_(0),
00172 meshFaces_(0),
00173 cellPolys_(0),
00174 nInternalFaces_(0),
00175 polyBoundaryPatchStartIndices_(0),
00176 pointCellsPtr_(NULL),
00177 isShapeMesh_(true)
00178 {
00179
00180 fillSammCellShapeTable();
00181 fillSammAddressingTable();
00182
00183 readPoints(scaleFactor);
00184
00185 readCells();
00186
00187 readBoundary();
00188
00189 fixCollapsedEdges();
00190
00191 readCouples();
00192
00193
00194 createBoundaryFaces();
00195
00196
00197 }
00198
00199
00200
00201
00202 sammMesh::~sammMesh()
00203 {
00204 deleteDemandDrivenData(pointCellsPtr_);
00205 }
00206
00207
00208
00209
00210
00211