transformBox.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2020 PCOpt/NTUA
9 Copyright (C) 2020 FOSS GP
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
30#include "transformBox.H"
31
32
33// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34
35namespace Foam
36{
37
40 (
44 );
45}
46
47
48// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
49
51{
52 const label nCPsU(box_.basisU().nCPs());
53 const label nCPsV(box_.basisV().nCPs());
54 const label nCPsW(box_.basisW().nCPs());
55 cps_.setSize(nCPsU*nCPsV*nCPsW, vector::zero);
56
57 // Geometry bounds (the one on which clip was applied)
58 const dictionary& dict = box_.dict();
59 vector lowerCpBounds(dict.get<vector>("lowerCpBounds"));
60 vector upperCpBounds(dict.get<vector>("upperCpBounds"));
61 scalar spanU(upperCpBounds.x() - lowerCpBounds.x());
62 scalar spanV(upperCpBounds.y() - lowerCpBounds.y());
63 scalar spanW(upperCpBounds.z() - lowerCpBounds.z());
64
65 // First, create morphing box based on lowerCpBounds, Max
66 for (label iCPw = 0; iCPw < nCPsW; ++iCPw)
67 {
68 for (label iCPv = 0; iCPv < nCPsV; ++iCPv)
69 {
70 for (label iCPu = 0; iCPu < nCPsU; ++iCPu)
71 {
72 const label cpID(box_.getCPID(iCPu, iCPv, iCPw));
73 cps_[cpID] = vector
74 (
75 lowerCpBounds.x() + scalar(iCPu)/scalar(nCPsU - 1)*spanU,
76 lowerCpBounds.y() + scalar(iCPv)/scalar(nCPsV - 1)*spanV,
77 lowerCpBounds.z() + scalar(iCPw)/scalar(nCPsW - 1)*spanW
78 );
79 }
80 }
81 }
82
83 // Transform control points
84 transformControlPoints(lowerCpBounds, upperCpBounds);
85}
86
87
88// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
89
91:
93{
95}
96
97
98// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
void setSize(const label n)
Alias for resize()
Definition: List.H:218
NURBS3DVolume morpher. Includes support functions for gradient computations Base class providing supp...
Definition: NURBS3DVolume.H:76
const dictionary & dict() const
Get dictionary.
const NURBSbasis & basisV() const
label getCPID(const label i, const label j, const label k) const
Get control point ID from its I-J-K coordinates.
const NURBSbasis & basisW() const
const NURBSbasis & basisU() const
Get basis functions.
const label & nCPs() const
Definition: NURBSbasisI.H:46
const Cmpt & z() const
Access to the vector z component.
Definition: VectorI.H:85
const Cmpt & y() const
Access to the vector y component.
Definition: VectorI.H:79
const Cmpt & x() const
Access to the vector x component.
Definition: VectorI.H:73
Abstract base for selecting how to construct the control points of a volumetric B-Splines morpher.
void transformControlPoints(const vector &geometryMin, const vector &geometryMax)
vectorField & cps_
The volumetric B-Splines control points.
NURBS3DVolume & box_
The volumetric B-Splines box.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Defines control points based on given lower and upper boundaries for the box and additional translati...
Definition: transformBox.H:58
virtual void computeControlPoints()
Compute control points.
Definition: transformBox.C:50
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
Namespace for OpenFOAM.
Vector< scalar > vector
Definition: vector.H:61
dictionary dict
A non-counting (dummy) refCount.
Definition: refCount.H:59