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