70 for (label
k = 1;
k < nCPsDir[2] - 1; ++
k)
72 for (label j = 1; j < nCPsDir[1] - 1; ++j)
74 for (label i = 1; i < nCPsDir[0] - 1; ++i)
77 for (label idir = 0; idir < 3; ++idir)
79 label iIncr(idir == 0);
80 label jIncr(idir == 1);
81 label kIncr(idir == 2);
83 (boxI.
getCPID(i - iIncr, j - jIncr,
k - kIncr));
85 (boxI.
getCPID(i + iIncr, j + jIncr,
k + kIncr));
86 lowerBounds()[3*cpID + idir + passed] =
92 upperBounds()[3*cpID + idir + passed] =
116 for (label ibound = 0; ibound < 3; ++ibound)
121 Vector<label> maxID(nCPsDir[0] - 2, nCPsDir[1] - 2, nCPsDir[2] - 2);
127 maxID[ibound] = nCPsDir[ibound];
128 incr[ibound] = nCPsDir[ibound] - 1;
130 label& i = indices[0];
131 label& j = indices[1];
132 label&
k = indices[2];
134 for (
k = minID[2];
k < maxID[2];
k += incr[2])
136 for (j = minID[1]; j < maxID[1]; j += incr[1])
138 for (i = minID[0]; i < maxID[0]; i += incr[0])
140 label cpID(boxI.getCPID(i, j,
k));
141 for (label dir = 0; dir < 3; ++dir)
150 && indices[ibound] == nCPsDir[ibound] - 1
153 label(incrMinus[ibound] && indices[ibound] == 0);
168 if (incrMinus[ibound])
170 lowerBounds()[3*cpID + dir + passed] =
173 cps[prevCP].component(dir)
177 if (incrPlus[ibound])
179 upperBounds()[3*cpID + dir + passed] =
182 cps[nextCP].component(dir)
196Foam::noConstraint::noConstraint
227 if (designVariables_.nonOverlappingCPs() && designVariables_.updateBounds())
230 <<
"Updating bounds for the design variables " <<
endl;
236 updateInternalBounds(lowerBounds, upperBounds, boxI, passed);
239 updateBoundaryBounds(lowerBounds, upperBounds, boxI, passed);
243 <<
"lower bounds " << lowerBounds() <<
endl;
245 <<
"upper bounds " << upperBounds() <<
endl;
255 return activeCPCoors;
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
NURBS3DVolume morpher. Includes support functions for gradient computations Base class providing supp...
label getCPID(const label i, const label j, const label k) const
Get control point ID from its I-J-K coordinates.
Vector< label > nCPsPerDirection() const
Get number of control points per direction.
const vectorField & getControlPoints() const
Get control points.
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,...
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Abstract base class for defining design variables.
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.
Abstract base class for defining constraints for the control points of volumetric B-Splines morphing ...
volumetricBSplinesDesignVariables & designVariables_
Reference to underlaying volumetric B-Splines morpher.
volBSplinesBase & volBSplinesBase_
Easy access to the volBSplinesBase resting in the designVariables_.
Applies no constraints to the control points. Enforces the non-overlapping bounds,...
virtual void computeBounds(autoPtr< scalarField > &lowerBounds, autoPtr< scalarField > &upperBounds)
Transform bounds from control points to design variables.
void updateInternalBounds(autoPtr< scalarField > &lowerBounds, autoPtr< scalarField > &upperBounds, const NURBS3DVolume &boxI, const label passed)
Update the bounds of the internal control points.
virtual void computeDVsSensitivities(scalarField &dvSens, const scalarField &cpSens)
Compute sensitivities wrt the design variables (chain rule).
virtual void updateBounds(autoPtr< scalarField > &lowerBounds, autoPtr< scalarField > &upperBounds)
Update the bounds of the design variables.
void updateBoundaryBounds(autoPtr< scalarField > &lowerBounds, autoPtr< scalarField > &upperBounds, const NURBS3DVolume &boxI, const label passed)
Update the bounds of the boundary control points.
virtual labelList computeActiveDesignVariables(const labelList &activeCPCoors)
Compute the active design variables based on the IDs of the active control point coordinates.
virtual tmp< scalarField > correctionCPs(const scalarField &correctionDVs)
Convert the correction of the design variables to the correction of the control points.
virtual tmp< scalarField > controlPointsToDesignVariables(const scalarField &cps)
Return the design variables corresponding to the given control points.
virtual tmp< scalarField > designVariablesToControlPoints(const scalarField &designVariables)
Convert design variables to control points, stored in a scalarField.
A class for managing temporary objects.
Volumetric B-Splines design variables for shape optimisation.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define DebugInfo
Report an information message using Foam::Info.
List< label > labelList
A List of labels.
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Field< vector > vectorField
Specialisation of Field<T> for vector.
static constexpr const zero Zero
Global zero (0).
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix by subtracting the matrix multiplied by the current fi...