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 #include <triSurface/surfacePatchIOList.H>
00027
00028
00029
00030 defineTypeNameAndDebug(Foam::surfacePatchIOList, 0);
00031
00032
00033
00034
00035
00036 Foam::surfacePatchIOList::surfacePatchIOList
00037 (
00038 const IOobject& io
00039 )
00040 :
00041 surfacePatchList(),
00042 regIOobject(io)
00043 {
00044 Foam::string functionName =
00045 "surfacePatchIOList::surfacePatchIOList"
00046 "(const IOobject& io)";
00047
00048
00049 if (readOpt() == IOobject::MUST_READ)
00050 {
00051 surfacePatchList& patches = *this;
00052
00053
00054 Istream& is = readStream(typeName);
00055
00056 PtrList<entry> patchEntries(is);
00057 patches.setSize(patchEntries.size());
00058
00059 label faceI = 0;
00060
00061 forAll(patches, patchI)
00062 {
00063 const dictionary& dict = patchEntries[patchI].dict();
00064
00065 label patchSize = readLabel(dict.lookup("nFaces"));
00066 label startFaceI = readLabel(dict.lookup("startFace"));
00067
00068 patches[patchI] =
00069 surfacePatch
00070 (
00071 word(dict.lookup("geometricType")),
00072 patchEntries[patchI].keyword(),
00073 patchSize,
00074 startFaceI,
00075 patchI
00076 );
00077
00078
00079 if (startFaceI != faceI)
00080 {
00081 FatalErrorIn(functionName)
00082 << "Patches are not ordered. Start of patch " << patchI
00083 << " does not correspond to sum of preceding patches."
00084 << endl
00085 << "while reading " << io.objectPath()
00086 << exit(FatalError);
00087 }
00088
00089 faceI += patchSize;
00090 }
00091
00092
00093 is.check(functionName.c_str());
00094
00095 close();
00096 }
00097 }
00098
00099
00100 Foam::surfacePatchIOList::surfacePatchIOList
00101 (
00102 const IOobject& io,
00103 const surfacePatchList& patches
00104 )
00105 :
00106 surfacePatchList(patches),
00107 regIOobject(io)
00108 {}
00109
00110
00111
00112
00113 Foam::surfacePatchIOList::~surfacePatchIOList()
00114 {}
00115
00116
00117
00118
00119
00120
00121 bool Foam::surfacePatchIOList::writeData(Ostream& os) const
00122 {
00123 os << *this;
00124 return os.good();
00125 }
00126
00127
00128
00129
00130 Foam::Ostream& Foam::operator<<(Ostream& os, const surfacePatchIOList& patches)
00131 {
00132 os << patches.size() << nl << token::BEGIN_LIST;
00133
00134 forAll(patches, patchI)
00135 {
00136 patches[patchI].writeDict(os);
00137 }
00138
00139 os << token::END_LIST;
00140
00141 return os;
00142 }
00143
00144
00145
00146
00147
00148
00149
00150