Go to Overview over all GrAL packages.
Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

test/construct/test-triang2d-construct.C

Go to the documentation of this file.
00001 
00009 #include <fstream>
00010 #include <string>
00011 
00012 #include "IO/control-device.h"
00013 
00014 #include "Container/tuple.h"
00015 
00016 #include "Gral/Grids/Triang2D/all.h"
00017 #include "Gral/Grids/Triang2D/test-triang2d.h"
00018 
00019 #include "Gral/IO/complex2d-format-input.h"
00020 #include "Gral/IO/complex2d-format-output.h"
00021 #include "Gral/Algorithms/cell-neighbor-search.h"
00022 
00023 #include "Container/bijective-mapping.h"
00024 #include "Container/dummy-mapping.h"
00025 
00026 
00027 template<class T>
00028 class CellFacetMapTriang2D {
00029 private:
00030   typedef grid_types<Triang2D> gt; 
00031 
00032   //---------- DATA ---------
00033   grid_function<gt::Cell, tuple<T,3> > table;
00034 public:
00035   typedef T                       value_type;
00036   typedef T                       result_type;
00037   typedef gt::FacetOnCellIterator argument_type;
00038 
00039   CellFacetMapTriang2D(Triang2D const& tri) : table(tri) {}
00040 
00041   T&       operator[](gt::FacetOnCellIterator const& fc) 
00042   { return table[fc.TheCell()][gt::local(fc)];}
00043   T const& operator()(gt::FacetOnCellIterator const& fc) const 
00044   { return table(fc.TheCell())[gt::local(fc)];}
00045 };
00046 
00047 int main(int argc, char* argv[]) {
00048   using std::ostream;
00049 
00050   typedef grid_types<Triang2D> gt; 
00051 
00052   ControlDevice Ctrl = GetCommandlineAndFileControlDevice(argc,argv,"test.in","main");
00053 
00054   std::string gridfile_nm;
00055   RegisterAt(Ctrl, "-f", gridfile_nm);
00056 
00057   TestTriang2D Test;
00058   Test.register_at(Ctrl);
00059 
00060   Ctrl.update();
00061 
00062   ostream& testout(cout);  
00063 
00064   IstreamComplex2DFmt Gsrc(gridfile_nm);
00065   Triang2D T;
00066   stored_geometry_triang2d GeomT(T);
00067 
00068   bijective_mapping<int,int> vcorr;
00069   dummy_mapping<int,int>     ccorr;
00070   ConstructGridVC(T,GeomT, Gsrc, Gsrc, vcorr,ccorr);
00071 
00072   OstreamComplex2DFmt Gout(gridfile_nm +".out");
00073   ConstructGrid(Gout, T, GeomT);
00074   
00075   testout << "Testing T\n";
00076   Test.test_iterators(T,testout);
00077   testout << "---------------------------------------------------\n"
00078           << "---------------------------------------------------\n\n";
00079 
00080   CellFacetMapTriang2D<gt::cell_handle> nbf(T);
00081   CalculateNeighborCells(nbf,T);
00082  
00083   testout << "\n\n";
00084   testout << "Cell Neighbors\n";
00085   for(gt::CellIterator c(T); ! c.IsDone(); ++c) {
00086     for(gt::FacetOnCellIterator fc(c); ! fc.IsDone(); ++fc)
00087       testout << nbf[fc] << ' ';
00088     testout << '\n';
00089   }
00090   return 0;
00091 }
00092 

Copyright (c) Guntram Berti 1997-2002. See the GrAL Homepage for up-to-date information.

Generated at Tue Feb 26 16:09:13 2002 for GrAL Triang2D by doxygen 1.2.11-20011104 written by Dimitri van Heesch, © 1997-2000