Merge branch 'removewinheader' into 'master'

Removewinheader

See merge request ngsolve/netgen!628
This commit is contained in:
Schöberl, Joachim 2024-02-11 11:02:18 +01:00
commit 759b66fb69
13 changed files with 50 additions and 30 deletions

View File

@ -44,7 +44,7 @@ namespace GZSTREAM_NAMESPACE {
// class gzstreambuf: // class gzstreambuf:
// -------------------------------------- // --------------------------------------
gzstreambuf* gzstreambuf::open( const filesystem::path & name, int open_mode) { gzstreambuf* gzstreambuf::open( const std::filesystem::path & name, int open_mode) {
if ( is_open()) if ( is_open())
return (gzstreambuf*)0; return (gzstreambuf*)0;
mode = open_mode; mode = open_mode;
@ -143,7 +143,7 @@ int gzstreambuf::sync() {
// class gzstreambase: // class gzstreambase:
// -------------------------------------- // --------------------------------------
gzstreambase::gzstreambase( const filesystem::path & name, int mode) { gzstreambase::gzstreambase( const std::filesystem::path & name, int mode) {
init( &buf); init( &buf);
open( name.c_str(), mode); open( name.c_str(), mode);
} }
@ -152,7 +152,7 @@ gzstreambase::~gzstreambase() {
buf.close(); buf.close();
} }
void gzstreambase::open( const filesystem::path & name, int open_mode) { void gzstreambase::open( const std::filesystem::path & name, int open_mode) {
if ( ! buf.open( name.c_str(), open_mode)) if ( ! buf.open( name.c_str(), open_mode))
clear( rdstate() | std::ios::badbit); clear( rdstate() | std::ios::badbit);
} }

View File

@ -62,7 +62,7 @@ public:
// ASSERT: both input & output capabilities will not be used together // ASSERT: both input & output capabilities will not be used together
} }
int is_open() { return opened; } int is_open() { return opened; }
gzstreambuf* open( const filesystem::path & name, int open_mode); gzstreambuf* open( const std::filesystem::path & name, int open_mode);
gzstreambuf* close(); gzstreambuf* close();
~gzstreambuf() { close(); } ~gzstreambuf() { close(); }
@ -76,9 +76,9 @@ protected:
gzstreambuf buf; gzstreambuf buf;
public: public:
gzstreambase() { init(&buf); } gzstreambase() { init(&buf); }
gzstreambase( const filesystem::path & name, int open_mode); gzstreambase( const std::filesystem::path & name, int open_mode);
~gzstreambase(); ~gzstreambase();
void open( const filesystem::path & name, int open_mode); void open( const std::filesystem::path & name, int open_mode);
void close(); void close();
gzstreambuf* rdbuf() { return &buf; } gzstreambuf* rdbuf() { return &buf; }
}; };
@ -92,10 +92,10 @@ public:
class DLL_HEADER igzstream : public gzstreambase, public std::istream { class DLL_HEADER igzstream : public gzstreambase, public std::istream {
public: public:
igzstream() : std::istream( &buf) {} igzstream() : std::istream( &buf) {}
igzstream( const filesystem::path & name, int open_mode = std::ios::in) igzstream( const std::filesystem::path & name, int open_mode = std::ios::in)
: gzstreambase( name, open_mode), std::istream( &buf) {} : gzstreambase( name, open_mode), std::istream( &buf) {}
gzstreambuf* rdbuf() { return gzstreambase::rdbuf(); } gzstreambuf* rdbuf() { return gzstreambase::rdbuf(); }
void open( const filesystem::path & name, int open_mode = std::ios::in) { void open( const std::filesystem::path & name, int open_mode = std::ios::in) {
gzstreambase::open( name, open_mode); gzstreambase::open( name, open_mode);
} }
}; };
@ -103,10 +103,10 @@ public:
class DLL_HEADER ogzstream : public gzstreambase, public std::ostream { class DLL_HEADER ogzstream : public gzstreambase, public std::ostream {
public: public:
ogzstream() : std::ostream( &buf) {} ogzstream() : std::ostream( &buf) {}
ogzstream( const filesystem::path & name, int mode = std::ios::out) ogzstream( const std::filesystem::path & name, int mode = std::ios::out)
: gzstreambase( name, mode), std::ostream( &buf) {} : gzstreambase( name, mode), std::ostream( &buf) {}
gzstreambuf* rdbuf() { return gzstreambase::rdbuf(); } gzstreambuf* rdbuf() { return gzstreambase::rdbuf(); }
void open( const filesystem::path & name, int open_mode = std::ios::out) { void open( const std::filesystem::path & name, int open_mode = std::ios::out) {
gzstreambase::open( name, open_mode); gzstreambase::open( name, open_mode);
} }
}; };

View File

@ -45,5 +45,4 @@ namespace netgen
// #include "mpi_interface.hpp" // #include "mpi_interface.hpp"
#include "netgenout.hpp" #include "netgenout.hpp"
#endif #endif

View File

@ -77,8 +77,8 @@ public:
template<typename TFunc> template<typename TFunc>
void ParallelFor( int first, int next, const TFunc & f ) void ParallelFor( int first, int next, const TFunc & f )
{ {
int nthreads = thread::hardware_concurrency(); int nthreads = std::thread::hardware_concurrency();
thread * threads = new thread[nthreads]; std::thread * threads = new std::thread[nthreads];
for (int i=0; i<nthreads; i++) for (int i=0; i<nthreads; i++)
{ {
int myfirst = first + (next-first)*i/nthreads; int myfirst = first + (next-first)*i/nthreads;
@ -97,7 +97,7 @@ void ParallelFor( int first, int next, const TFunc & f )
typedef void (*NgTaskManager)(std::function<void(int,int)>); typedef void (*NgTaskManager)(std::function<void(int,int)>);
typedef void (*NgTracer)(string, bool); // false .. start, true .. stop typedef void (*NgTracer)(std::string, bool); // false .. start, true .. stop
inline void DummyTaskManager (std::function<void(int,int)> func) inline void DummyTaskManager (std::function<void(int,int)> func)
{ {
@ -105,7 +105,7 @@ void ParallelFor( int first, int next, const TFunc & f )
func(1,2); func(1,2);
} }
inline void DummyTracer (string, bool) { ; } inline void DummyTracer (std::string, bool) { ; }
template <typename FUNC> template <typename FUNC>
inline void ParallelFor (NgTaskManager tm, size_t n, FUNC func) inline void ParallelFor (NgTaskManager tm, size_t n, FUNC func)

View File

@ -16,7 +16,7 @@ namespace netgen
templates, global types, defines and variables templates, global types, defines and variables
*/ */
DLL_HEADER extern const string netgen_version; DLL_HEADER extern const std::string netgen_version;
/// The following value may be adapted to the hardware ! /// The following value may be adapted to the hardware !
#ifndef CLOCKS_PER_SEC #ifndef CLOCKS_PER_SEC

View File

@ -5,6 +5,7 @@
#include <mystdlib.h> #include <mystdlib.h>
#include <mydefs.hpp> #include <mydefs.hpp>
# ifdef __APPLE__ # ifdef __APPLE__
#define GL_SILENCE_DEPRECATION #define GL_SILENCE_DEPRECATION
#define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED #define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED

View File

@ -55,18 +55,23 @@ namespace metis { extern "C" {
# ifndef NO_PARALLEL_THREADS # ifndef NO_PARALLEL_THREADS
# ifdef MSVC_EXPRESS # ifdef MSVC_EXPRESS
# else # else
# include <afxwin.h> // # include <afxwin.h>
# include <afxmt.h> // # include <afxmt.h>
# endif // MSVC_EXPRESS # endif // MSVC_EXPRESS
# endif # endif
# include <windows.h> # include <windows.h>
# undef WIN32_LEAN_AND_MEAN # undef WIN32_LEAN_AND_MEAN
# include <winnt.h> // # include <winnt.h>
#else // Not using MC VC++ #else // Not using MC VC++
#endif #endif
using namespace std; // using namespace std;
namespace netgen
{
using namespace std;
}
#endif #endif

View File

@ -9,6 +9,12 @@
#include "../include/opti.hpp" #include "../include/opti.hpp"
/*** Windows headers ***/
#ifdef _MSC_VER
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# undef WIN32_LEAN_AND_MEAN
#endif
namespace netgen namespace netgen
{ {
@ -62,4 +68,6 @@ namespace netgen
#include "paralleltop.hpp" #include "paralleltop.hpp"
#endif #endif

View File

@ -1,4 +1,5 @@
#include <mystdlib.h> #include <mystdlib.h>
#include <myadt.hpp> #include <myadt.hpp>
#include <linalg.hpp> #include <linalg.hpp>
#include <csg.hpp> #include <csg.hpp>
@ -6,7 +7,11 @@
#include <meshing.hpp> #include <meshing.hpp>
#include <inctcl.hpp> #include <inctcl.hpp>
#include <visual.hpp> #include <visual.hpp>
#include <stlgeom.hpp> #include <stlgeom.hpp>

View File

@ -13,13 +13,6 @@ Visualization
*/ */
// #ifdef PARALLEL
// #define PARALLELGL
// #endif
#include "visual_api.hpp" #include "visual_api.hpp"
#include "../include/incopengl.hpp" #include "../include/incopengl.hpp"

View File

@ -1,6 +1,5 @@
#include <mystdlib.h> #include <mystdlib.h>
// #include <incopengl.hpp> // #include <incopengl.hpp>
#include <inctcl.hpp>
#include <myadt.hpp> #include <myadt.hpp>
@ -8,7 +7,7 @@
#include <csg.hpp> #include <csg.hpp>
#include <stlgeom.hpp> #include <stlgeom.hpp>
#include <inctcl.hpp>
// #include <parallel.hpp> // #include <parallel.hpp>
#include <visual.hpp> #include <visual.hpp>

View File

@ -1,8 +1,13 @@
#include <mystdlib.h> #include <mystdlib.h>
#include <inctcl.hpp>
#include <meshing.hpp> #include <meshing.hpp>
#include <inctcl.hpp>
#include <core/ngcore_api.hpp> #include <core/ngcore_api.hpp>
using std::string;
using std::endl;
using std::cout;
using std::cerr;
namespace netgen namespace netgen
{ {
NGCORE_API_EXPORT Flags parameters; NGCORE_API_EXPORT Flags parameters;

View File

@ -33,6 +33,11 @@ using netgen::verbose;
using netgen::NgArray; using netgen::NgArray;
using netgen::RegisterUserFormats; using netgen::RegisterUserFormats;
using std::string;
using std::endl;
using std::cout;
using std::cerr;
using std::ofstream;