Loading...
Searching...
No Matches
profileModelList.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) 2011-2015 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26\*---------------------------------------------------------------------------*/
27
28#include "profileModelList.H"
29
30// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31
33(
34 const dictionary& dict,
35 const bool readFields
36)
37:
39 dict_(dict)
40{
41 if (readFields)
42 {
43 wordList modelNames(dict.toc());
44
45 Info<< " Constructing blade profiles:" << endl;
46
47 if (modelNames.size())
48 {
49 this->setSize(modelNames.size());
50
51 forAll(modelNames, i)
52 {
53 const word& modelName = modelNames[i];
54
55 this->set
56 (
57 i,
58 profileModel::New(dict.subDict(modelName))
59 );
60 }
61 }
62 else
63 {
64 Info<< " none" << endl;
65 }
66 }
67}
68
69
70// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
71
73(
74 const List<word>& names,
75 List<label>& addr
76) const
77{
78 // construct the addressing between blade sections and profiles
79 forAll(names, bI)
80 {
81 label index = -1;
82 const word& profileName = names[bI];
83
84 forAll(*this, pI)
85 {
86 const profileModel& pm = this->operator[](pI);
87
88 if (pm.name() == profileName)
89 {
90 index = pI;
91 break;
92 }
93 }
94
95 if (index == -1)
96 {
97 List<word> profileNames(size());
98 forAll(*this, i)
99 {
100 const profileModel& pm = this->operator[](i);
101 profileNames[i] = pm.name();
102 }
103
105 << "Profile " << profileName << " could not be found "
106 << "in profile list. Available profiles are"
107 << profileNames << exit(FatalError);
108 }
109 else
110 {
111 addr[bI] = index;
112 }
113 }
114}
115
116
117// ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
const profileModel * set(const label i) const
Definition PtrList.H:171
void setSize(const label n)
Definition PtrList.H:357
constexpr PtrList() noexcept
Definition PtrListI.H:29
void size(const label n)
Older name for setAddressableSize.
Definition UList.H:118
const profileModel & operator[](const label i) const
Definition UPtrListI.H:289
label size() const noexcept
Definition UPtrListI.H:106
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
profileModelList(const dictionary &dict, const bool readFields=true)
Constructor.
const dictionary dict_
Dictionary.
void connectBlades(const List< word > &names, List< label > &addr) const
Set blade->profile addressing.
Base class for profile models for handling aerofoil lift and drag polar diagrams.
const word & name() const
Return const access to the source name.
static autoPtr< profileModel > New(const dictionary &dict)
Return a reference to the selected fvOption model.
A class for handling words, derived from Foam::string.
Definition word.H:66
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
auto & names
List< word > wordList
List of word.
Definition fileName.H:60
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const NameMatchPredicate &selectedFields, DynamicList< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type and store on the objectRegistry.
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
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299