00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. 00006 \\/ M anipulation | 00007 ------------------------------------------------------------------------------- 00008 License 00009 This file is part of OpenFOAM. 00010 00011 OpenFOAM is free software: you can redistribute it and/or modify it 00012 under the terms of the GNU General Public License as published by 00013 the Free Software Foundation, either version 3 of the License, or 00014 (at your option) any later version. 00015 00016 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00018 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00019 for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. 00023 00024 Class 00025 Foam::vtkMesh 00026 00027 Description 00028 Encapsulation of VTK mesh data. Holds mesh or meshsubset and 00029 polyhedral-cell decomposition on it. 00030 00031 SourceFiles 00032 vtkMesh.C 00033 00034 \*---------------------------------------------------------------------------*/ 00035 00036 #ifndef vtkMesh_H 00037 #define vtkMesh_H 00038 00039 #include "vtkTopo.H" 00040 #include <finiteVolume/fvMeshSubset.H> 00041 00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00043 00044 namespace Foam 00045 { 00046 00047 // Forward declaration of classes 00048 class Time; 00049 00050 /*---------------------------------------------------------------------------*\ 00051 Class vtkMesh Declaration 00052 \*---------------------------------------------------------------------------*/ 00053 00054 class vtkMesh 00055 { 00056 // Private data 00057 00058 //- Reference to mesh 00059 fvMesh& baseMesh_; 00060 00061 //- Subsetting engine + sub-fvMesh 00062 fvMeshSubset subsetter_; 00063 00064 //- Current cellSet (or empty) 00065 const word setName_; 00066 00067 //- Current decomposition of topology 00068 mutable autoPtr<vtkTopo> topoPtr_; 00069 00070 00071 00072 // Private Member Functions 00073 00074 //- Disallow default bitwise copy construct 00075 vtkMesh(const vtkMesh&); 00076 00077 //- Disallow default bitwise assignment 00078 void operator=(const vtkMesh&); 00079 00080 00081 public: 00082 00083 // Constructors 00084 00085 //- Construct from components 00086 vtkMesh(fvMesh& baseMesh, const word& setName = ""); 00087 00088 00089 // Member Functions 00090 00091 // Access 00092 00093 //- whole mesh 00094 const fvMesh& baseMesh() const 00095 { 00096 return baseMesh_; 00097 } 00098 00099 const fvMeshSubset& subsetter() const 00100 { 00101 return subsetter_; 00102 } 00103 00104 //- Check if running subMesh 00105 bool useSubMesh() const 00106 { 00107 return setName_.size(); 00108 } 00109 00110 //- topology 00111 const vtkTopo& topo() const 00112 { 00113 if (topoPtr_.empty()) 00114 { 00115 topoPtr_.reset(new vtkTopo(mesh())); 00116 } 00117 return topoPtr_(); 00118 } 00119 00120 //- Access either mesh or submesh 00121 const fvMesh& mesh() const 00122 { 00123 if (useSubMesh()) 00124 { 00125 return subsetter_.subMesh(); 00126 } 00127 else 00128 { 00129 return baseMesh_; 00130 } 00131 } 00132 00133 //- Number of field cells 00134 label nFieldCells() const 00135 { 00136 return topo().cellTypes().size(); 00137 } 00138 00139 //- Number of field points 00140 label nFieldPoints() const 00141 { 00142 return mesh().nPoints() + topo().addPointCellLabels().size(); 00143 } 00144 00145 00146 // Edit 00147 00148 //- Read mesh 00149 polyMesh::readUpdateState readUpdate(); 00150 00151 00152 //- Map volume field (does in fact do very little interpolation; 00153 // just copied from fvMeshSubset) 00154 template<class GeoField> 00155 tmp<GeoField> interpolate(const GeoField& fld) const 00156 { 00157 if (useSubMesh()) 00158 { 00159 tmp<GeoField> subFld = subsetter_.interpolate(fld); 00160 subFld().rename(fld.name()); 00161 return subFld; 00162 } 00163 else 00164 { 00165 return fld; 00166 } 00167 } 00168 }; 00169 00170 00171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00172 00173 } // End namespace Foam 00174 00175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00176 00177 #endif 00178 00179 // ************************ vim: set sw=4 sts=4 et: ************************ //