00001 #ifndef GRAL_GB_GRIDS_TRIANG2D_CONSTRUCT_C
00002 #define GRAL_GB_GRIDS_TRIANG2D_CONSTRUCT_C
00003
00004
00005
00006
00007 #include "Gral/Grids/Triang2D/copy.h"
00008
00009 #include "Container/partial-mapping.h"
00010 #include "Container/dummy-mapping.h"
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 template<class Geom, class G2, class Geom2>
00035 void ConstructGrid(Triang2D & G,
00036 Geom & destGeom,
00037 G2 const& srcG,
00038 Geom2 const& srcGeom )
00039 {
00040 typedef grid_types<G2> source_gt;
00041 typedef typename source_gt::vertex_handle src_vertex_handle;
00042 typedef typename grid_types<Triang2D>::vertex_handle vertex_handle;
00043
00044
00045
00046 partial_mapping<src_vertex_handle,vertex_handle> VertexCorr;
00047 ConstructGridV(G,destGeom,srcG,srcGeom,VertexCorr);
00048 }
00049
00050 template<class G2>
00051 void ConstructGrid0(Triang2D & G,
00052 G2 const& srcG)
00053 {
00054 typedef grid_types<G2> source_gt;
00055 typedef typename source_gt::vertex_handle src_vertex_handle;
00056 typedef typename source_gt::cell_handle src_cell_handle;
00057 typedef typename grid_types<Triang2D>::vertex_handle vertex_handle;
00058 typedef typename grid_types<Triang2D>::cell_handle cell_handle;
00059
00060
00061
00062 partial_mapping<src_vertex_handle,vertex_handle> VertexCorr;
00063
00064 dummy_mapping<src_cell_handle,cell_handle> CellCorr;
00065 ConstructGrid0(G,srcG,VertexCorr,CellCorr);
00066 }
00067
00068
00069 template<class Geom, class G2, class Geom2, class VertexMap>
00070 void ConstructGridV(Triang2D & G,
00071 Geom & destGeom,
00072 G2 const& srcG,
00073 Geom2 const& srcGeom,
00074
00075 VertexMap & VertexCorr)
00076 {
00077
00078 typedef grid_types<G2> source_gt;
00079 typedef typename source_gt::cell_handle src_cell_handle;
00080 typedef typename grid_types<Triang2D>::cell_handle cell_handle;
00081
00082
00083 dummy_mapping<src_cell_handle,cell_handle> CellCorr;
00084
00085 ConstructGridVC(G,destGeom, srcG,srcGeom,VertexCorr,CellCorr);
00086 }
00087
00088
00089 template<class Geom, class G2, class Geom2, class VertexMap, class CellMap>
00090 void ConstructGridVC(Triang2D & G,
00091 Geom & destGeom,
00092 G2 const& srcG,
00093 Geom2 const& srcGeom,
00094 VertexMap & VertexCorr,
00095 CellMap & CellCorr)
00096 {
00097
00098 ConstructGrid0(G,srcG,VertexCorr,CellCorr);
00099
00100
00101
00102 destGeom.set_grid(G);
00103 typedef typename grid_types<G2>::VertexIterator src_vertex_it;
00104 typedef typename grid_types<Triang2D>::Vertex Vertex;
00105 for(src_vertex_it src_v = srcG.FirstVertex(); ! src_v.IsDone(); ++src_v) {
00106 Vertex V(G,VertexCorr(src_v.handle()));
00107 assign_point(destGeom.coord(V) , srcGeom.coord(*src_v));
00108 }
00109 }
00110
00111 template<class G2, class VertexMap, class CellMap>
00112 void ConstructGrid0(Triang2D & G,
00113 G2 const& srcG,
00114 VertexMap & VertexCorr,
00115 CellMap & CellCorr)
00116
00117 {
00118 typedef grid_types<G2> source_gt;
00119
00120
00121 typedef typename source_gt::cell_handle src_cell_handle;
00122 typedef typename source_gt::CellIterator src_cell_it;
00123 typedef typename source_gt::VertexIterator src_vertex_it;
00124 typedef typename source_gt::VertexOnCellIterator src_vertex_on_cell_it;
00125
00126 typedef grid_types<Triang2D> gt;
00127 typedef typename gt::Cell Cell;
00128 typedef typename gt::cell_handle cell_handle;
00129 typedef typename gt::vertex_handle vertex_handle;
00130
00131
00132
00133 int v = 0;
00134 for(src_vertex_it src_v = srcG.FirstVertex(); ! src_v.IsDone(); ++src_v, ++v) {
00135 VertexCorr[src_v.handle()] = v;
00136 }
00137
00138
00139
00140
00141 copy_cells(G,srcG,VertexCorr,CellCorr);
00142
00143
00144 }
00145
00146 #endif
00147