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 "CECCellToCellStencil.H"
00027 #include <OpenFOAM/syncTools.H>
00028 
00029 
00030 
00031 
00032 void Foam::CECCellToCellStencil::calcEdgeBoundaryData
00033 (
00034     const boolList& isValidBFace,
00035     const labelList& boundaryEdges,
00036     EdgeMap<labelList>& neiGlobal
00037 ) const
00038 {
00039     neiGlobal.resize(2*boundaryEdges.size());
00040 
00041     labelHashSet edgeGlobals;
00042 
00043     forAll(boundaryEdges, i)
00044     {
00045         label edgeI = boundaryEdges[i];
00046 
00047         neiGlobal.insert
00048         (
00049             mesh().edges()[edgeI],
00050             calcFaceCells
00051             (
00052                 isValidBFace,
00053                 mesh().edgeFaces(edgeI),
00054                 edgeGlobals
00055             )
00056         );
00057     }
00058 
00059     syncTools::syncEdgeMap
00060     (
00061         mesh(),
00062         neiGlobal,
00063         unionEqOp(),
00064         false           
00065     );
00066 }
00067 
00068 
00069 
00070 
00071 void Foam::CECCellToCellStencil::calcCellStencil
00072 (
00073     labelListList& globalCellCells
00074 ) const
00075 {
00076     
00077     labelList boundaryEdges
00078     (
00079         allCoupledFacesPatch()().meshEdges
00080         (
00081             mesh().edges(),
00082             mesh().pointEdges()
00083         )
00084     );
00085 
00086     
00087     
00088     
00089     
00090     
00091     
00092     
00093     
00094     
00095     
00096     
00097     
00098     
00099     
00100     
00101     
00102     
00103     
00104     
00105     
00106     
00107     
00108 
00109 
00110     
00111     boolList isValidBFace;
00112     validBoundaryFaces(isValidBFace);
00113 
00114 
00115     
00116     
00117     
00118     EdgeMap<labelList> neiGlobal;
00119     calcEdgeBoundaryData
00120     (
00121         isValidBFace,
00122         boundaryEdges,
00123         neiGlobal
00124     );
00125 
00126     globalCellCells.setSize(mesh().nCells());
00127 
00128     
00129 
00130     forAll(boundaryEdges, i)
00131     {
00132         label edgeI = boundaryEdges[i];
00133 
00134         const labelList& eGlobals = neiGlobal[mesh().edges()[edgeI]];
00135 
00136         
00137         const labelList& eCells = mesh().edgeCells(edgeI);
00138 
00139         forAll(eCells, j)
00140         {
00141             label cellI = eCells[j];
00142 
00143             
00144             merge
00145             (
00146                 globalNumbering().toGlobal(cellI),
00147                 eGlobals,
00148                 globalCellCells[cellI]
00149             );
00150         }
00151     }
00152     neiGlobal.clear();
00153 
00154     
00155     labelHashSet edgeGlobals;
00156 
00157     for (label edgeI = 0; edgeI < mesh().nEdges(); edgeI++)
00158     {
00159         labelList eGlobals
00160         (
00161             calcFaceCells
00162             (
00163                 isValidBFace,
00164                 mesh().edgeFaces(edgeI),
00165                 edgeGlobals
00166             )
00167         );
00168 
00169         const labelList& eCells = mesh().edgeCells(edgeI);
00170 
00171         forAll(eCells, j)
00172         {
00173             label cellI = eCells[j];
00174 
00175             merge
00176             (
00177                 globalNumbering().toGlobal(cellI),
00178                 eGlobals,
00179                 globalCellCells[cellI]
00180             );
00181         }
00182     }
00183 }
00184 
00185 
00186 
00187 
00188 Foam::CECCellToCellStencil::CECCellToCellStencil(const polyMesh& mesh)
00189 :
00190     cellToCellStencil(mesh)
00191 {
00192     
00193     calcCellStencil(*this);
00194 }
00195 
00196 
00197