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();
64 label nPatchPatchPoints = 0;
68 if (!isA<emptyPointPatch>(
pbm[patchi]) && !
pbm[patchi].
coupled())
70 const labelList& bp = bm[patchi].boundaryPoints();
72 nPatchPatchPoints += bp.
size();
77 <<
" nBoundaryPoints:" << bp.size() <<
endl;
84 Pout<<
indent <<
"Found nPatchPatchPoints:" << nPatchPatchPoints
93 Map<label> patchPatchPointSet(2*nPatchPatchPoints);
96 patchPatchPointConstraints_.setSize(nPatchPatchPoints);
97 patchPatchPointConstraints_ = pointConstraint();
100 labelList patchPatchPoints(nPatchPatchPoints);
106 if (!isA<emptyPointPatch>(
pbm[patchi]) && !
pbm[patchi].
coupled())
108 const labelList& bp = bm[patchi].boundaryPoints();
113 const label ppp = meshPoints[bp[pointi]];
115 const auto iter = patchPatchPointSet.cfind(ppp);
117 label constraintI = -1;
121 constraintI = iter.val();
125 patchPatchPointSet.insert(ppp, pppi);
126 patchPatchPoints[pppi] = ppp;
127 constraintI = pppi++;
131 pbm[patchi].applyConstraint
134 patchPatchPointConstraints_[constraintI]
142 Pout<<
indent <<
"Have (local) constrained points:" 143 << nPatchPatchPoints <<
endl;
152 const labelListList& globalPointSlaves = gd.globalPointSlaves();
153 const mapDistribute& globalPointSlavesMap = gd.globalPointSlavesMap();
154 const Map<label>& cpPointMap = gd.coupledPatch().meshPointMap();
155 const labelList& cpMeshPoints = gd.coupledPatch().meshPoints();
158 List<pointConstraint> constraints
160 globalPointSlavesMap.constructSize()
166 if (!isA<emptyPointPatch>(
pbm[patchi]) && !
pbm[patchi].
coupled())
168 const labelList& bp = bm[patchi].boundaryPoints();
173 const label ppp = meshPoints[bp[pointi]];
175 const auto iter = cpPointMap.cfind(ppp);
181 constraints[iter.val()] = patchPatchPointConstraints_
183 patchPatchPointSet[ppp]
191 globalPointSlavesMap.distribute(constraints);
194 forAll(globalPointSlaves, pointi)
196 const labelList& slaves = globalPointSlaves[pointi];
201 constraints[pointi].combine(constraints[slaves[i]]);
206 constraints[slaves[i]] = constraints[pointi];
211 globalPointSlavesMap.reverseDistribute
218 forAll(constraints, coupledPointi)
220 if (constraints[coupledPointi].first() != 0)
222 label meshPointi = cpMeshPoints[coupledPointi];
224 const auto iter = patchPatchPointSet.cfind(meshPointi);
226 label constraintI = -1;
237 constraintI = iter.val();
249 if (patchPatchPoints.size() <= pppi)
255 patchPatchPoints.setSize(pppi+100);
256 patchPatchPointConstraints_.setSize
262 patchPatchPointSet.insert(meshPointi, pppi);
263 patchPatchPoints[pppi] = meshPointi;
264 constraintI = pppi++;
269 patchPatchPointConstraints_[constraintI].combine
271 constraints[coupledPointi]
279 nPatchPatchPoints = pppi;
280 patchPatchPoints.setSize(nPatchPatchPoints);
281 patchPatchPointConstraints_.setSize(nPatchPatchPoints);
286 Pout<<
indent <<
"Have (global) constrained points:" 287 << nPatchPatchPoints <<
endl;
294 patchPatchPointConstraintPoints_.
setSize(nPatchPatchPoints);
295 patchPatchPointConstraintTensors_.
setSize(nPatchPatchPoints);
297 label nConstraints = 0;
299 forAll(patchPatchPointConstraints_, i)
304 if (patchPatchPointConstraints_[i].first() != 0)
306 patchPatchPointConstraintPoints_[nConstraints] =
309 patchPatchPointConstraintTensors_[nConstraints] =
310 patchPatchPointConstraints_[i].constraintTransformation();
318 Pout<<
indent <<
"Have non-trivial constrained points:" 319 << nConstraints <<
endl;
322 patchPatchPointConstraints_.setSize(nConstraints);
323 patchPatchPointConstraintPoints_.
setSize(nConstraints);
324 patchPatchPointConstraintTensors_.
setSize(nConstraints);
330 <<
"pointConstraints::makePatchPatchAddressing() : " 331 <<
"finished constructing boundary addressing" 339 Foam::pointConstraints::pointConstraints(
const pointMesh& pm)
341 MeshObject<pointMesh,
Foam::UpdateableMeshObject, pointConstraints>(pm)
345 Pout<<
"pointConstraints::pointConstraints(const pointMesh&): " 346 <<
"Constructing from pointMesh " << pm.
name()
350 makePatchPatchAddressing();
360 Pout<<
"pointConstraints::~pointConstraints()" <<
endl;
369 makePatchPatchAddressing();
382 const bool overrideFixedValue
391 syncUntransformedData
399 constrainCorners(pf);
409 if (overrideFixedValue)
417 void Foam::pointConstraints::constrainCorners<Foam::scalar>
419 GeometricField<scalar, pointPatchField, pointMesh>& pf
425 void Foam::pointConstraints::constrainCorners<Foam::label>
427 GeometricField<label, pointPatchField, pointMesh>& pf
virtual const fileName & name() const
Get the name of the output serial stream. (eg, the name of the Fstream file name) ...
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 a new MeshObject. Registered with typeName.
void constrainDisplacement(pointVectorField &displacement, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints),.
bool coupled(solutionDict.getOrDefault("coupledEnergyField", false))
bool movePoints()
Correct weighting factors for moving mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
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.
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.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh for underlying volume mesh.
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.