diff --git a/Src/Geometry.inl b/Src/Geometry.inl index 5ecc8fa..7ccf116 100644 --- a/Src/Geometry.inl +++ b/Src/Geometry.inl @@ -27,7 +27,9 @@ DAMAGE. */ #include +#ifdef _OPENMP #include +#endif template Real Random(void){return Real(rand())/RAND_MAX;} @@ -430,7 +432,9 @@ template< class Vertex > CoredVectorMeshData< Vertex >::CoredVectorMeshData( void ) : writelock(0) { oocPointIndex = polygonIndex = 0; +#ifdef _OPENMP omp_init_lock(reinterpret_cast(&writelock)); +#endif } template< class Vertex > void CoredVectorMeshData< Vertex >::resetIterator ( void ) { oocPointIndex = polygonIndex = 0; } @@ -456,12 +460,16 @@ int CoredVectorMeshData< Vertex >::addPolygon_s( const std::vector< int >& polyg { size_t sz; //#pragma omp critical (CoredVectorMeshData_addPolygon_s) +#ifdef _OPENMP omp_set_lock(reinterpret_cast(&writelock)); +#endif { sz = polygon.size(); polygons.push_back( polygon ); } +#ifdef _OPENMP omp_unset_lock(reinterpret_cast(&writelock)); +#endif return (int)sz; } template< class Vertex >