oneDimensionalDiscretisation.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2025-2026 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
34 }
35 
36 
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38 
40 (
41  const word& name,
42  const dimensionSet& dims,
44 )
45 :
46  name_(name),
47  dims_(dims),
48  coordinates_(coordinates)
49 {}
50 
51 
52 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
53 
56 (
57  const word& name,
58  const dimensionSet& dims,
59  const label n,
60  const dictionary& dict
61 )
62 {
63 
64  const word oddType(dict.lookup("type"));
65 
66  Info<< indentOrNl << "Selecting " << typeName << ' '
67  << oddType << " for " << name << endl;
68 
69  dictionaryConstructorTable::iterator cstrIter =
70  dictionaryConstructorTablePtr_->find(oddType);
71 
72  if (cstrIter == dictionaryConstructorTablePtr_->end())
73  {
75  << "Unknown " << typeName << " type "
76  << oddType << endl << endl
77  << "Valid " << typeName << " types are : " << endl
78  << dictionaryConstructorTablePtr_->sortedToc()
79  << exit(FatalIOError);
80  }
81 
82  printDictionary print(dict);
83 
84  return cstrIter()(name, dims, n, dict);
85 }
86 
87 
88 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
89 
91 {}
92 
93 
94 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
95 
98 {
99  PtrList<dimensionedScalar> result(coordinates().size());
100 
101  forAll(coordinates(), i)
102  {
103  result.set
104  (
105  i,
107  (
108  name_ + Foam::name(i),
109  dims_,
110  coordinates()[i]
111  )
112  );
113  }
114 
115  return result;
116 }
117 
118 
119 // ************************************************************************* //
label n
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:449
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
bool set(const label) const
Is element set.
Definition: PtrListI.H:62
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:669
Dimension set for the base types.
Definition: dimensionSet.H:125
Base class for ways in which to generate coordinates in one-dimensional space. Used to space the repr...
static autoPtr< oneDimensionalDiscretisation > New(const word &name, const dimensionSet &dims, const label n, const dictionary &dict)
Selector.
PtrList< dimensionedScalar > dimensionedCoordinates() const
Return the coordinates as a list of dimensioned scalars.
oneDimensionalDiscretisation(const word &name, const dimensionSet &dims, const tmp< scalarField > &coordinates)
Construct from components.
Enables the printing of a dictionary and subsequently looked-up defaulted entries.
A class for managing temporary objects.
Definition: tmp.H:55
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
A class for handling words, derived from string.
Definition: word.H:63
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:346
barycentric coordinates(const polyMesh &mesh, const point &position, const label celli, const label facei, const label faceTrii, const scalar stepFraction)
Return the coordinates given the position and tet topology.
Definition: tracking.C:1258
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:288
messageStream Info
defineRunTimeSelectionTable(fvConstraint, dictionary)
IOerror FatalIOError
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
Ostream & indentOrNl(Ostream &os)
Indent stream or add newline if indent level == 0.
Definition: Ostream.H:250
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)
dictionary dict