enrichedPatchMasterPoints.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
00028
00029 #include "enrichedPatch.H"
00030 #include "primitiveMesh.H"
00031 #include "demandDrivenData.H"
00032 #include "DynamicList.H"
00033
00034
00035
00036 const Foam::label Foam::enrichedPatch::nFaceHits_ = 4;
00037
00038
00039
00040 void Foam::enrichedPatch::calcMasterPointFaces() const
00041 {
00042 if (masterPointFacesPtr_)
00043 {
00044 FatalErrorIn("void enrichedPatch::calcMasterPointFaces() const")
00045 << "Master point face addressing already calculated."
00046 << abort(FatalError);
00047 }
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 Map<DynamicList<label> > mpf(meshPoints().size());
00058
00059 const faceList& ef = enrichedFaces();
00060
00061
00062 forAll (masterPatch_, faceI)
00063 {
00064 const face& curFace = ef[faceI + slavePatch_.size()];
00065
00066 forAll (curFace, pointI)
00067 {
00068 Map<DynamicList<label> >::iterator mpfIter =
00069 mpf.find(curFace[pointI]);
00070
00071 if (mpfIter == mpf.end())
00072 {
00073
00074 mpf.insert
00075 (
00076 curFace[pointI],
00077 DynamicList<label>(primitiveMesh::facesPerPoint_)
00078 );
00079
00080
00081 mpf.find(curFace[pointI])().append(faceI);
00082 }
00083 else
00084 {
00085 mpfIter().append(faceI);
00086 }
00087 }
00088 }
00089
00090
00091 const labelList& slaveMeshPoints = slavePatch_.meshPoints();
00092
00093 forAll (slavePointFaceHits_, pointI)
00094 {
00095 if
00096 (
00097 slavePointPointHits_[pointI] < 0
00098 && slavePointEdgeHits_[pointI] < 0
00099 && slavePointFaceHits_[pointI].hit()
00100 )
00101 {
00102
00103
00104 const label mergedSmp =
00105 pointMergeMap().find(slaveMeshPoints[pointI])();
00106
00107 Map<DynamicList<label> >::iterator mpfIter =
00108 mpf.find(mergedSmp);
00109
00110 if (mpfIter == mpf.end())
00111 {
00112
00113 mpf.insert
00114 (
00115 mergedSmp,
00116 DynamicList<label>(primitiveMesh::facesPerPoint_)
00117 );
00118
00119
00120 mpf.find(mergedSmp)().append
00121 (
00122 slavePointFaceHits_[pointI].hitObject()
00123 );
00124 }
00125 else
00126 {
00127 mpfIter().append(slavePointFaceHits_[pointI].hitObject());
00128 }
00129 }
00130 }
00131
00132
00133 const labelList mpfToc = mpf.toc();
00134
00135 masterPointFacesPtr_ = new Map<labelList>(2*mpfToc.size());
00136 Map<labelList>& masterPointFaceAddr = *masterPointFacesPtr_;
00137
00138 forAll (mpfToc, mpfTocI)
00139 {
00140 labelList l;
00141 l.transfer(mpf.find(mpfToc[mpfTocI])());
00142
00143 masterPointFaceAddr.insert(mpfToc[mpfTocI], l);
00144 }
00145
00146 }
00147
00148
00149
00150
00151 const Foam::Map<Foam::labelList>& Foam::enrichedPatch::masterPointFaces() const
00152 {
00153 if (!masterPointFacesPtr_)
00154 {
00155 calcMasterPointFaces();
00156 }
00157
00158 return *masterPointFacesPtr_;
00159 }
00160
00161
00162
Copyright © 2000-2009 OpenCFD Ltd