surfZoneIOList.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "surfZoneIOList.H"
00028
00029
00030
00031 defineTypeNameAndDebug(Foam::surfZoneIOList, 0);
00032
00033
00034
00035
00036 Foam::surfZoneIOList::surfZoneIOList
00037 (
00038 const IOobject& io
00039 )
00040 :
00041 surfZoneList(),
00042 regIOobject(io)
00043 {
00044 Foam::string functionName =
00045 "surfZoneIOList::surfZoneIOList"
00046 "(const IOobject& io)";
00047
00048
00049 if (readOpt() == IOobject::MUST_READ)
00050 {
00051 surfZoneList& zones = *this;
00052
00053 Istream& is = readStream(typeName);
00054
00055 PtrList<entry> dictEntries(is);
00056 zones.setSize(dictEntries.size());
00057
00058 label faceI = 0;
00059 forAll(zones, zoneI)
00060 {
00061 const dictionary& dict = dictEntries[zoneI].dict();
00062
00063 label zoneSize = readLabel(dict.lookup("nFaces"));
00064 label startFaceI = readLabel(dict.lookup("startFace"));
00065
00066 zones[zoneI] = surfZone
00067 (
00068 dictEntries[zoneI].keyword(),
00069 zoneSize,
00070 startFaceI,
00071 zoneI
00072 );
00073
00074 word geoType;
00075 if (dict.readIfPresent("geometricType", geoType))
00076 {
00077 zones[zoneI].geometricType() = geoType;
00078 }
00079
00080 if (startFaceI != faceI)
00081 {
00082 FatalErrorIn(functionName)
00083 << "surfZones are not ordered. Start of zone " << zoneI
00084 << " does not correspond to sum of preceding zones." << nl
00085 << "while reading " << io.objectPath() << endl
00086 << exit(FatalError);
00087 }
00088
00089 faceI += zoneSize;
00090 }
00091
00092
00093 is.check(functionName.c_str());
00094
00095 close();
00096 }
00097 }
00098
00099
00100 Foam::surfZoneIOList::surfZoneIOList
00101 (
00102 const IOobject& io,
00103 const surfZoneList& zones
00104 )
00105 :
00106 surfZoneList(zones),
00107 regIOobject(io)
00108 {}
00109
00110
00111 Foam::surfZoneIOList::surfZoneIOList
00112 (
00113 const IOobject& io,
00114 const Xfer<surfZoneList>& zones
00115 )
00116 :
00117 surfZoneList(zones),
00118 regIOobject(io)
00119 {}
00120
00121
00122
00123
00124 Foam::surfZoneIOList::~surfZoneIOList()
00125 {}
00126
00127
00128
00129
00130
00131
00132 bool Foam::surfZoneIOList::writeData(Ostream& os) const
00133 {
00134 os << *this;
00135 return os.good();
00136 }
00137
00138
00139
00140
00141 Foam::Ostream& Foam::operator<<(Ostream& os, const surfZoneIOList& L)
00142 {
00143 os << L.size() << nl << token::BEGIN_LIST << incrIndent << nl;
00144
00145 forAll(L, i)
00146 {
00147 L[i].writeDict(os);
00148 }
00149
00150 os << decrIndent << token::END_LIST;
00151
00152 return os;
00153 }
00154
00155
00156
Copyright © 2000-2009 OpenCFD Ltd