Go to the documentation of this file.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 "polyMesh.H"
00027
00028
00029
00030 void Foam::polyMesh::initMesh()
00031 {
00032 if (debug)
00033 {
00034 Info<< "void polyMesh::initMesh() : "
00035 << "initialising primitiveMesh" << endl;
00036 }
00037
00038
00039
00040 if (neighbour_.size() == owner_.size())
00041 {
00042 label nInternalFaces = 0;
00043
00044 forAll(neighbour_, faceI)
00045 {
00046 if (neighbour_[faceI] == -1)
00047 {
00048 break;
00049 }
00050 else
00051 {
00052 nInternalFaces++;
00053 }
00054 }
00055
00056 neighbour_.setSize(nInternalFaces);
00057 }
00058
00059 label nCells = -1;
00060
00061 forAll(owner_, facei)
00062 {
00063 nCells = max(nCells, owner_[facei]);
00064 }
00065
00066
00067 forAll(neighbour_, facei)
00068 {
00069 nCells = max(nCells, neighbour_[facei]);
00070 }
00071
00072 nCells++;
00073
00074
00075 primitiveMesh::reset
00076 (
00077 points_.size(),
00078 neighbour_.size(),
00079 owner_.size(),
00080 nCells
00081 );
00082
00083 string meshInfo =
00084 "nPoints:" + Foam::name(nPoints())
00085 + " nCells:" + Foam::name(this->nCells())
00086 + " nFaces:" + Foam::name(nFaces())
00087 + " nInternalFaces:" + Foam::name(nInternalFaces());
00088
00089 owner_.note() = meshInfo;
00090 neighbour_.note() = meshInfo;
00091 }
00092
00093
00094 void Foam::polyMesh::initMesh(cellList& c)
00095 {
00096 if (debug)
00097 {
00098 Info<< "void polyMesh::initMesh(cellList& c) : "
00099 << "calculating owner-neighbour arrays" << endl;
00100 }
00101
00102 owner_.setSize(faces_.size(), -1);
00103 neighbour_.setSize(faces_.size(), -1);
00104
00105 boolList markedFaces(faces_.size(), false);
00106
00107 label nInternalFaces = 0;
00108
00109 forAll(c, cellI)
00110 {
00111
00112 const labelList& cellfaces = c[cellI];
00113
00114 forAll (cellfaces, faceI)
00115 {
00116 if (!markedFaces[cellfaces[faceI]])
00117 {
00118
00119 owner_[cellfaces[faceI]] = cellI;
00120 markedFaces[cellfaces[faceI]] = true;
00121 }
00122 else
00123 {
00124
00125 neighbour_[cellfaces[faceI]] = cellI;
00126 nInternalFaces++;
00127 }
00128 }
00129 }
00130
00131
00132
00133
00134 neighbour_.setSize(nInternalFaces);
00135
00136
00137 primitiveMesh::reset
00138 (
00139 points_.size(),
00140 neighbour_.size(),
00141 owner_.size(),
00142 c.size(),
00143 c
00144 );
00145
00146 string meshInfo =
00147 "nPoints: " + Foam::name(nPoints())
00148 + " nCells: " + Foam::name(nCells())
00149 + " nFaces: " + Foam::name(nFaces())
00150 + " nInternalFaces: " + Foam::name(this->nInternalFaces());
00151
00152 owner_.note() = meshInfo;
00153 neighbour_.note() = meshInfo;
00154 }
00155
00156