Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • patrick.jaap/dune-grid
  • jakub.both/dune-grid
  • alexander.mueller/dune-grid
  • Xinyun.Li/dune-grid
  • pipping/dune-grid
  • simon.praetorius/dune-grid
  • jakob.schneck/dune-grid
  • liam.keegan/dune-grid
  • leopold.stadler/dune-grid
  • core/dune-grid
  • govind.sahai/dune-grid
  • exadune/dune-grid
  • maikel.nadolski/dune-grid
  • felix.gruber/dune-grid
  • markus.blatt/dune-grid
  • michael.sghaier/dune-grid
  • felix.schindler/dune-grid
  • dominic/dune-grid
  • ansgar/dune-grid
  • ani.anciaux-sedrakian/dune-grid
  • marcel.koch/dune-grid
  • rene.milk/dune-grid
  • santiago.ospina/dune-grid
  • claus-justus.heine/dune-grid
  • tkoch/dune-grid
  • martin.alkaemper/dune-grid
  • stephan.hilb/dune-grid
  • kilian.weishaupt/dune-grid
  • michael.sargado/dune-grid
  • felix.mueller/dune-grid
  • nils.friess/dune-grid
31 results
Show changes
Commits on Source (5)
...@@ -377,10 +377,9 @@ namespace Dune ...@@ -377,10 +377,9 @@ namespace Dune
const GeometryType gt = eType.isNone() ? const GeometryType gt = eType.isNone() ?
GeometryTypes::none( GV::dimension - cc ) : GeometryTypes::none( GV::dimension - cc ) :
ReferenceElements<double,GV::dimension>::general(eType).type(i,cc) ; ReferenceElements<double,GV::dimension>::general(eType).type(i,cc) ;
//GeometryType gt=ReferenceElements<double,GV::dimension>::general(e.type()).type(i,cc);
if (offset(gt) == invalidOffset) if (offset(gt) == invalidOffset)
return false; return false;
result = is.subIndex(e, i, cc) + offset(gt); result = is.subIndex(e, i, cc)*blockSize(gt) + offset(gt);
return true; return true;
} }
......
dune_add_test(SOURCES scsgmappertest.cc) dune_add_test(SOURCES scsgmappertest.cc)
dune_add_test(SOURCES mcmgmappertest.cc)
dune_add_test(SOURCES mcmgmappertest.cc
CMAKE_GUARD dune-uggrid_FOUND)
...@@ -12,8 +12,12 @@ ...@@ -12,8 +12,12 @@
#include <dune/common/parallel/mpihelper.hh> #include <dune/common/parallel/mpihelper.hh>
#include <dune/grid/common/mcmgmapper.hh> #include <dune/grid/common/mcmgmapper.hh>
#include <dune/grid/yaspgrid.hh>
#include <dune/grid/utility/structuredgridfactory.hh>
#if HAVE_DUNE_UGGRID
#include <dune/grid/uggrid.hh> #include <dune/grid/uggrid.hh>
#include "../../../../doc/grids/gridfactory/hybridtestgrids.hh" #include "../../../../doc/grids/gridfactory/hybridtestgrids.hh"
#endif
using namespace Dune; using namespace Dune;
...@@ -37,6 +41,7 @@ struct MCMGElementEdgeLayout ...@@ -37,6 +41,7 @@ struct MCMGElementEdgeLayout
} }
}; };
/*! /*!
* \brief Check whether the index created for element data is unique, * \brief Check whether the index created for element data is unique,
* consecutive and starting from zero. * consecutive and starting from zero.
...@@ -75,16 +80,26 @@ void checkVertexDataMapper(const Mapper& mapper, const GridView& gridView) ...@@ -75,16 +80,26 @@ void checkVertexDataMapper(const Mapper& mapper, const GridView& gridView)
{ {
const size_t dim = GridView::dimension; const size_t dim = GridView::dimension;
size_t min = 1; typedef typename Mapper::Index Index;
size_t max = 0;
std::set<int> indices; Index min = 1;
Index max = 0;
std::set< Index > indices;
for (const auto& element : elements(gridView)) for (const auto& element : elements(gridView))
{ {
size_t numVertices = element.subEntities(dim); size_t numVertices = element.subEntities(dim);
for (size_t curVertex = 0; curVertex < numVertices; ++curVertex) for (size_t curVertex = 0; curVertex < numVertices; ++curVertex)
{ {
size_t index = mapper.subIndex(element, curVertex, dim); Index testIdx = Index(-1);
bool contains = mapper.contains(element, curVertex, dim, testIdx );
Index index = mapper.subIndex(element, curVertex, dim);
if( contains && (index != testIdx) )
{
DUNE_THROW(GridError, "subIndex and contains do not return the same index!");
}
min = std::min(min, index); min = std::min(min, index);
max = std::max(max, index); max = std::max(max, index);
indices.insert(index); indices.insert(index);
...@@ -160,6 +175,15 @@ void checkMixedDataMapper(const Mapper& mapper, const GridView& gridView) ...@@ -160,6 +175,15 @@ void checkMixedDataMapper(const Mapper& mapper, const GridView& gridView)
max = std::max(max, *(block.end())-1); max = std::max(max, *(block.end())-1);
for (Index i : block) for (Index i : block)
indices.insert(i); indices.insert(i);
Index testIdx = Index(-1);
const bool contains = mapper.contains(element, curEdge, dim-1, testIdx );
const Index index = mapper.subIndex(element, curEdge, dim-1);
if( contains && (index != testIdx) )
{
DUNE_THROW(GridError, "subIndex and contains do not return the same index!");
}
} }
} }
...@@ -199,6 +223,7 @@ void checkGrid(const Grid& grid) ...@@ -199,6 +223,7 @@ void checkGrid(const Grid& grid)
leafMCMGMapper(grid, MCMGElementLayout<dim>()); leafMCMGMapper(grid, MCMGElementLayout<dim>());
checkElementDataMapper(leafMCMGMapper, grid.leafGridView()); checkElementDataMapper(leafMCMGMapper, grid.leafGridView());
} }
DUNE_NO_DEPRECATED_END DUNE_NO_DEPRECATED_END
{ {
LeafMultipleCodimMultipleGeomTypeMapper<Grid> LeafMultipleCodimMultipleGeomTypeMapper<Grid>
...@@ -325,6 +350,7 @@ try ...@@ -325,6 +350,7 @@ try
// Check grids with more than one element type. // Check grids with more than one element type.
// So far only UGGrid does this, so we use it to test the mappers. // So far only UGGrid does this, so we use it to test the mappers.
#if HAVE_DUNE_UGGRID
// Do the test for a 2d UGGrid // Do the test for a 2d UGGrid
{ {
typedef UGGrid<2> Grid; typedef UGGrid<2> Grid;
...@@ -350,6 +376,31 @@ try ...@@ -350,6 +376,31 @@ try
checkGrid(*grid); checkGrid(*grid);
} }
#endif
// Do the test for a 2d YaspGrid
{
Dune::FieldVector< double, 2 > lower( 0 );
Dune::FieldVector< double, 2 > upper( 1 );
std::array<unsigned int,2 > elements = {{ 4 ,4 }};
typedef Dune::YaspGrid<2> Grid;
auto grid = Dune::StructuredGridFactory< Grid >::createCubeGrid( lower, upper, elements );
// create hybrid grid
checkGrid(*grid);
}
// Do the test for a 3d YaspGrid
{
Dune::FieldVector< double, 3 > lower( 0 );
Dune::FieldVector< double, 3 > upper( 1 );
std::array<unsigned int,3 > elements = {{ 4 ,4, 4 }};
typedef Dune::YaspGrid<3> Grid;
auto grid = Dune::StructuredGridFactory< Grid >::createCubeGrid( lower, upper, elements );
// create hybrid grid
checkGrid(*grid);
}
return EXIT_SUCCESS; return EXIT_SUCCESS;
......
...@@ -131,6 +131,22 @@ namespace Dune ...@@ -131,6 +131,22 @@ namespace Dune
return ext; return ext;
} }
// read gmsh file if dimension world <= 3
void readGmsh( const std::string& filename, std::integral_constant< bool, true > )
{
GridFactory<GridType> gridFactory;
std::vector<int> boundaryIDs;
std::vector<int> elementsIDs;
GmshReader<GridType>::read(gridFactory,filename,boundaryIDs,elementsIDs);
initialize( gridFactory, boundaryIDs,elementsIDs);
}
// if dimension world > 3 throw GridError
void readGmsh( const std::string& filename, std::integral_constant< bool, false > )
{
DUNE_THROW(GridError, "GmshReader requires dimWorld <= 3." );
}
public: public:
typedef MPIHelper::MPICommunicator MPICommunicatorType; typedef MPIHelper::MPICommunicator MPICommunicatorType;
...@@ -158,11 +174,8 @@ namespace Dune ...@@ -158,11 +174,8 @@ namespace Dune
} }
else if( fileExt == "msh" ) else if( fileExt == "msh" )
{ {
GridFactory<GridType> gridFactory; // Gmsh reader only compiles for dimworld <= 3
std::vector<int> boundaryIDs; readGmsh( filename, std::integral_constant< bool, GridType::dimensionworld <= 3 > () );
std::vector<int> elementsIDs;
GmshReader<GridType>::read(gridFactory,filename,boundaryIDs,elementsIDs);
initialize( gridFactory, boundaryIDs,elementsIDs);
} }
else if( fileExt == "amc" || fileExt == "2d" || fileExt == "3d" ) else if( fileExt == "amc" || fileExt == "2d" || fileExt == "3d" )
{ {
......