Loading...
Searching...
No Matches
fromFile.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 "fromFile.H"
31#include "IOdictionary.H"
34// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35
36namespace Foam
37{
38
41 (
45 );
46}
47
48
49// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
50
52{
53 Info<< "Reading control points from file " << endl;
54 const fvMesh& mesh = box_.mesh();
55 const dictionary& dict = box_.dict();
56 IOdictionary cpsDict
57 (
59 (
60 dict.dictName() + "cpsBsplines" + mesh.time().timeName(),
61 mesh.time().caseConstant(),
62 "controlPoints",
63 mesh,
67 )
68 );
69
70 cpsDict.readEntry("controlPoints", cps_);
71 const label nCPsU(box_.basisU().nCPs());
72 const label nCPsV(box_.basisV().nCPs());
73 const label nCPsW(box_.basisW().nCPs());
74 if (cps_.size() != nCPsU*nCPsV*nCPsW)
75 {
77 << "Number of control points does not agree with "
78 << "nCPsU*nCPv*nCPsW"
80 }
81}
82
83
84// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
85
86Foam::fromFile::fromFile(NURBS3DVolume& box)
87:
88 controlPointsDefinition(box)
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.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
@ NO_REGISTER
Do not request registration (bool: false).
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
NURBS3DVolume morpher. Includes support functions for gradient computations Base class providing supp...
const dictionary & dict() const
Get dictionary.
const NURBSbasis & basisV() const
const NURBSbasis & basisW() const
const fvMesh & mesh() const
Get mesh.
const NURBSbasis & basisU() const
Get basis functions.
const label & nCPs() const
Definition NURBSbasisI.H:39
void size(const label n)
Older name for setAddressableSize.
Definition UList.H:118
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:133
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, IOobjectOption::readOption readOpt=IOobjectOption::MUST_READ) const
Find entry and assign to T val. FatalIOError if it is found and the number of tokens is incorrect,...
Reads control points from constant/controlPoints.
Definition fromFile.H:51
virtual void computeControlPoints()
Compute control points.
Definition fromFile.C:44
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
dynamicFvMesh & mesh
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
Namespace for OpenFOAM.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition errorManip.H:125
dictionary dict