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,
44  dictionary
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,
66  false
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"
79  << exit(FatalError);
80  }
81 }
82 
83 
84 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
85 
86 Foam::fromFile::fromFile(NURBS3DVolume& box)
87 :
89 {
91 }
92 
93 
94 // ************************************************************************* //
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Foam::IOobject::NO_WRITE
Definition: IOobject.H:195
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
Foam::NURBS3DVolume::dict
const dictionary & dict() const
Get dictionary.
Definition: NURBS3DVolumeI.H:106
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
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::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
fromFile.H
Foam::fromFile::computeControlPoints
virtual void computeControlPoints()
Compute control points.
Definition: fromFile.C:51
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
Foam::dictionary::readEntry
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
Definition: dictionaryTemplates.C:302
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::NURBSbasis::nCPs
const label & nCPs() const
Definition: NURBSbasisI.H:46
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
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
IOdictionary.H
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::controlPointsDefinition
Abstract base for selecting how to construct the control points of a volumetric B-Splines morpher.
Definition: controlPointsDefinition.H:52
Foam::NURBS3DVolume::mesh
const fvMesh & mesh() const
Get mesh.
Definition: NURBS3DVolumeI.H:100
Foam::NURBS3DVolume::basisU
const NURBSbasis & basisU() const
Get basis functions.
Definition: NURBS3DVolumeI.H:82
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::IOobject::MUST_READ
Definition: IOobject.H:185