1 //void volPointInterpolation::makeBoundaryWeights() const
3 // const labelList& ptc = boundaryPoints();
5 // Calculate the correction vectors and weighting factors
6 //pointBoundaryWeightsPtr_ = new FieldField<Field, scalar>(ptc.size());
7 //FieldField<Field, scalar>& w = *pointBoundaryWeightsPtr_;
8 FieldField<Field, scalar> w(ptc.size());
11 const labelListList& pf = mesh.pointFaces();
13 const volVectorField& centres = mesh.C();
15 const fvBoundaryMesh& bm = mesh.boundary();
17 pointScalarField volPointSumWeights
22 mesh.polyMesh::instance(),
26 dimensionedScalar("zero", dimless, 0)
31 const label curPoint = ptc[pointI];
33 const labelList& curFaces = pf[curPoint];
35 //w.hook(new scalarField(curFaces.size())); //philipc no hook function
39 new scalarField(curFaces.size())
42 scalarField& curWeights = w[pointI];
44 label nFacesAroundPoint = 0;
46 const vector& pointLoc = mesh.points()[curPoint];
48 // Go through all the faces
49 forAll (curFaces, faceI)
51 if (!mesh.isInternalFace(curFaces[faceI]))
53 // This is a boundary face. If not in the empty patch
54 // or coupled calculate the extrapolation vector
56 mesh.boundaryMesh().whichPatch(curFaces[faceI]);
60 !isA<emptyFvPatch>(bm[patchID])
63 //&& Pstream::parRun()
64 //&& !mesh.parallelData().cyclicParallel()
68 curWeights[nFacesAroundPoint] =
72 - centres.boundaryField()[patchID]
74 bm[patchID].patch().whichFace(curFaces[faceI])
83 // Reset the sizes of the local weights
84 curWeights.setSize(nFacesAroundPoint);
86 // Collect the sum of weights for parallel correction
87 volPointSumWeights[curPoint] += sum(curWeights);
90 // Do parallel correction of weights
92 // Update coupled boundaries
93 // Work-around for cyclic parallels.
94 /*if (Pstream::parRun() && !mesh.parallelData().cyclicParallel())
96 forAll (volPointSumWeights.boundaryField(), patchI)
98 if (volPointSumWeights.boundaryField()[patchI].coupled())
100 volPointSumWeights.boundaryField()[patchI].initAddField();
104 forAll (volPointSumWeights.boundaryField(), patchI)
106 if (volPointSumWeights.boundaryField()[patchI].coupled())
108 volPointSumWeights.boundaryField()[patchI].addField
110 volPointSumWeights.internalField()
116 // Re-scale the weights for the current point
119 w[pointI] /= volPointSumWeights[ptc[pointI]];