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 template
00062 <
00063 class Type,
00064 template<class> class PatchField,
00065 class MeshMapper,
00066 class GeoMesh
00067 >
00068 void MapGeometricFields
00069 (
00070 const MeshMapper& mapper
00071 )
00072 {
00073 HashTable<const GeometricField<Type, PatchField, GeoMesh>*> fields
00074 (
00075 mapper.mesh().objectRegistry::lookupClass
00076 <GeometricField<Type, PatchField, GeoMesh> >()
00077 );
00078
00079
00080
00081
00082
00083
00084 for
00085 (
00086 typename HashTable<const GeometricField<Type, PatchField, GeoMesh>*>::
00087 iterator fieldIter = fields.begin();
00088 fieldIter != fields.end();
00089 ++fieldIter
00090 )
00091 {
00092 const_cast<GeometricField<Type, PatchField, GeoMesh>*>(fieldIter())
00093 ->storeOldTimes();
00094 }
00095
00096 for
00097 (
00098 typename HashTable<const GeometricField<Type, PatchField, GeoMesh>*>::
00099 iterator fieldIter = fields.begin();
00100 fieldIter != fields.end();
00101 ++fieldIter
00102 )
00103 {
00104 GeometricField<Type, PatchField, GeoMesh>& field =
00105 const_cast<GeometricField<Type, PatchField, GeoMesh>&>
00106 (*fieldIter());
00107
00108 if (polyMesh::debug)
00109 {
00110 Info<< "Mapping field " << field.name() << endl;
00111 }
00112
00113
00114 MapInternalField<Type, MeshMapper, GeoMesh>()
00115 (
00116 field.internalField(),
00117 mapper
00118 );
00119
00120
00121 forAll(field.boundaryField(), patchi)
00122 {
00123
00124
00125
00126
00127
00128 field.boundaryField()[patchi].autoMap
00129 (
00130 mapper.boundaryMap()[patchi]
00131 );
00132 }
00133 }
00134 }
00135
00136
00137
00138
00139 }
00140
00141
00142
00143 #endif
00144
00145