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 -------------------------------------------------------------------------------
11 License
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 
35 namespace Foam
36 {
37 
38  defineTypeNameAndDebug(axisAligned, 0);
40  (
41  controlPointsDefinition,
42  axisAligned,
43  dictionary
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 
86 Foam::axisAligned::axisAligned(NURBS3DVolume& box)
87 :
89 {
91 }
92 
93 
94 // ************************************************************************* //
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Foam::NURBS3DVolume::dict
const dictionary & dict() const
Get dictionary.
Definition: NURBS3DVolumeI.H:106
Foam::Vector::x
const Cmpt & x() const
Access to the vector x component.
Definition: VectorI.H:73
Foam::NURBS3DVolume::basisV
const NURBSbasis & basisV() const
Definition: NURBS3DVolumeI.H:88
Foam::NURBS3DVolume
NURBS3DVolume morpher. Includes support functions for gradient computations Base class providing supp...
Definition: NURBS3DVolume.H:72
Foam::controlPointsDefinition::cps_
vectorField & cps_
The volumetric B-Splines control points.
Definition: controlPointsDefinition.H:62
Foam::dictionary::get
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:107
Foam::Vector::z
const Cmpt & z() const
Access to the vector z component.
Definition: VectorI.H:85
Foam::NURBS3DVolume::getCPID
label getCPID(const label i, const label j, const label k) const
Get control point ID from its I-J-K coordinates.
Definition: NURBS3DVolume.C:1468
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::NURBSbasis::nCPs
const label & nCPs() const
Definition: NURBSbasisI.H:46
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:51
Foam::controlPointsDefinition::box_
NURBS3DVolume & box_
The volumetric B-Splines box.
Definition: controlPointsDefinition.H:59
Foam::NURBS3DVolume::basisW
const NURBSbasis & basisW() const
Definition: NURBS3DVolumeI.H:94
Foam::Vector::y
const Cmpt & y() const
Access to the vector y component.
Definition: VectorI.H:79
Foam::axisAligned::computeControlPoints
virtual void computeControlPoints()
Compute control points.
Definition: axisAligned.C:50
Foam::controlPointsDefinition
Abstract base for selecting how to construct the control points of a volumetric B-Splines morpher.
Definition: controlPointsDefinition.H:52
Foam::Vector< scalar >
axisAligned.H
Foam::NURBS3DVolume::basisU
const NURBSbasis & basisU() const
Get basis functions.
Definition: NURBS3DVolumeI.H:82
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)