43 #include <ringmesh/ringmesh_config.h> 44 #include <ringmesh/ringmesh_export.h> 53 #define RINGMESH_DEBUG 60 disable : 4267 ) // conversion between long unsigned int and unsigned int 61 #pragma warning( disable : 4250 ) // warning about diamond inheritance 62 #pragma warning( disable : 4251 ) // dll interface warnings 63 #pragma warning( disable : 4275 ) // let's pray we have no issues 66 #define ringmesh_disable_copy( Class ) \ 68 Class( const Class& ) = delete; \ 69 Class& operator=( const Class& ) = delete 71 #define ringmesh_disable_move( Class ) \ 73 Class( const Class&& ) = delete; \ 74 Class& operator=( Class&& ) = delete 76 #define ringmesh_disable_copy_and_move( Class ) \ 77 ringmesh_disable_copy( Class ); \ 78 ringmesh_disable_move( Class ) 80 #define ringmesh_template_assert_2d_or_3d( type ) \ 82 ( type ) == 2 || type == 3, #type " template should be 2 or 3" ) 84 #define ringmesh_template_assert_3d( type ) \ 85 static_assert( ( type ) == 3, #type " template should be 3" ) 87 #define ALIAS_2D( Class ) using Class##2D = Class< 2 > 89 #define ALIAS_3D( Class ) using Class##3D = Class< 3 > 91 #define ALIAS_2D_AND_3D( Class ) \ 95 #define FORWARD_DECLARATION_DIMENSION_CLASS( Class ) \ 96 template < index_t > \ 99 #define FORWARD_DECLARATION_DIMENSION_STRUCT( Struct ) \ 100 template < index_t > \ 104 template <
typename T >
115 #include <geogram/basic/string.h> 117 #define DEBUG( a ) Logger::out( "Debug", #a, " = ", a ) 154 template <
typename... Args >
156 std::string category,
const Args&... messages )
157 : std::runtime_error( string_concatener( messages... ) ),
158 category_( std::move( category ) )
171 template <
typename A0 >
174 return GEO::String::to_string( a0 );
177 template <
typename A0,
typename A1,
typename... Args >
179 const A0& a0,
const A1& a1,
const Args&... args )
181 return GEO::String::to_string( a0 )
182 + string_concatener( a1, args... );
186 std::string category_{};
205 template <
typename T1,
typename T2 >
207 : iter_( static_cast< index_t >( begin ) ),
208 last_( static_cast< index_t >( end ) )
211 template <
typename T >
212 explicit range( T end ) : last_( static_cast< index_t >( end ) )
227 return iter_ < last_;
243 template <
typename ACTION >
250 index_t nb_threads{ std::min(
251 size, std::thread::hardware_concurrency() ) };
252 std::vector< std::future< void > > futures;
253 futures.reserve( nb_threads );
255 auto action_per_thread = [&action]( index_t start, index_t end ) {
256 for(
auto i :
range( start, end ) )
261 index_t nb_tasks_per_thread{ size / nb_threads };
262 for(
auto thread :
range( nb_threads - 1 ) )
265 futures.emplace_back( std::async( std::launch::async,
266 action_per_thread, start, start + nb_tasks_per_thread ) );
267 start += nb_tasks_per_thread;
269 futures.emplace_back(
270 std::async( std::launch::async, action_per_thread, start, size ) );
271 for(
auto& future : futures )
bool operator!=(const range &) const
void RINGMESH_API print_header_information()
index_t operator*() const
void RINGMESH_API configure_geogram()
void ringmesh_unused(const T &)
std::string string_concatener(const A0 &a0, const A1 &a1, const Args &... args)
const range & begin() const
std::string string_concatener(const A0 &a0)
const range & end() const
virtual ~RINGMeshException()
RINGMeshException(std::string category, const Args &... messages)
const std::string & category() const
Classes to build GeoModel from various inputs.
void RINGMESH_API configure_ringmesh()
void RINGMESH_API default_configure()
void parallel_for(index_t size, const ACTION &action)