CFCFaceToCellStencil.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 "CFCFaceToCellStencil.H"
00028 #include "syncTools.H"
00029 #include "emptyPolyPatch.H"
00030
00031
00032
00033
00034
00035 void Foam::CFCFaceToCellStencil::calcFaceBoundaryData
00036 (
00037 labelListList& neiGlobal
00038 ) const
00039 {
00040 const polyBoundaryMesh& patches = mesh().boundaryMesh();
00041 const label nBnd = mesh().nFaces()-mesh().nInternalFaces();
00042 const labelList& own = mesh().faceOwner();
00043
00044 neiGlobal.setSize(nBnd);
00045
00046 forAll(patches, patchI)
00047 {
00048 const polyPatch& pp = patches[patchI];
00049 label faceI = pp.start();
00050
00051 if (pp.coupled())
00052 {
00053
00054 forAll(pp, i)
00055 {
00056 const labelList& cFaces = mesh().cells()[own[faceI]];
00057
00058 labelList& globFaces = neiGlobal[faceI-mesh().nInternalFaces()];
00059 globFaces.setSize(cFaces.size()-1);
00060 label globI = 0;
00061
00062 forAll(cFaces, j)
00063 {
00064 if (cFaces[j] != faceI)
00065 {
00066 globFaces[globI++] = globalNumbering().toGlobal
00067 (
00068 cFaces[j]
00069 );
00070 }
00071 }
00072 faceI++;
00073 }
00074 }
00075 else if (isA<emptyPolyPatch>(pp))
00076 {
00077
00078 }
00079 else
00080 {
00081
00082 }
00083 }
00084 syncTools::swapBoundaryFaceList(mesh(), neiGlobal, false);
00085 }
00086
00087
00088
00089
00090 void Foam::CFCFaceToCellStencil::calcCellStencil(labelListList& globalCellFaces)
00091 const
00092 {
00093 const label nBnd = mesh().nFaces()-mesh().nInternalFaces();
00094 const labelList& own = mesh().faceOwner();
00095 const labelList& nei = mesh().faceNeighbour();
00096
00097
00098
00099
00100
00101 labelListList neiGlobal(nBnd);
00102 calcFaceBoundaryData(neiGlobal);
00103
00104
00105
00106
00107 boolList validBFace(mesh().nFaces()-mesh().nInternalFaces(), true);
00108
00109 const polyBoundaryMesh& patches = mesh().boundaryMesh();
00110 forAll(patches, patchI)
00111 {
00112 const polyPatch& pp = patches[patchI];
00113
00114 if (isA<emptyPolyPatch>(pp))
00115 {
00116 label bFaceI = pp.start()-mesh().nInternalFaces();
00117 forAll(pp, i)
00118 {
00119 validBFace[bFaceI++] = false;
00120 }
00121 }
00122 }
00123
00124
00125
00126
00127
00128 DynamicList<label> allGlobalFaces(100);
00129
00130 globalCellFaces.setSize(mesh().nCells());
00131 forAll(globalCellFaces, cellI)
00132 {
00133 const cell& cFaces = mesh().cells()[cellI];
00134
00135 allGlobalFaces.clear();
00136
00137
00138 forAll(cFaces, i)
00139 {
00140 label faceI = cFaces[i];
00141
00142 if
00143 (
00144 mesh().isInternalFace(faceI)
00145 || validBFace[faceI-mesh().nInternalFaces()]
00146 )
00147 {
00148 allGlobalFaces.append(globalNumbering().toGlobal(faceI));
00149 }
00150 }
00151
00152
00153 forAll(cFaces, i)
00154 {
00155 label faceI = cFaces[i];
00156
00157 if (mesh().isInternalFace(faceI))
00158 {
00159 label nbrCellI = own[faceI];
00160 if (nbrCellI == cellI)
00161 {
00162 nbrCellI = nei[faceI];
00163 }
00164 const cell& nbrFaces = mesh().cells()[nbrCellI];
00165
00166 forAll(nbrFaces, j)
00167 {
00168 label nbrFaceI = nbrFaces[j];
00169
00170 if
00171 (
00172 mesh().isInternalFace(nbrFaceI)
00173 || validBFace[nbrFaceI-mesh().nInternalFaces()]
00174 )
00175 {
00176 label nbrGlobalI = globalNumbering().toGlobal(nbrFaceI);
00177
00178
00179 if (findIndex(allGlobalFaces, nbrGlobalI) == -1)
00180 {
00181 allGlobalFaces.append(nbrGlobalI);
00182 }
00183 }
00184 }
00185 }
00186 else
00187 {
00188 const labelList& nbrGlobalFaces =
00189 neiGlobal[faceI-mesh().nInternalFaces()];
00190
00191 forAll(nbrGlobalFaces, j)
00192 {
00193 label nbrGlobalI = nbrGlobalFaces[j];
00194
00195
00196 if (findIndex(allGlobalFaces, nbrGlobalI) == -1)
00197 {
00198 allGlobalFaces.append(nbrGlobalI);
00199 }
00200 }
00201 }
00202 }
00203
00204 globalCellFaces[cellI] = allGlobalFaces;
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216 }
00217 }
00218
00219
00220
00221
00222 Foam::CFCFaceToCellStencil::CFCFaceToCellStencil(const polyMesh& mesh)
00223 :
00224 faceToCellStencil(mesh)
00225 {
00226
00227 calcCellStencil(*this);
00228 }
00229
00230
00231
Copyright © 2000-2009 OpenCFD Ltd