Commit 859e3b0c by incardon

### Simplified linear algebra interface

parent f576bd87
 ... @@ -616,6 +616,32 @@ private: ... @@ -616,6 +616,32 @@ private: g_map.template ghost_get<0>(); g_map.template ghost_get<0>(); } } /*! \initialize the object FDScheme * * \param domain simulation domain * */ void Initialize(const Box & domain) { construct_gmap(); // Create a CellDecomposer and calculate the spacing size_t sz_g[Sys_eqs::dims]; for (size_t i = 0 ; i < Sys_eqs::dims ; i++) { if (Sys_eqs::boundary[i] == NON_PERIODIC) sz_g[i] = gs.getSize()[i] - 1; else sz_g[i] = gs.getSize()[i]; } CellDecomposer_sm cd(domain,sz_g,0); for (size_t i = 0 ; i < Sys_eqs::dims ; i++) spacing[i] = cd.getCellBox().getHigh(i); } public: public: /*! \brief set the staggered position for each property /*! \brief set the staggered position for each property ... @@ -676,34 +702,34 @@ public: ... @@ -676,34 +702,34 @@ public: * \param pd Padding, how many points out of boundary are present * \param pd Padding, how many points out of boundary are present * \param stencil maximum extension of the stencil on each directions * \param stencil maximum extension of the stencil on each directions * \param domain the domain * \param domain the domain * \param gs grid infos where Finite differences work * \param b_g object grid that will store the solution * \param b_g Finite difference grid (it is not important what it contain only its decomposition is used) * */ FDScheme(const Ghost & stencil, const Box & domain, const typename Sys_eqs::b_grid & b_g) :pd({0,0,0},{0,0,0}),gs(b_g.getGridInfoVoid()),g_map(b_g,stencil,pd),row(0),row_b(0) { Initialize(domain); } /*! \brief Constructor * * The periodicity is given by the grid b_g * * \param pd Padding, how many points out of boundary are present * \param stencil maximum extension of the stencil on each directions * \param domain the domain * \param b_g object grid that will store the solution * * */ */ FDScheme(Padding & pd, FDScheme(Padding & pd, const Ghost & stencil, const Ghost & stencil, const Box & domain, const Box & domain, const grid_sm & gs, const typename Sys_eqs::b_grid & b_g) const typename Sys_eqs::b_grid & b_g) :pd(pd),gs(gs),g_map(b_g,stencil,pd),row(0),row_b(0) :pd(pd),gs(b_g.getGridInfoVoid()),g_map(b_g,stencil,pd),row(0),row_b(0) { { construct_gmap(); Initialize(domain); // Create a CellDecomposer and calculate the spacing size_t sz_g[Sys_eqs::dims]; for (size_t i = 0 ; i < Sys_eqs::dims ; i++) { if (Sys_eqs::boundary[i] == NON_PERIODIC) sz_g[i] = gs.getSize()[i] - 1; else sz_g[i] = gs.getSize()[i]; } CellDecomposer_sm cd(domain,sz_g,0); for (size_t i = 0 ; i < Sys_eqs::dims ; i++) spacing[i] = cd.getCellBox().getHigh(i); } } /*! \brief Impose an operator /*! \brief Impose an operator ... @@ -802,8 +828,8 @@ public: ... @@ -802,8 +828,8 @@ public: */ */ template void impose_dit(const T & op , template void impose_dit(const T & op , b_term & b_t, b_term & b_t, long int id , const iterator & it_d, const iterator & it_d) long int id = 0) { { grid_b b(b_t); grid_b b(b_t); ... @@ -894,6 +920,33 @@ public: ... @@ -894,6 +920,33 @@ public: copy_normal(v,g_dst); copy_normal(v,g_dst); } } } } /*! \brief Copy the vector into the grid * * ## Copy the solution into the grid * \snippet eq_unit_test.hpp Copy the solution to grid * * \tparam scheme Discretization scheme * \tparam Grid_dst type of the target grid * \tparam pos target properties * * \param v Vector that contain the solution of the system * \param g_dst Destination grid * */ template void copy(Vct & v, Grid_dst & g_dst) { long int start[Sys_eqs_typ::dims]; long int stop[Sys_eqs_typ::dims]; for (size_t i = 0 ; i < Sys_eqs_typ::dims ; i++) { start[i] = 0; stop[i] = g_dst.size(i); } this->copy(v,start,stop,g_dst); } }; }; #define EQS_FIELDS 0 #define EQS_FIELDS 0 ... ...
 ... @@ -174,7 +174,7 @@ template void lid_driven_cavity_2d() ... @@ -174,7 +174,7 @@ template void lid_driven_cavity_2d() Ghost<2,long int> stencil_max(1); Ghost<2,long int> stencil_max(1); // Finite difference scheme // Finite difference scheme FDScheme fd(pd, stencil_max, domain, g_dist.getGridInfo(), g_dist); FDScheme fd(pd, stencil_max, domain,g_dist); // Here we impose the equation, we start from the incompressibility Eq imposed in the bulk with the // Here we impose the equation, we start from the incompressibility Eq imposed in the bulk with the // exception of the first point {0,0} and than we set P = 0 in {0,0}, why we are doing this is again // exception of the first point {0,0} and than we set P = 0 in {0,0}, why we are doing this is again ... ...
 ... @@ -124,7 +124,7 @@ template void lid_driven_cavity_3d() ... @@ -124,7 +124,7 @@ template void lid_driven_cavity_3d() Ghost<3,long int> stencil_max(1); Ghost<3,long int> stencil_max(1); // Distributed grid // Distributed grid FDScheme fd(pd,stencil_max,domain,g_dist.getGridInfo(),g_dist); FDScheme fd(pd,stencil_max,domain,g_dist); // start and end of the bulk // start and end of the bulk ... ...
 ... @@ -88,7 +88,7 @@ BOOST_AUTO_TEST_CASE( interpolation_full_test ) ... @@ -88,7 +88,7 @@ BOOST_AUTO_TEST_CASE( interpolation_full_test ) Box<2,float> domain({0.0,0.0},{1.0,1.0}); Box<2,float> domain({0.0,0.0},{1.0,1.0}); size_t sz[2] = {64,64}; size_t sz[2] = {64,64}; Ghost<2,long int> gg(3); Ghost<2,long int> gg(2); Ghost<2,float> gv(0.01); Ghost<2,float> gv(0.01); size_t bc_v[2] = {PERIODIC,PERIODIC}; size_t bc_v[2] = {PERIODIC,PERIODIC}; ... ...
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!