axisAligned.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 "axisAligned.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
56 cps_.setSize(nCPsU*nCPsV*nCPsW);
57
58 vector lowerBounds(box_.dict().get<vector>("lowerCpBounds"));
59 vector upperBounds(box_.dict().get<vector>("upperCpBounds"));
60 scalar spanU(upperBounds.x() - lowerBounds.x());
61 scalar spanV(upperBounds.y() - lowerBounds.y());
62 scalar spanW(upperBounds.z() - lowerBounds.z());
63
64 // Equidistribute cps in th u, v, w directions
65 for (label iCPw = 0; iCPw < nCPsW; ++iCPw)
66 {
67 for (label iCPv = 0; iCPv < nCPsV; ++iCPv)
68 {
69 for (label iCPu = 0; iCPu < nCPsU; ++iCPu)
70 {
71 const label cpID(box_.getCPID(iCPu, iCPv, iCPw));
72 cps_[cpID] = vector
73 (
74 lowerBounds.x() + scalar(iCPu)/scalar(nCPsU - 1)*spanU,
75 lowerBounds.y() + scalar(iCPv)/scalar(nCPsV - 1)*spanV,
76 lowerBounds.z() + scalar(iCPw)/scalar(nCPsW - 1)*spanW
77 );
78 }
79 }
80 }
81}
82
83
84// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
85
87:
89{
91}
92
93
94// ************************************************************************* //
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
Defines control points aligned with coordinate system.
Definition: axisAligned.H:55
virtual void computeControlPoints()
Compute control points.
Definition: axisAligned.C:50
Abstract base for selecting how to construct the control points of a volumetric B-Splines morpher.
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
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
Namespace for OpenFOAM.
Vector< scalar > vector
Definition: vector.H:61