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 -------------------------------------------------------------------------------
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 "fromFile.H"
31 #include "IOdictionary.H"
32 
33 
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38 
39  defineTypeNameAndDebug(fromFile, 0);
41  (
42  controlPointsDefinition,
43  fromFile,
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  (
58  IOobject
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 
86 Foam::fromFile::fromFile(NURBS3DVolume& box)
87 :
88  controlPointsDefinition(box)
89 {
91 }
92 
93 
94 // ************************************************************************* //
dictionary dict
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:116
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
error FatalError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL ERROR&#39; header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:598
const fvMesh & mesh() const
Get mesh.
const NURBSbasis & basisW() const
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
const NURBSbasis & basisU() const
Get basis functions.
Ignore writing from objectRegistry::writeObject()
Macros for easy insertion into run-time selection tables.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:50
const label & nCPs() const
Definition: NURBSbasisI.H:39
dynamicFvMesh & mesh
virtual void computeControlPoints()
Compute control points.
Definition: fromFile.C:44
vectorField & cps_
The volumetric B-Splines control points.
NURBS3DVolume & box_
The volumetric B-Splines box.
defineTypeNameAndDebug(combustionModel, 0)
const NURBSbasis & basisV() const
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
messageStream Info
Information stream (stdout output on master, null elsewhere)
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:172
const dictionary & dict() const
Get dictionary.
Do not request registration (bool: false)
Namespace for OpenFOAM.
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)