Commit 6ab209f5 authored by Robert K's avatar Robert K

[cleanup][DefaultIndexSets] use unique_ptr to store containers.

Also removed some duplicate leafbegin/leafend methods and make
grid_imp in library work.
parent 93491c28
Pipeline #17204 failed with stage
in 19 minutes and 37 seconds
......@@ -9,8 +9,8 @@ set(DUNE_REENABLE_ADD_TEST TRUE)
set(ALUGRID_EXTRA_GRIDSELECTOR_FILE TRUE)
set(ALUGRID_DISABLE_METIS TRUE)
#set(DUNE_ALUGRID_COMPILE_BINDINGS TRUE)
set(DUNE_ALUGRID_COMPILE_BINDINGS FALSE)
set(DUNE_ALUGRID_COMPILE_BINDINGS TRUE)
#set(DUNE_ALUGRID_COMPILE_BINDINGS FALSE)
# variable to be set in config.h
if( DUNE_ALUGRID_COMPILE_BINDINGS )
......
......@@ -716,39 +716,6 @@ namespace Dune
entity.level(), true );
}
private:
//! General definiton for a leaf iterator
template <int codim, PartitionIteratorType pitype>
typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
leafbegin(int level) const;
//! General definition for an end iterator on leaf level
template <int codim, PartitionIteratorType pitype>
typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
leafend(int level) const;
//! General definiton for a leaf iterator
template <int codim>
typename Traits::template Codim<codim>::LeafIterator
leafbegin(int level) const;
//! General definition for an end iterator on leaf level
template <int codim>
typename Traits::template Codim<codim>::LeafIterator
leafend(int level) const;
//! Iterator to first entity of codim 0 on leaf level (All_Partition)
LeafIteratorType leafbegin (int level) const;
//! one past the end on this leaf level (codim 0 and All_Partition)
LeafIteratorType leafend (int level) const;
//! Iterator to first entity of codim 0 on leaf level (All_Partition)
LeafIteratorType leafbegin () const;
//! one past the end on this leaf level (codim 0 and All_Partition)
LeafIteratorType leafend () const;
public:
//! General definiton for a leaf iterator
template <int codim, PartitionIteratorType pitype>
......@@ -770,17 +737,6 @@ namespace Dune
typename Traits::template Codim<codim>::LeafIterator
leafend() const;
private:
//! General definiton for a leaf iterator
template <int codim, PartitionIteratorType pitype>
typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
createLeafIteratorBegin (int level) const;
//! General definition for an end iterator on leaf level
template <int codim, PartitionIteratorType pitype>
typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
createLeafIteratorEnd(int level) const;
public:
//! number of grid entities per level and codim
int size (int level, int cd) const;
......@@ -1415,7 +1371,7 @@ namespace Dune
} // end namespace Dune
#include "grid_inline.hh"
//#if COMPILE_ALUGRID_INLINE
#if COMPILE_ALUGRID_INLINE
#include "grid_imp.cc"
//#endif
#endif
#endif
This diff is collapsed.
This diff is collapsed.
......@@ -2,6 +2,7 @@
#define DUNE_ALUGRID_DEFAULTINDEXSETS_HH
#include <type_traits>
#include <memory>
#include <vector>
#include <dune/common/version.hh>
......@@ -90,7 +91,7 @@ namespace Dune
};
typedef PersistentContainer< GridType, Index > PersistentContainerType ;
typedef std::vector< PersistentContainerType* > PersistentContainerVectorType;
typedef std::vector< std::unique_ptr< PersistentContainerType > > PersistentContainerVectorType;
private:
typedef DefaultIndexSet<GridType, IteratorType > ThisType;
......@@ -159,6 +160,9 @@ namespace Dune
}
};
// no copying
DefaultIndexSet( const DefaultIndexSet& org ) = delete;
public:
//! import default implementation of subIndex<cc>
//! \todo remove after next release
......@@ -166,28 +170,23 @@ namespace Dune
//! create index set by using the given begin and end iterator
//! for the given level (level == -1 means leaf level)
DefaultIndexSet( const GridType & grid ,
DefaultIndexSet( const GridType& grid ,
const IteratorType& begin,
const IteratorType& end,
const int level = -1 )
: grid_(grid),
indexContainers_( ncodim, (PersistentContainerType *) 0),
indexContainers_( ncodim ),
size_( ncodim, -1 ),
level_(level)
{
for( int codim=0; codim < ncodim; ++codim )
indexContainers_[ codim ] = new PersistentContainerType( grid, codim );
{
indexContainers_[ codim ].reset( new PersistentContainerType( grid, codim ) );
}
calcNewIndex (begin, end);
}
//! desctructor deleting persistent containers
~DefaultIndexSet ()
{
for( int codim=0; codim < ncodim; ++codim )
delete indexContainers_[ codim ];
}
const PersistentContainerType& indexContainer( const size_t codim ) const
{
alugrid_assert ( codim < indexContainers_.size() );
......@@ -226,6 +225,7 @@ namespace Dune
#ifdef ALUGRIDDEBUG
const int codim = cd;
//const bool isLeaf = (codim == 0) ? en.isLeaf() : true ;
alugrid_assert ( (codim == dim) ? (true) : ( level_ < 0 ) || (level_ == en.level() ));
alugrid_assert ( indexContainer( cd )[ en ].index() >= 0 );
#endif
......
......@@ -3,7 +3,7 @@ if( DUNE_ALUGRID_COMPILE_BINDINGS )
${PROJECT_SOURCE_DIR}/dune/alugrid/3d/iterator.cc
${PROJECT_SOURCE_DIR}/dune/alugrid/3d/indexsets.cc
${PROJECT_SOURCE_DIR}/dune/alugrid/3d/mappings_imp.cc
# ${PROJECT_SOURCE_DIR}/dune/alugrid/3d/grid_imp.cc
${PROJECT_SOURCE_DIR}/dune/alugrid/3d/grid_imp.cc
${PROJECT_SOURCE_DIR}/dune/alugrid/3d/entity_imp.cc)
endif()
......@@ -17,6 +17,10 @@ dune_add_library(dunealugrid
${PROJECT_SOURCE_DIR}/dune/alugrid/3d/mappings.cc
${PROJECT_SOURCE_DIR}/dune/alugrid/3d/topology.cc)
if( DUNE_ALUGRID_COMPILE_BINDINGS )
target_compile_options(dunealugrid PRIVATE -include${CMAKE_BINARY_DIR}/config.h)
endif()
# add mpi flags to compile library
add_dune_mpi_flags( dunealugrid )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment