Loading src/Python/pytnl/tnl/Array.h +18 −1 Original line number Diff line number Diff line Loading @@ -8,6 +8,21 @@ namespace py = pybind11; #include <TNL/Containers/Array.h> // pybind11 should actually take care of this inside py::format_descriptor, but apparently it does not work... // see https://github.com/pybind/pybind11/issues/2135 template< typename T, typename = void > struct underlying_type { using type = T; }; template< typename T > struct underlying_type< T, std::enable_if_t< std::is_enum< T >::value > > { using type = std::underlying_type_t< T >; }; template< typename ArrayType > void export_Array(py::module & m, const char* name) { Loading Loading @@ -49,7 +64,9 @@ void export_Array(py::module & m, const char* name) // Size of one scalar sizeof( typename ArrayType::ValueType ), // Python struct-style format descriptor py::format_descriptor< typename ArrayType::ValueType >::format(), py::format_descriptor< typename underlying_type< typename ArrayType::ValueType >::type >::format(), // Number of dimensions 1, // Buffer dimensions Loading src/TNL/Assert.h +0 −5 Original line number Diff line number Diff line Loading @@ -121,7 +121,6 @@ #include <stdio.h> #include <TNL/Cuda/CudaCallable.h> #include <TNL/Debugging/StackBacktrace.h> namespace TNL { /** Loading Loading @@ -164,8 +163,6 @@ printDiagnosticsHost( const char* assertion, << "Line: " << line << "\n" << "Diagnostics:\n" << diagnostics << std::endl; PrintStackBacktrace; throw AssertionError( str.str() ); } Loading @@ -186,8 +183,6 @@ printDiagnosticsHost( const char* assertion, << "Function: " << function << "\n" << "Line: " << line << "\n" << "Diagnostics:\n" << diagnostics << std::endl; PrintStackBacktrace; } #endif // TNL_THROW_ASSERTION_ERROR Loading src/TNL/Communicators/MPIPrint.h +7 −7 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ else std::stringstream __tnl_mpi_print_stream_; \ __tnl_mpi_print_stream_ << "Node " << TNL::Communicators::MpiCommunicator::GetRank() << " of " \ << TNL::Communicators::MpiCommunicator::GetSize() << " : " << message << std::endl; \ TNL::String __tnl_mpi_print_string_( __tnl_mpi_print_stream_.str().c_str() ); \ TNL::String __tnl_mpi_print_string_( __tnl_mpi_print_stream_.str() ); \ mpiSend( __tnl_mpi_print_string_, 0, std::numeric_limits< int >::max() ); \ } \ else \ Loading Loading @@ -77,8 +77,8 @@ else std::stringstream __tnl_mpi_print_stream_; \ __tnl_mpi_print_stream_ << "Node " << TNL::Communicators::MpiCommunicator::GetRank() << " of " \ << TNL::Communicators::MpiCommunicator::GetSize() << " : " << message << std::endl; \ TNL::String __tnl_mpi_print_string_( __tnl_mpi_print_stream_.str().c_str() ); \ mpiSsend( __tnl_mpi_print_string_, 0, std::numeric_limits< int >::max() ); \ TNL::String __tnl_mpi_print_string_( __tnl_mpi_print_stream_.str() ); \ mpiSend( __tnl_mpi_print_string_, 0, std::numeric_limits< int >::max() ); \ } \ } \ else \ Loading src/TNL/Containers/Multimaps/EllpackIndexMultimap.hpp +8 −4 Original line number Diff line number Diff line Loading @@ -80,9 +80,11 @@ allocate( const LocalIndexType& maxValuesCount ) const IndexType ldSize = getAllocationKeysRange( this->getKeysRange() ); this->values.setSize( ldSize * this->maxValuesCount ); this->valuesCounts.setSize( this->getKeysRange() ); if( this->valuesCounts.getSize() > 0 ) this->valuesCounts.setValue( maxValuesCount ); // extra cost at initialization, which allows to have much simpler operator== if( this->values.getSize() > 0 ) values.setValue( 0 ); } Loading @@ -108,6 +110,7 @@ allocate( const ValuesAllocationVectorType& valuesCounts ) this->valuesCounts = valuesCounts; // extra cost at initialization, which allows to have much simpler operator== if( this->values.getSize() > 0 ) values.setValue( 0 ); } Loading @@ -128,6 +131,7 @@ setLike( const EllpackIndexMultimap< Index, Device_, LocalIndex, SliceSize_ >& o maxValuesCount = other.maxValuesCount; // extra cost at initialization, which allows to have much simpler operator== if( this->values.getSize() > 0 ) values.setValue( 0 ); } Loading src/TNL/Containers/Multimaps/StaticEllpackIndexMultimap.hpp +4 −2 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ allocate() values.setSize( ldSize * ValuesCount ); // extra cost at initialization, which allows to have much simpler operator== if( ldSize > 0 ) values.setValue( 0 ); } Loading @@ -99,6 +100,7 @@ setLike( const StaticEllpackIndexMultimap< ValuesCount, Index, Device_, LocalInd values.setSize( ldSize * ValuesCount ); // extra cost at initialization, which allows to have much simpler operator== if( ldSize > 0 ) values.setValue( 0 ); keysRange = other.keysRange; Loading Loading
src/Python/pytnl/tnl/Array.h +18 −1 Original line number Diff line number Diff line Loading @@ -8,6 +8,21 @@ namespace py = pybind11; #include <TNL/Containers/Array.h> // pybind11 should actually take care of this inside py::format_descriptor, but apparently it does not work... // see https://github.com/pybind/pybind11/issues/2135 template< typename T, typename = void > struct underlying_type { using type = T; }; template< typename T > struct underlying_type< T, std::enable_if_t< std::is_enum< T >::value > > { using type = std::underlying_type_t< T >; }; template< typename ArrayType > void export_Array(py::module & m, const char* name) { Loading Loading @@ -49,7 +64,9 @@ void export_Array(py::module & m, const char* name) // Size of one scalar sizeof( typename ArrayType::ValueType ), // Python struct-style format descriptor py::format_descriptor< typename ArrayType::ValueType >::format(), py::format_descriptor< typename underlying_type< typename ArrayType::ValueType >::type >::format(), // Number of dimensions 1, // Buffer dimensions Loading
src/TNL/Assert.h +0 −5 Original line number Diff line number Diff line Loading @@ -121,7 +121,6 @@ #include <stdio.h> #include <TNL/Cuda/CudaCallable.h> #include <TNL/Debugging/StackBacktrace.h> namespace TNL { /** Loading Loading @@ -164,8 +163,6 @@ printDiagnosticsHost( const char* assertion, << "Line: " << line << "\n" << "Diagnostics:\n" << diagnostics << std::endl; PrintStackBacktrace; throw AssertionError( str.str() ); } Loading @@ -186,8 +183,6 @@ printDiagnosticsHost( const char* assertion, << "Function: " << function << "\n" << "Line: " << line << "\n" << "Diagnostics:\n" << diagnostics << std::endl; PrintStackBacktrace; } #endif // TNL_THROW_ASSERTION_ERROR Loading
src/TNL/Communicators/MPIPrint.h +7 −7 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ else std::stringstream __tnl_mpi_print_stream_; \ __tnl_mpi_print_stream_ << "Node " << TNL::Communicators::MpiCommunicator::GetRank() << " of " \ << TNL::Communicators::MpiCommunicator::GetSize() << " : " << message << std::endl; \ TNL::String __tnl_mpi_print_string_( __tnl_mpi_print_stream_.str().c_str() ); \ TNL::String __tnl_mpi_print_string_( __tnl_mpi_print_stream_.str() ); \ mpiSend( __tnl_mpi_print_string_, 0, std::numeric_limits< int >::max() ); \ } \ else \ Loading Loading @@ -77,8 +77,8 @@ else std::stringstream __tnl_mpi_print_stream_; \ __tnl_mpi_print_stream_ << "Node " << TNL::Communicators::MpiCommunicator::GetRank() << " of " \ << TNL::Communicators::MpiCommunicator::GetSize() << " : " << message << std::endl; \ TNL::String __tnl_mpi_print_string_( __tnl_mpi_print_stream_.str().c_str() ); \ mpiSsend( __tnl_mpi_print_string_, 0, std::numeric_limits< int >::max() ); \ TNL::String __tnl_mpi_print_string_( __tnl_mpi_print_stream_.str() ); \ mpiSend( __tnl_mpi_print_string_, 0, std::numeric_limits< int >::max() ); \ } \ } \ else \ Loading
src/TNL/Containers/Multimaps/EllpackIndexMultimap.hpp +8 −4 Original line number Diff line number Diff line Loading @@ -80,9 +80,11 @@ allocate( const LocalIndexType& maxValuesCount ) const IndexType ldSize = getAllocationKeysRange( this->getKeysRange() ); this->values.setSize( ldSize * this->maxValuesCount ); this->valuesCounts.setSize( this->getKeysRange() ); if( this->valuesCounts.getSize() > 0 ) this->valuesCounts.setValue( maxValuesCount ); // extra cost at initialization, which allows to have much simpler operator== if( this->values.getSize() > 0 ) values.setValue( 0 ); } Loading @@ -108,6 +110,7 @@ allocate( const ValuesAllocationVectorType& valuesCounts ) this->valuesCounts = valuesCounts; // extra cost at initialization, which allows to have much simpler operator== if( this->values.getSize() > 0 ) values.setValue( 0 ); } Loading @@ -128,6 +131,7 @@ setLike( const EllpackIndexMultimap< Index, Device_, LocalIndex, SliceSize_ >& o maxValuesCount = other.maxValuesCount; // extra cost at initialization, which allows to have much simpler operator== if( this->values.getSize() > 0 ) values.setValue( 0 ); } Loading
src/TNL/Containers/Multimaps/StaticEllpackIndexMultimap.hpp +4 −2 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ allocate() values.setSize( ldSize * ValuesCount ); // extra cost at initialization, which allows to have much simpler operator== if( ldSize > 0 ) values.setValue( 0 ); } Loading @@ -99,6 +100,7 @@ setLike( const StaticEllpackIndexMultimap< ValuesCount, Index, Device_, LocalInd values.setSize( ldSize * ValuesCount ); // extra cost at initialization, which allows to have much simpler operator== if( ldSize > 0 ) values.setValue( 0 ); keysRange = other.keysRange; Loading