Go to the documentation of this file.
43 volBSplinesBase::volBSplinesBase
50 activeDesignVariables_(0)
65 ).
subDict(
"volumetricBSplinesMotionSolverCoeffs")
68 wordList controlBoxes(NURBSdict.toc());
69 volume_.
setSize(controlBoxes.size());
73 for (
const word& boxName : controlBoxes)
75 if (NURBSdict.isDict(boxName))
82 NURBSdict.subDict(boxName),
87 volume_[iBox].write();
91 volume_.setSize(iBox);
94 activeDesignVariables_.setSize(3*getTotalControlPointsNumber(), -1);
96 const labelList startCpID(getStartCpID());
99 const label start(3*startCpID[boxI]);
100 const boolList& isActiveVar = volume_[boxI].getActiveDesignVariables();
103 if (isActiveVar[varI])
105 activeDesignVariables_[iActive++] = start + varI;
109 activeDesignVariables_.setSize(iActive);
141 return volume_[iNURB].getControlPoints();
162 nCPs += volume_[iNURB].getControlPoints().size();
171 return volume_.size();
183 startID[iNURB] +
volume_[iNURB].getControlPoints().size();
193 for (label iBox = 0; iBox < startCPID.size() - 1 ; ++iBox)
195 if (cpI >= startCPID[iBox] || cpI < startCPID[iBox + 1])
202 <<
"Invalid control point ID " << cpI <<
endl
220 scalar maxDisplacement(0);
221 label pastControlPoints(0);
224 const label nb(volume_[iNURB].getControlPoints().size());
228 forAll(localControlPointsMovement, iCPM)
230 localControlPointsMovement[iCPM] =
231 controlPointsMovement[pastControlPoints + iCPM];
234 maxDisplacement =
max
237 volume_[iNURB].computeMaxBoundaryDisplacement
239 localControlPointsMovement,
244 pastControlPoints += nb;
247 return maxDisplacement;
256 label pastControlPoints(0);
259 const label nb(volume_[iNURB].getControlPoints().size());
263 forAll(localControlPointsMovement, iCPM)
265 localControlPointsMovement[iCPM] =
266 controlPointsMovement[pastControlPoints + iCPM];
269 volume_[iNURB].boundControlPointMovement(localControlPointsMovement);
272 forAll(localControlPointsMovement, iCPM)
274 controlPointsMovement[pastControlPoints + iCPM] =
275 localControlPointsMovement[iCPM];
278 pastControlPoints += nb;
288 label pastControlPoints(0);
291 const label nb(volume_[iNURB].getControlPoints().size());
295 forAll(localControlPointsMovement, iCPM)
297 localControlPointsMovement[iCPM] =
298 controlPointsMovement[pastControlPoints + iCPM];
303 volume_[iNURB].getControlPoints()
304 + localControlPointsMovement
307 volume_[iNURB].setControlPoints(newCps);
309 pastControlPoints += nb;
318 box.writeCps(
"cpsBsplines"+mesh_.time().timeName());
319 box.writeCpsInDict();
labelList activeDesignVariables_
Active design variables numbering for all boxes.
virtual bool movePoints()
Dummy function required by MeshObject.
NURBS3DVolume & boxRef(const label boxI)
Get non-const reference to a specific box.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A class for handling words, derived from Foam::string.
static constexpr const zero Zero
Global zero (0)
vectorField getAllControlPoints() const
Get control points from all boxes.
label findBoxID(const label cpI) const
Find box of certain control point.
NURBS3DVolume morpher. Includes support functions for gradient computations Base class providing supp...
const NURBS3DVolume & box(const label boxI) const
Get const reference to a specific box.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const labelList & getActiveDesignVariables() const
Get active design variables.
void moveControlPoints(const vectorField &controlPointsMovement)
Move control points. No effect on mesh.
const PtrList< NURBS3DVolume > & boxes() const
Get const reference to the vol. B-splines boxes.
#define forAll(list, i)
Loop across all elements in list.
void setSize(const label n)
Alias for resize()
label getTotalControlPointsNumber() const
Get cumulative number of control points from all boxes.
const vectorField & getControlPoints(const label &iNURB) const
Get reference to control points.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
void boundControlPointMovement(vectorField &controlPointsMovement)
Bound control points movement.
label getNumberOfBoxes() const
Get number of boxes.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
PtrList< NURBS3DVolume > & boxesRef()
Get non-const reference to the vol. B-splines boxes.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Mesh data needed to do the Finite Volume discretisation.
PtrList< NURBS3DVolume > volume_
List with volumetric B-splines boxes.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
scalar computeMaxBoundaryDisplacement(const vectorField &controlPointsMovement, const labelList &patchesToBeMoved)
labelList getStartCpID() const
Get start CP ID for each box.
virtual void updateMesh(const mapPolyMesh &)
Dummy function required by MeshObject.
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.
const Time & time() const
Return the top-level database.
const word & constant() const
Return constant name.
defineTypeNameAndDebug(combustionModel, 0)
void writeControlPoints() const
Write control points to constant and optimisation folders.