This documentation is still incomplete!
[1] template<class G1, class G2> inline void ConstructGrid0(G1 & destG, G2 const& srcG); [2] template<class G1, class G2, class VertexMap, class CellMap> extern void ConstructGrid0VC(G1 & destG, G2 const& srcG, VertexMap & V21, CellMap & C21); [3] template<class G1, class Geom1, class G2, class Geom2> extern void ConstructGrid(G1 & destG, Geom1 const& destGeom, G2 const& srcG, Geom2 const& srcGeom); [4] template<class G1, class Geom1, class G2, class Geom2, class VertexMap> extern void ConstructGridV(G1 & destG, Geom1 & destGeom, G2 const& srcG, Geom2 const& srcGeom, VertexMap & V21); [5] template<class G1, class Geom1, class G2, class Geom2, class VertexMap, class CellMap> extern void ConstructGridVC(G1 & destG, Geom1 & destGeom, G2 const& srcG, Geom2 const& srcGeom, VertexMap & V21, CellMap & C21);
ConstructGridXXX
family of template functions
make an associative copy
of a source grid Gsrc to a destination grid Gdest.
The ConstructGrid0XXX
functions ([1], [2])
do only a copy of combinatoric grids,
the other copy also geometry information.
The templates above are actually not really fully generic -- they must be specialized to the type of the first parameter, G1. The more general grids the G1 grid type can represent, the more useful these functions are. For very specialized grids, like Cartesian ones, they do not make much sense.
This algorithm is in some sense the analogue to the STL copy algorithm for sequences, only that it cannot be fully generic on the destination argument.
RegGrid2D R(10,10); // 10x10 Cartesian grid mapped_geometry_reg2d<Linear2D> geomR(R, Linear2D::identity); // Complex2D G; // empty grid stored_geometry_complex2d geomG(G); ConstructGrid(G,geomG, R,geomR); // copy R to G; assert(G.NumOfVertices() == R.NumOfVertices()); assert(G.NumOfCells() == R.NumOfCells()); typedef grid_types<Complex2D> gt; // 'namespace' for Complex2D-related types for(gt::CellIterator c(G), ! c.IsDone(); ++c) cout << "Cell " << c.handle() << " " << "has " << (*c).NumOfVertices() << " vertices";