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 #include <finiteVolume/fvMesh.H>
00027 #include "fvMeshAdder.H"
00028 #include <dynamicMesh/faceCoupleInfo.H>
00029 #include <finiteVolume/fvMesh.H>
00030
00031
00032
00033
00034
00035 Foam::labelList Foam::fvMeshAdder::calcPatchMap
00036 (
00037 const label oldStart,
00038 const label oldSize,
00039 const labelList& oldToNew,
00040 const polyPatch& newPatch,
00041 const label unmappedValue
00042 )
00043 {
00044 labelList newToOld(newPatch.size(), unmappedValue);
00045
00046 label newStart = newPatch.start();
00047 label newSize = newPatch.size();
00048
00049 for (label i = 0; i < oldSize; i++)
00050 {
00051 label newFaceI = oldToNew[oldStart+i];
00052
00053 if (newFaceI >= newStart && newFaceI < newStart+newSize)
00054 {
00055 newToOld[newFaceI-newStart] = i;
00056 }
00057 }
00058 return newToOld;
00059 }
00060
00061
00062
00063
00064
00065 Foam::autoPtr<Foam::mapAddedPolyMesh> Foam::fvMeshAdder::add
00066 (
00067 fvMesh& mesh0,
00068 const fvMesh& mesh1,
00069 const faceCoupleInfo& coupleInfo,
00070 const bool validBoundary
00071 )
00072 {
00073 mesh0.clearOut();
00074
00075
00076 autoPtr<mapAddedPolyMesh> mapPtr
00077 (
00078 polyMeshAdder::add
00079 (
00080 mesh0,
00081 mesh1,
00082 coupleInfo,
00083 validBoundary
00084 )
00085 );
00086
00087
00088 const polyBoundaryMesh& patches = mesh0.boundaryMesh();
00089
00090 fvBoundaryMesh& fvPatches = const_cast<fvBoundaryMesh&>(mesh0.boundary());
00091 fvPatches.setSize(patches.size());
00092 forAll(patches, patchI)
00093 {
00094 fvPatches.set(patchI, fvPatch::New(patches[patchI], fvPatches));
00095 }
00096
00097
00098
00099 fvMeshAdder::MapVolFields<scalar>(mapPtr, mesh0, mesh1);
00100 fvMeshAdder::MapVolFields<vector>(mapPtr, mesh0, mesh1);
00101 fvMeshAdder::MapVolFields<sphericalTensor>(mapPtr, mesh0, mesh1);
00102 fvMeshAdder::MapVolFields<symmTensor>(mapPtr, mesh0, mesh1);
00103 fvMeshAdder::MapVolFields<tensor>(mapPtr, mesh0, mesh1);
00104
00105 fvMeshAdder::MapSurfaceFields<scalar>(mapPtr, mesh0, mesh1);
00106 fvMeshAdder::MapSurfaceFields<vector>(mapPtr, mesh0, mesh1);
00107 fvMeshAdder::MapSurfaceFields<sphericalTensor>(mapPtr, mesh0, mesh1);
00108 fvMeshAdder::MapSurfaceFields<symmTensor>(mapPtr, mesh0, mesh1);
00109 fvMeshAdder::MapSurfaceFields<tensor>(mapPtr, mesh0, mesh1);
00110
00111 return mapPtr;
00112 }
00113
00114
00115