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
00028
00029
00030
00031
00032 #include "blockMesh.H"
00033
00034
00035
00036
00037
00038 Foam::blockMesh::blockMesh(IOdictionary& meshDescription)
00039 :
00040 topologyPtr_(createTopology(meshDescription)),
00041 blockOffsets_(createBlockOffsets()),
00042 mergeList_(createMergeList()),
00043 points_(createPoints(meshDescription)),
00044 cells_(createCells()),
00045 patches_(createPatches())
00046 {}
00047
00048
00049
00050
00051 Foam::blockMesh::~blockMesh()
00052 {
00053 delete topologyPtr_;
00054 }
00055
00056
00057
00058
00059 const Foam::polyMesh& Foam::blockMesh::topology() const
00060 {
00061 if (!topologyPtr_)
00062 {
00063 FatalErrorIn("blockMesh::topology() const")
00064 << "topologyPtr_ not allocated"
00065 << exit(FatalError);
00066 }
00067
00068 return *topologyPtr_;
00069 }
00070
00071
00072 Foam::wordList Foam::blockMesh::patchNames() const
00073 {
00074 const polyPatchList& patchTopologies = topology().boundaryMesh();
00075 wordList names(patchTopologies.size());
00076
00077 forAll (names, patchI)
00078 {
00079 names[patchI] = patchTopologies[patchI].name();
00080 }
00081
00082 return names;
00083 }
00084
00085
00086 Foam::wordList Foam::blockMesh::patchTypes() const
00087 {
00088 const polyPatchList& patchTopologies = topology().boundaryMesh();
00089 wordList types(patchTopologies.size());
00090
00091 forAll (types, patchI)
00092 {
00093 types[patchI] = patchTopologies[patchI].type();
00094 }
00095
00096 return types;
00097 }
00098
00099
00100 Foam::wordList Foam::blockMesh::patchPhysicalTypes() const
00101 {
00102 const polyPatchList& patchTopologies = topology().boundaryMesh();
00103 wordList physicalTypes(patchTopologies.size());
00104
00105 forAll (physicalTypes, patchI)
00106 {
00107 physicalTypes[patchI] = patchTopologies[patchI].physicalType();
00108 }
00109
00110 return physicalTypes;
00111 }
00112
00113
00114 Foam::label Foam::blockMesh::numZonedBlocks() const
00115 {
00116 label num = 0;
00117
00118 forAll(*this, blockI)
00119 {
00120 if (operator[](blockI).blockDef().zoneName().size())
00121 {
00122 num++;
00123 }
00124 }
00125
00126 return num;
00127 }
00128
00129
00130 void Foam::blockMesh::writeTopology(Ostream& os) const
00131 {
00132 const pointField& pts = topology().points();
00133
00134 forAll(pts, pI)
00135 {
00136 const point& pt = pts[pI];
00137
00138 os << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z() << endl;
00139 }
00140
00141 const edgeList& edges = topology().edges();
00142
00143 forAll(edges, eI)
00144 {
00145 const edge& e = edges[eI];
00146
00147 os << "l " << e.start() + 1 << ' ' << e.end() + 1 << endl;
00148 }
00149 }
00150
00151