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 #ifndef MapFvSurfaceField_H
00035 #define MapFvSurfaceField_H
00036
00037 #include "Field.H"
00038 #include "surfaceMesh.H"
00039
00040
00041
00042 namespace Foam
00043 {
00044
00045 template<class Type, class MeshMapper>
00046 class MapInternalField<Type, MeshMapper, surfaceMesh>
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<class Type, class MeshMapper>
00062 void MapInternalField<Type, MeshMapper, surfaceMesh>::operator()
00063 (
00064 Field<Type>& field,
00065 const MeshMapper& mapper
00066 ) const
00067 {
00068 if (field.size() != mapper.surfaceMap().sizeBeforeMapping())
00069 {
00070 FatalErrorIn
00071 (
00072 "void MapInternalField<Type, MeshMapper, surfaceMesh>::operator()\n"
00073 "(\n"
00074 " Field<Type>& field,\n"
00075 " const MeshMapper& mapper\n"
00076 ") const"
00077 ) << "Incompatible size before mapping. Field size: " << field.size()
00078 << " map size: " << mapper.surfaceMap().sizeBeforeMapping()
00079 << abort(FatalError);
00080 }
00081
00082 field.autoMap(mapper.surfaceMap());
00083
00084
00085 const labelList flipFaces = mapper.surfaceMap().flipFaceFlux().toc();
00086
00087 forAll (flipFaces, i)
00088 {
00089 if (flipFaces[i] < field.size())
00090 {
00091 field[flipFaces[i]] *= -1.0;
00092 }
00093 }
00094 }
00095
00096
00097
00098
00099 }
00100
00101
00102
00103 #endif
00104
00105