Loading src/Python/pytnl/tnl/MeshReaders.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ void export_MeshReaders( py::module & m ) .def("loadMesh", &MeshReader::template loadMesh< MeshOfQuadrangles >) .def("loadMesh", &MeshReader::template loadMesh< MeshOfTetrahedrons >) .def("loadMesh", &MeshReader::template loadMesh< MeshOfHexahedrons >) .def("readPointData", &MeshReader::readPointData) .def("readCellData", &MeshReader::readCellData) ; py::class_< TNL::Meshes::Readers::VTKReader, MeshReader >( m, "VTKReader" ) Loading @@ -29,8 +31,6 @@ void export_MeshReaders( py::module & m ) // base class for VTUReader and PVTUReader py::class_< XMLVTK, PyXMLVTK, MeshReader >( m, "XMLVTK" ) .def(py::init<std::string>()) .def("readPointData", &XMLVTK::readPointData) .def("readCellData", &XMLVTK::readCellData) ; py::class_< TNL::Meshes::Readers::VTUReader, XMLVTK >( m, "VTUReader" ) Loading src/TNL/Containers/NDArray.h +0 −9 Original line number Diff line number Diff line Loading @@ -167,9 +167,6 @@ public: operator()( IndexTypes&&... indices ) { static_assert( sizeof...( indices ) == getDimension(), "got wrong number of indices" ); __ndarray_impl::assertIndicesInBounds( getSizes(), OverlapsType{}, std::forward< IndexTypes >( indices )... ); TNL_ASSERT_LT( getStorageIndex( std::forward< IndexTypes >( indices )... ), getStorageSize(), "storage index out of bounds - either input error or a bug in the indexer" ); return array[ getStorageIndex( std::forward< IndexTypes >( indices )... ) ]; } Loading @@ -179,9 +176,6 @@ public: operator()( IndexTypes&&... indices ) const { static_assert( sizeof...( indices ) == getDimension(), "got wrong number of indices" ); __ndarray_impl::assertIndicesInBounds( getSizes(), OverlapsType{}, std::forward< IndexTypes >( indices )... ); TNL_ASSERT_LT( getStorageIndex( std::forward< IndexTypes >( indices )... ), getStorageSize(), "storage index out of bounds - either input error or a bug in the indexer" ); return array[ getStorageIndex( std::forward< IndexTypes >( indices )... ) ]; } Loading Loading @@ -294,9 +288,6 @@ public: getElement( IndexTypes&&... indices ) const { static_assert( sizeof...( indices ) == getDimension(), "got wrong number of indices" ); __ndarray_impl::assertIndicesInBounds( getSizes(), OverlapsType{}, std::forward< IndexTypes >( indices )... ); TNL_ASSERT_LT( getStorageIndex( std::forward< IndexTypes >( indices )... ), getStorageSize(), "storage index out of bounds - either input error or a bug in the indexer" ); return array.getElement( getStorageIndex( std::forward< IndexTypes >( indices )... ) ); } Loading src/TNL/Containers/NDArrayIndexer.h +13 −4 Original line number Diff line number Diff line Loading @@ -91,10 +91,19 @@ public: getStorageIndex( IndexTypes&&... indices ) const { static_assert( sizeof...( indices ) == SizesHolder::getDimension(), "got wrong number of indices" ); return Base::template getStorageIndex< Permutation, Overlaps > __ndarray_impl::assertIndicesInBounds( getSizes(), OverlapsType{}, std::forward< IndexTypes >( indices )... ); const IndexType result = Base::template getStorageIndex< Permutation, Overlaps > ( sizes, static_cast< const StridesHolder& >( *this ), std::forward< IndexTypes >( indices )... ); TNL_ASSERT_GE( result, (IndexType) 0, "storage index out of bounds - either input error or a bug in the indexer" ); // upper bound can be checked only for contiguous arrays/views if( StridesHolder::isContiguous() ) { TNL_ASSERT_LT( result, getStorageSize(), "storage index out of bounds - either input error or a bug in the indexer" ); } return result; } protected: Loading src/TNL/Containers/NDArrayView.h +0 −2 Original line number Diff line number Diff line Loading @@ -223,7 +223,6 @@ public: operator()( IndexTypes&&... indices ) { static_assert( sizeof...( indices ) == getDimension(), "got wrong number of indices" ); __ndarray_impl::assertIndicesInBounds( getSizes(), OverlapsType{}, std::forward< IndexTypes >( indices )... ); return array[ getStorageIndex( std::forward< IndexTypes >( indices )... ) ]; } Loading @@ -233,7 +232,6 @@ public: operator()( IndexTypes&&... indices ) const { static_assert( sizeof...( indices ) == getDimension(), "got wrong number of indices" ); __ndarray_impl::assertIndicesInBounds( getSizes(), OverlapsType{}, std::forward< IndexTypes >( indices )... ); return array[ getStorageIndex( std::forward< IndexTypes >( indices )... ) ]; } Loading src/TNL/MPI/Utils.h +25 −0 Original line number Diff line number Diff line Loading @@ -72,5 +72,30 @@ inline int getRankOnNode( MPI_Comm group = AllGroup() ) #endif } /** * \brief Applies the given reduction operation to the values among all ranks * in the given communicator. * * This is a collective operation which uses \ref Allreduce internally. It * provides nicer semantics than the wrapper function: the input value is passed * by value (heh) rather then by pointer, and the result is returned rather than * written to the output pointer. * * \param value Value of the current rank to be reduced. * \param op The reduction operation to be applied. * \param group The communicator comprising ranks that participate in the * collective operation. * \return The reduced value (it is ensured that all ranks receive the same * value). */ template< typename T > T reduce( T value, const MPI_Op& op, MPI_Comm group = AllGroup() ) { // call the in-place variant of Allreduce Allreduce( &value, 1, op, group ); // return the reduced value return value; } } // namespace MPI } // namespace TNL Loading
src/Python/pytnl/tnl/MeshReaders.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ void export_MeshReaders( py::module & m ) .def("loadMesh", &MeshReader::template loadMesh< MeshOfQuadrangles >) .def("loadMesh", &MeshReader::template loadMesh< MeshOfTetrahedrons >) .def("loadMesh", &MeshReader::template loadMesh< MeshOfHexahedrons >) .def("readPointData", &MeshReader::readPointData) .def("readCellData", &MeshReader::readCellData) ; py::class_< TNL::Meshes::Readers::VTKReader, MeshReader >( m, "VTKReader" ) Loading @@ -29,8 +31,6 @@ void export_MeshReaders( py::module & m ) // base class for VTUReader and PVTUReader py::class_< XMLVTK, PyXMLVTK, MeshReader >( m, "XMLVTK" ) .def(py::init<std::string>()) .def("readPointData", &XMLVTK::readPointData) .def("readCellData", &XMLVTK::readCellData) ; py::class_< TNL::Meshes::Readers::VTUReader, XMLVTK >( m, "VTUReader" ) Loading
src/TNL/Containers/NDArray.h +0 −9 Original line number Diff line number Diff line Loading @@ -167,9 +167,6 @@ public: operator()( IndexTypes&&... indices ) { static_assert( sizeof...( indices ) == getDimension(), "got wrong number of indices" ); __ndarray_impl::assertIndicesInBounds( getSizes(), OverlapsType{}, std::forward< IndexTypes >( indices )... ); TNL_ASSERT_LT( getStorageIndex( std::forward< IndexTypes >( indices )... ), getStorageSize(), "storage index out of bounds - either input error or a bug in the indexer" ); return array[ getStorageIndex( std::forward< IndexTypes >( indices )... ) ]; } Loading @@ -179,9 +176,6 @@ public: operator()( IndexTypes&&... indices ) const { static_assert( sizeof...( indices ) == getDimension(), "got wrong number of indices" ); __ndarray_impl::assertIndicesInBounds( getSizes(), OverlapsType{}, std::forward< IndexTypes >( indices )... ); TNL_ASSERT_LT( getStorageIndex( std::forward< IndexTypes >( indices )... ), getStorageSize(), "storage index out of bounds - either input error or a bug in the indexer" ); return array[ getStorageIndex( std::forward< IndexTypes >( indices )... ) ]; } Loading Loading @@ -294,9 +288,6 @@ public: getElement( IndexTypes&&... indices ) const { static_assert( sizeof...( indices ) == getDimension(), "got wrong number of indices" ); __ndarray_impl::assertIndicesInBounds( getSizes(), OverlapsType{}, std::forward< IndexTypes >( indices )... ); TNL_ASSERT_LT( getStorageIndex( std::forward< IndexTypes >( indices )... ), getStorageSize(), "storage index out of bounds - either input error or a bug in the indexer" ); return array.getElement( getStorageIndex( std::forward< IndexTypes >( indices )... ) ); } Loading
src/TNL/Containers/NDArrayIndexer.h +13 −4 Original line number Diff line number Diff line Loading @@ -91,10 +91,19 @@ public: getStorageIndex( IndexTypes&&... indices ) const { static_assert( sizeof...( indices ) == SizesHolder::getDimension(), "got wrong number of indices" ); return Base::template getStorageIndex< Permutation, Overlaps > __ndarray_impl::assertIndicesInBounds( getSizes(), OverlapsType{}, std::forward< IndexTypes >( indices )... ); const IndexType result = Base::template getStorageIndex< Permutation, Overlaps > ( sizes, static_cast< const StridesHolder& >( *this ), std::forward< IndexTypes >( indices )... ); TNL_ASSERT_GE( result, (IndexType) 0, "storage index out of bounds - either input error or a bug in the indexer" ); // upper bound can be checked only for contiguous arrays/views if( StridesHolder::isContiguous() ) { TNL_ASSERT_LT( result, getStorageSize(), "storage index out of bounds - either input error or a bug in the indexer" ); } return result; } protected: Loading
src/TNL/Containers/NDArrayView.h +0 −2 Original line number Diff line number Diff line Loading @@ -223,7 +223,6 @@ public: operator()( IndexTypes&&... indices ) { static_assert( sizeof...( indices ) == getDimension(), "got wrong number of indices" ); __ndarray_impl::assertIndicesInBounds( getSizes(), OverlapsType{}, std::forward< IndexTypes >( indices )... ); return array[ getStorageIndex( std::forward< IndexTypes >( indices )... ) ]; } Loading @@ -233,7 +232,6 @@ public: operator()( IndexTypes&&... indices ) const { static_assert( sizeof...( indices ) == getDimension(), "got wrong number of indices" ); __ndarray_impl::assertIndicesInBounds( getSizes(), OverlapsType{}, std::forward< IndexTypes >( indices )... ); return array[ getStorageIndex( std::forward< IndexTypes >( indices )... ) ]; } Loading
src/TNL/MPI/Utils.h +25 −0 Original line number Diff line number Diff line Loading @@ -72,5 +72,30 @@ inline int getRankOnNode( MPI_Comm group = AllGroup() ) #endif } /** * \brief Applies the given reduction operation to the values among all ranks * in the given communicator. * * This is a collective operation which uses \ref Allreduce internally. It * provides nicer semantics than the wrapper function: the input value is passed * by value (heh) rather then by pointer, and the result is returned rather than * written to the output pointer. * * \param value Value of the current rank to be reduced. * \param op The reduction operation to be applied. * \param group The communicator comprising ranks that participate in the * collective operation. * \return The reduced value (it is ensured that all ranks receive the same * value). */ template< typename T > T reduce( T value, const MPI_Op& op, MPI_Comm group = AllGroup() ) { // call the in-place variant of Allreduce Allreduce( &value, 1, op, group ); // return the reduced value return value; } } // namespace MPI } // namespace TNL