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/>.
25
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,
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 list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: PtrList.H:73
const profileModel * set(const label i) const
Definition: PtrList.H:138
void setSize(const label newLen)
Same as resize()
Definition: PtrList.H:151
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
Definition: dictionary.C:460
wordList toc() const
Return the table of contents.
Definition: dictionary.C:602
Base class for profile models.
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.
Definition: profileModel.H:121
const word & name() const
Return const access to the source name.
Definition: profileModel.C:61
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
messageStream Info
Information stream (stdout output on master, null elsewhere)
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const wordHashSet &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
error FatalError
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
dictionary dict
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333