MapGeometricFields.H
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
00034
00035 #ifndef MapGeometricFields_H
00036 #define MapGeometricFields_H
00037
00038 #include "polyMesh.H"
00039
00040
00041
00042 namespace Foam
00043 {
00044
00045 template<class Type, class MeshMapper, class GeoMesh>
00046 class MapInternalField
00047 {
00048 public:
00049
00050 MapInternalField()
00051 {}
00052
00053 void operator()
00054 (
00055 Field<Type>& field,
00056 const MeshMapper& mapper
00057 ) const;
00058 };
00059
00060
00061
00062
00063
00064 template
00065 <
00066 class Type,
00067 template<class> class PatchField,
00068 class MeshMapper,
00069 class GeoMesh
00070 >
00071 void MapGeometricFields
00072 (
00073 const MeshMapper& mapper
00074 )
00075 {
00076 HashTable<const GeometricField<Type, PatchField, GeoMesh>*> fields
00077 (
00078 mapper.thisDb().objectRegistry::lookupClass
00079 <GeometricField<Type, PatchField, GeoMesh> >()
00080 );
00081
00082
00083
00084
00085
00086
00087 for
00088 (
00089 typename HashTable<const GeometricField<Type, PatchField, GeoMesh>*>::
00090 iterator fieldIter = fields.begin();
00091 fieldIter != fields.end();
00092 ++fieldIter
00093 )
00094 {
00095 GeometricField<Type, PatchField, GeoMesh>& field =
00096 const_cast<GeometricField<Type, PatchField, GeoMesh>&>
00097 (*fieldIter());
00098
00099
00100
00101 if (&field.mesh() == &mapper.mesh())
00102 {
00103 field.storeOldTimes();
00104 }
00105 }
00106
00107 for
00108 (
00109 typename HashTable<const GeometricField<Type, PatchField, GeoMesh>*>::
00110 iterator fieldIter = fields.begin();
00111 fieldIter != fields.end();
00112 ++fieldIter
00113 )
00114 {
00115 GeometricField<Type, PatchField, GeoMesh>& field =
00116 const_cast<GeometricField<Type, PatchField, GeoMesh>&>
00117 (*fieldIter());
00118
00119 if (&field.mesh() == &mapper.mesh())
00120 {
00121 if (polyMesh::debug)
00122 {
00123 Info<< "Mapping " << field.typeName << ' ' << field.name()
00124 << endl;
00125 }
00126
00127
00128 MapInternalField<Type, MeshMapper, GeoMesh>()
00129 (
00130 field.internalField(),
00131 mapper
00132 );
00133
00134
00135 forAll(field.boundaryField(), patchi)
00136 {
00137
00138
00139
00140
00141
00142 field.boundaryField()[patchi].autoMap
00143 (
00144 mapper.boundaryMap()[patchi]
00145 );
00146 }
00147
00148 field.instance() = field.time().timeName();
00149 }
00150 else if (polyMesh::debug)
00151 {
00152 Info<< "Not mapping " << field.typeName << ' ' << field.name()
00153 << " since originating mesh differs from that of mapper."
00154 << endl;
00155 }
00156 }
00157 }
00158
00159
00160
00161
00162 }
00163
00164
00165
00166 #endif
00167
00168
Copyright © 2000-2009 OpenCFD Ltd