43volBSplinesBase::volBSplinesBase
48 MeshObject_type(
mesh),
59 mesh.time().constant(),
65 ).
subDict(
"volumetricBSplinesMotionSolverCoeffs")
69 volume_.resize(NURBSdict.size());
73 for (
const entry& dEntry : NURBSdict)
82 volume_[iBox].writeParamCoordinates();
94 const label start(3*startCpID[boxI]);
98 if (isActiveVar[varI])
136 return volume_[iNURB].getControlPoints();
157 nCPs +=
volume_[iNURB].getControlPoints().size();
178 startID[iNURB] +
volume_[iNURB].getControlPoints().size();
194 for (label iBox = 0; iBox < startCPID.size() - 1 ; ++iBox)
196 if (cpI >= startCPID[iBox] || cpI < startCPID[iBox + 1])
203 <<
"Invalid control point ID " << cpI <<
endl
214 for (label iBox = 0; iBox < startVarID.
size() - 1 ; ++iBox)
216 if (varID >= startVarID[iBox] && varID < startVarID[iBox + 1])
222 const label localVarID = varID - startVarID[boxID];
223 decomposed.
x() = boxID;
224 decomposed.
y() = localVarID/3;
225 decomposed.
z() = localVarID%3;
228 <<
" belongs to box " << decomposed.
x()
229 <<
" cpLocal " << decomposed.
y()
230 <<
" dir " << decomposed.
z()
248 scalar maxDisplacement(0);
249 label pastControlPoints(0);
252 const label nb(volume_[iNURB].getControlPoints().size());
256 forAll(localControlPointsMovement, iCPM)
258 localControlPointsMovement[iCPM] =
259 controlPointsMovement[pastControlPoints + iCPM];
262 maxDisplacement =
max
265 volume_[iNURB].computeMaxBoundaryDisplacement
267 localControlPointsMovement,
272 pastControlPoints += nb;
275 return maxDisplacement;
288 label pastControlPoints(0);
291 const label nb(volume_[iNURB].getControlPoints().size());
295 forAll(localControlPointsMovement, iCPM)
297 localControlPointsMovement[iCPM] =
298 controlPointsMovement[pastControlPoints + iCPM];
302 volume_[iNURB].computeNewBoundaryPoints
304 localControlPointsMovement,
309 pastControlPoints += nb;
312 return tdisplacement;
321 label pastControlPoints(0);
324 const label nb(volume_[iNURB].getControlPoints().size());
328 forAll(localControlPointsMovement, iCPM)
330 localControlPointsMovement[iCPM] =
331 controlPointsMovement[pastControlPoints + iCPM];
334 volume_[iNURB].boundControlPointMovement(localControlPointsMovement);
337 forAll(localControlPointsMovement, iCPM)
339 controlPointsMovement[pastControlPoints + iCPM] =
340 localControlPointsMovement[iCPM];
343 pastControlPoints += nb;
353 label pastControlPoints(0);
356 const label nb(volume_[iNURB].getControlPoints().size());
360 forAll(localControlPointsMovement, iCPM)
362 localControlPointsMovement[iCPM] =
363 controlPointsMovement[pastControlPoints + iCPM];
368 volume_[iNURB].getControlPoints()
369 + localControlPointsMovement
374 pastControlPoints += nb;
383 box.writeCps(
"cpsBsplines" +
mesh_.time().timeName());
label size() const noexcept
The number of elements in list.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void push_back(const T &val)
Copy append an element to the end of this list.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
@ NO_REGISTER
Do not request registration (bool: false).
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
void setSize(label n)
Alias for resize().
const fvMesh & mesh() const noexcept
NURBS3DVolume morpher. Includes support functions for gradient computations Base class providing supp...
static autoPtr< NURBS3DVolume > New(const dictionary &dict, const fvMesh &mesh, bool computeParamCoors=true)
Return a reference to the selected NURBS model.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
void size(const label n)
Older name for setAddressableSize.
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
const Cmpt & x() const noexcept
Access to the vector x component.
const Cmpt & z() const noexcept
Access to the vector z component.
const Cmpt & y() const noexcept
Access to the vector y component.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
A keyword and a list of tokens is an 'entry'.
Mesh data needed to do the Finite Volume discretisation.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for managing temporary objects.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Class constructing a number of volumetric B-Splines boxes, read from dynamicMeshDict....
virtual bool movePoints()
Dummy function required by MeshObject.
void moveControlPoints(const vectorField &controlPointsMovement)
Move control points. No effect on mesh.
const vectorField & getControlPoints(const label &iNURB) const
Get reference to control points.
const PtrList< NURBS3DVolume > & boxes() const
Get const reference to the vol. B-splines boxes.
vectorField getAllControlPoints() const
Get control points from all boxes.
const labelList & getActiveDesignVariables() const
Get active design variables.
void writeControlPoints() const
Write control points to constant and optimisation folders.
scalar computeMaxBoundaryDisplacement(const vectorField &controlPointsMovement, const labelList &patchesToBeMoved)
Get max boundary displacement for a given control-points movement.
labelList getStartCpID() const
Get start CP ID for each box.
labelList getStartVarID() const
Get start CP ID for each box.
label findBoxID(const label cpI) const
Find box of certain control point.
NURBS3DVolume & boxRef(const label boxI)
Get non-const reference to a specific box.
PtrList< NURBS3DVolume > & boxesRef()
Get non-const reference to the vol. B-splines boxes.
labelList activeDesignVariables_
Active design variables numbering for all boxes.
const NURBS3DVolume & box(const label boxI) const
Get const reference to a specific box.
label getTotalControlPointsNumber() const
Get cumulative number of control points from all boxes.
void boundControlPointMovement(vectorField &controlPointsMovement) const
Bound control points movement.
PtrList< NURBS3DVolume > volume_
List with volumetric B-splines boxes.
virtual void updateMesh(const mapPolyMesh &)
Dummy function required by MeshObject.
tmp< vectorField > computeBoundaryDisplacement(const vectorField &controlPointsMovement, const labelList &patchesToBeMoved)
Get the updated boundary points only.
label getNumberOfBoxes() const
Get number of boxes.
Vector< label > decomposeDV(const label dvI) const
From design variable ID, return boxID, cpID and direction.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define DebugInfo
Report an information message using Foam::Info.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
List< label > labelList
A List of labels.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Field< vector > vectorField
Specialisation of Field<T> for vector.
List< bool > boolList
A List of bools.
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define forAll(list, i)
Loop across all elements in list.