CFCCellToCellStencil.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 "CFCCellToCellStencil.H"
00028 #include "syncTools.H"
00029 #include "SortableList.H"
00030 #include "emptyPolyPatch.H"
00031
00032
00033
00034
00035 void Foam::CFCCellToCellStencil::calcFaceBoundaryData
00036 (
00037 labelList& 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 label bFaceI = faceI-mesh().nInternalFaces();
00057 neiGlobal[bFaceI] = globalNumbering().toGlobal(own[faceI]);
00058 faceI++;
00059 }
00060 }
00061 else if (isA<emptyPolyPatch>(pp))
00062 {
00063 forAll(pp, i)
00064 {
00065 label bFaceI = faceI-mesh().nInternalFaces();
00066 neiGlobal[bFaceI] = -1;
00067 faceI++;
00068 }
00069 }
00070 else
00071 {
00072
00073 forAll(pp, i)
00074 {
00075 label bFaceI = faceI-mesh().nInternalFaces();
00076 neiGlobal[bFaceI] =
00077 globalNumbering().toGlobal(mesh().nCells()+bFaceI);
00078 faceI++;
00079 }
00080 }
00081 }
00082 syncTools::swapBoundaryFaceList(mesh(), neiGlobal, false);
00083 }
00084
00085
00086
00087
00088 void Foam::CFCCellToCellStencil::calcCellStencil(labelListList& globalCellCells)
00089 const
00090 {
00091 const label nBnd = mesh().nFaces()-mesh().nInternalFaces();
00092 const labelList& own = mesh().faceOwner();
00093 const labelList& nei = mesh().faceNeighbour();
00094
00095
00096
00097
00098
00099 labelList neiGlobal(nBnd);
00100 calcFaceBoundaryData(neiGlobal);
00101
00102
00103
00104
00105
00106 globalCellCells.setSize(mesh().nCells());
00107 forAll(globalCellCells, cellI)
00108 {
00109 const cell& cFaces = mesh().cells()[cellI];
00110
00111 labelList& cCells = globalCellCells[cellI];
00112
00113 cCells.setSize(cFaces.size()+1);
00114
00115 label nNbr = 0;
00116
00117
00118 cCells[nNbr++] = globalNumbering().toGlobal(cellI);
00119
00120
00121 forAll(cFaces, i)
00122 {
00123 label faceI = cFaces[i];
00124
00125 if (mesh().isInternalFace(faceI))
00126 {
00127 label nbrCellI = own[faceI];
00128 if (nbrCellI == cellI)
00129 {
00130 nbrCellI = nei[faceI];
00131 }
00132 cCells[nNbr++] = globalNumbering().toGlobal(nbrCellI);
00133 }
00134 else
00135 {
00136 label nbrCellI = neiGlobal[faceI-mesh().nInternalFaces()];
00137 if (nbrCellI != -1)
00138 {
00139 cCells[nNbr++] = nbrCellI;
00140 }
00141 }
00142 }
00143 cCells.setSize(nNbr);
00144 }
00145 }
00146
00147
00148
00149
00150 Foam::CFCCellToCellStencil::CFCCellToCellStencil(const polyMesh& mesh)
00151 :
00152 cellToCellStencil(mesh)
00153 {
00154
00155 calcCellStencil(*this);
00156 }
00157
00158
00159
Copyright © 2000-2009 OpenCFD Ltd