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