46 void Foam::pointConstraints::makePatchPatchAddressing()
50 Pout<<
"pointConstraints::makePatchPatchAddressing() : " 51 <<
"constructing boundary addressing" 55 const pointMesh& pMesh =
mesh();
56 const polyMesh&
mesh = pMesh();
58 const pointBoundaryMesh&
pbm = pMesh.boundary();
62 label nPatchPatchPoints = 0;
66 const auto* fpp = isA<facePointPatch>(
pbm[patchi]);
70 && !isA<emptyPointPatch>(
pbm[patchi])
71 && !
pbm[patchi].coupled()
74 const labelList& bp = fpp->patch().boundaryPoints();
76 nPatchPatchPoints += bp.
size();
81 <<
" nBoundaryPoints:" << bp.size() <<
endl;
88 Pout<<
indent <<
"Found nPatchPatchPoints:" << nPatchPatchPoints
97 Map<label> patchPatchPointSet(2*nPatchPatchPoints);
100 patchPatchPointConstraints_.setSize(nPatchPatchPoints);
101 patchPatchPointConstraints_ = pointConstraint();
104 labelList patchPatchPoints(nPatchPatchPoints);
110 const auto* fpp = isA<facePointPatch>(
pbm[patchi]);
114 && !isA<emptyPointPatch>(
pbm[patchi])
115 && !
pbm[patchi].coupled()
118 const labelList& bp = fpp->patch().boundaryPoints();
123 const label ppp = meshPoints[bp[pointi]];
125 const auto iter = patchPatchPointSet.cfind(ppp);
127 label constraintI = -1;
131 constraintI = iter.val();
135 patchPatchPointSet.insert(ppp, pppi);
136 patchPatchPoints[pppi] = ppp;
137 constraintI = pppi++;
141 pbm[patchi].applyConstraint
144 patchPatchPointConstraints_[constraintI]
152 Pout<<
indent <<
"Have (local) constrained points:" 153 << nPatchPatchPoints <<
endl;
162 const labelListList& globalPointSlaves = gd.globalPointSlaves();
163 const mapDistribute& globalPointSlavesMap = gd.globalPointSlavesMap();
164 const Map<label>& cpPointMap = gd.coupledPatch().meshPointMap();
165 const labelList& cpMeshPoints = gd.coupledPatch().meshPoints();
168 List<pointConstraint> constraints
170 globalPointSlavesMap.constructSize()
176 const auto* fpp = isA<facePointPatch>(
pbm[patchi]);
180 && !isA<emptyPointPatch>(
pbm[patchi])
181 && !
pbm[patchi].coupled()
184 const labelList& bp = fpp->patch().boundaryPoints();
189 const label ppp = meshPoints[bp[pointi]];
191 const auto iter = cpPointMap.cfind(ppp);
197 constraints[iter.val()] = patchPatchPointConstraints_
199 patchPatchPointSet[ppp]
207 globalPointSlavesMap.distribute(constraints);
210 forAll(globalPointSlaves, pointi)
212 const labelList& slaves = globalPointSlaves[pointi];
217 constraints[pointi].combine(constraints[slaves[i]]);
222 constraints[slaves[i]] = constraints[pointi];
227 globalPointSlavesMap.reverseDistribute
234 forAll(constraints, coupledPointi)
236 if (constraints[coupledPointi].first() != 0)
238 label meshPointi = cpMeshPoints[coupledPointi];
240 const auto iter = patchPatchPointSet.cfind(meshPointi);
242 label constraintI = -1;
253 constraintI = iter.val();
265 if (patchPatchPoints.size() <= pppi)
271 patchPatchPoints.setSize(pppi+100);
272 patchPatchPointConstraints_.setSize
278 patchPatchPointSet.insert(meshPointi, pppi);
279 patchPatchPoints[pppi] = meshPointi;
280 constraintI = pppi++;
285 patchPatchPointConstraints_[constraintI].combine
287 constraints[coupledPointi]
295 nPatchPatchPoints = pppi;
296 patchPatchPoints.setSize(nPatchPatchPoints);
297 patchPatchPointConstraints_.setSize(nPatchPatchPoints);
302 Pout<<
indent <<
"Have (global) constrained points:" 303 << nPatchPatchPoints <<
endl;
310 patchPatchPointConstraintPoints_.
setSize(nPatchPatchPoints);
311 patchPatchPointConstraintTensors_.
setSize(nPatchPatchPoints);
313 label nConstraints = 0;
315 forAll(patchPatchPointConstraints_, i)
320 if (patchPatchPointConstraints_[i].first() != 0)
322 patchPatchPointConstraintPoints_[nConstraints] =
325 patchPatchPointConstraintTensors_[nConstraints] =
326 patchPatchPointConstraints_[i].constraintTransformation();
334 Pout<<
indent <<
"Have non-trivial constrained points:" 335 << nConstraints <<
endl;
338 patchPatchPointConstraints_.setSize(nConstraints);
339 patchPatchPointConstraintPoints_.
setSize(nConstraints);
340 patchPatchPointConstraintTensors_.
setSize(nConstraints);
346 <<
"pointConstraints::makePatchPatchAddressing() : " 347 <<
"finished constructing boundary addressing" 355 Foam::pointConstraints::pointConstraints(
const pointMesh& pm)
361 Pout<<
"pointConstraints::pointConstraints(const pointMesh&): " 362 <<
"Constructing from pointMesh " << pm.
name()
366 makePatchPatchAddressing();
376 Pout<<
"pointConstraints::~pointConstraints()" <<
endl;
385 makePatchPatchAddressing();
398 const bool overrideFixedValue
407 syncUntransformedData
415 constrainCorners(pf);
425 if (overrideFixedValue)
433 void Foam::pointConstraints::constrainCorners<Foam::scalar>
435 GeometricField<scalar, pointPatchField, pointMesh>& pf
441 void Foam::pointConstraints::constrainCorners<Foam::label>
443 GeometricField<label, pointPatchField, pointMesh>& pf
const polyBoundaryMesh & pbm
void size(const label n)
Older name for setAddressableSize.
Ostream & indent(Ostream &os)
Indent stream.
static const twoDPointCorrector & New(const polyMesh &mesh, Args &&... args)
Get existing or create MeshObject registered with typeName.
void constrainDisplacement(pointVectorField &displacement, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints),.
bool movePoints()
Correct weighting factors for moving mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual const fileName & name() const override
Get the name of the output serial stream. (eg, the name of the Fstream file name) ...
List< labelList > labelListList
List of labelList.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
#define forAll(list, i)
Loop across all elements in list.
void correctDisplacement(const pointField &p, vectorField &disp) const
Correct motion displacements.
const globalMeshData & globalData() const
Return parallel info (demand-driven)
void setSize(const label n)
Alias for resize()
const pointMesh & mesh() const noexcept
Reference to the mesh.
const Mesh & mesh() const noexcept
Return mesh.
int debug
Static debugging option.
defineTypeNameAndDebug(combustionModel, 0)
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field values.
void updateMesh(const mapPolyMesh &)
Update mesh topology using the morph engine.
void correctBoundaryConditions()
Correct boundary field.
List< label > labelList
A List of labels.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
~pointConstraints()
Destructor.