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