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