43 volBSplinesBase::volBSplinesBase
50 activeDesignVariables_(0)
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();
166 return volume_.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
372 volume_[iNURB].setControlPoints(newCps);
374 pastControlPoints += nb;
383 box.writeCps(
"cpsBsplines" + mesh_.time().timeName());
const NURBS3DVolume & box(const label boxI) const
Get const reference to a specific box.
void size(const label n)
Older name for setAddressableSize.
void moveControlPoints(const vectorField &controlPointsMovement)
Move control points. No effect on mesh.
labelList getStartVarID() const
Get start CP ID for each box.
virtual void updateMesh(const mapPolyMesh &)
Dummy function required by MeshObject.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void writeControlPoints() const
Write control points to constant and optimisation folders.
labelList activeDesignVariables_
Active design variables numbering for all boxes.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const vectorField & getControlPoints(const label &iNURB) const
Get reference to control points.
const Cmpt & y() const noexcept
Access to the vector y component.
label getNumberOfBoxes() const
Get number of boxes.
NURBS3DVolume & boxRef(const label boxI)
Get non-const reference to a specific box.
Ignore writing from objectRegistry::writeObject()
const Time & time() const
Return the top-level database.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
NURBS3DVolume morpher. Includes support functions for gradient computations Base class providing supp...
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
static autoPtr< NURBS3DVolume > New(const dictionary &dict, const fvMesh &mesh, bool computeParamCoors=true)
Return a reference to the selected NURBS model.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
#define forAll(list, i)
Loop across all elements in list.
vectorField getAllControlPoints() const
Get control points from all boxes.
void setSize(const label n)
Alias for resize()
const fvMesh & mesh() const noexcept
Reference to the mesh.
labelList getStartCpID() const
Get start CP ID for each box.
const PtrList< NURBS3DVolume > & boxes() const
Get const reference to the vol. B-splines boxes.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
#define DebugInfo
Report an information message using Foam::Info.
void boundControlPointMovement(vectorField &controlPointsMovement) const
Bound control points movement.
const word & constant() const noexcept
Return constant name.
const Cmpt & x() const noexcept
Access to the vector x component.
defineTypeNameAndDebug(combustionModel, 0)
label getTotalControlPointsNumber() const
Get cumulative number of control points from all boxes.
PtrList< NURBS3DVolume > & boxesRef()
Get non-const reference to the vol. B-splines boxes.
const Cmpt & z() const noexcept
Access to the vector z component.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Mesh data needed to do the Finite Volume discretisation.
Field< vector > vectorField
Specialisation of Field<T> for vector.
virtual bool movePoints()
Dummy function required by MeshObject.
tmp< vectorField > computeBoundaryDisplacement(const vectorField &controlPointsMovement, const labelList &patchesToBeMoved)
Get the updated boundary points only.
List< label > labelList
A List of labels.
A class for managing temporary objects.
label findBoxID(const label cpI) const
Find box of certain control point.
PtrList< NURBS3DVolume > volume_
List with volumetric B-splines boxes.
Defines the attributes of an object for which implicit objectRegistry management is supported...
List< bool > boolList
A List of bools.
Vector< label > decomposeDV(const label dvI) const
From design variable ID, return boxID, cpID and direction.
Do not request registration (bool: false)
A keyword and a list of tokens is an 'entry'.
scalar computeMaxBoundaryDisplacement(const vectorField &controlPointsMovement, const labelList &patchesToBeMoved)
Get max boundary displacement for a given control-points movement.
const labelList & getActiveDesignVariables() const
Get active design variables.
Class constructing a number of volumetric B-Splines boxes, read from dynamicMeshDict. Useful for various sensitivities and optMeshMovement classes.
static constexpr const zero Zero
Global zero (0)