mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-26 21:00:34 +05:00
start ngcore, archive in there
This commit is contained in:
parent
7934a34872
commit
7bfc48e8f3
@ -204,7 +204,7 @@ macro(get_dll_from_lib dll_path lib_path)
|
||||
get_filename_component(lib_name ${lib} name)
|
||||
endmacro()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
if(WIN32)
|
||||
get_WIN32_WINNT(ver)
|
||||
add_definitions(-D_WIN32_WINNT=${ver} -DWNT -DWNT_WINDOW -DNOMINMAX)
|
||||
|
@ -1,3 +1,4 @@
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(general)
|
||||
add_subdirectory(gprim)
|
||||
add_subdirectory(linalg)
|
||||
|
8
libsrc/core/CMakeLists.txt
Normal file
8
libsrc/core/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
||||
add_definitions(-DNGINTERFACE_EXPORTS)
|
||||
add_library(ngcore OBJECT basearchive.cpp)
|
||||
|
||||
set_target_properties(ngcore PROPERTIES POSITION_INDEPENDENT_CODE ON )
|
||||
|
||||
install(FILES ngcore.hpp archive.hpp basearchive.hpp
|
||||
DESTINATION ${NG_INSTALL_DIR_INCLUDE}/core COMPONENT netgen_devel
|
||||
)
|
218
libsrc/core/archive.hpp
Normal file
218
libsrc/core/archive.hpp
Normal file
@ -0,0 +1,218 @@
|
||||
#ifndef NG_ARCHIVE_HPP
|
||||
#define NG_ARCHIVE_HPP
|
||||
|
||||
namespace ngcore
|
||||
{
|
||||
// BinaryOutArchive ======================================================================
|
||||
class BinaryOutArchive : public Archive
|
||||
{
|
||||
std::shared_ptr<std::ostream> fout;
|
||||
size_t ptr = 0;
|
||||
enum { BUFFERSIZE = 1024 };
|
||||
char buffer[BUFFERSIZE];
|
||||
public:
|
||||
BinaryOutArchive (std::shared_ptr<std::ostream> afout) : Archive(true), fout(afout) { ; }
|
||||
BinaryOutArchive (std::string filename)
|
||||
: BinaryOutArchive(std::make_shared<std::ofstream>(filename)) {}
|
||||
virtual ~BinaryOutArchive () { FlushBuffer(); }
|
||||
|
||||
virtual Archive & operator & (double & d)
|
||||
{ return Write(d); }
|
||||
virtual Archive & operator & (int & i)
|
||||
{ return Write(i); }
|
||||
virtual Archive & operator & (short & i)
|
||||
{ return Write(i); }
|
||||
virtual Archive & operator & (long & i)
|
||||
{ return Write(i); }
|
||||
virtual Archive & operator & (size_t & i)
|
||||
{ return Write(i); }
|
||||
virtual Archive & operator & (unsigned char & i)
|
||||
{ return Write(i); }
|
||||
virtual Archive & operator & (bool & b)
|
||||
{ return Write(b); }
|
||||
virtual Archive & operator & (std::string & str)
|
||||
{
|
||||
if (ptr > 0) FlushBuffer();
|
||||
int len = str.length();
|
||||
fout->write (reinterpret_cast<char*>(&len), sizeof(int));
|
||||
fout->write (&str[0], len);
|
||||
return *this;
|
||||
}
|
||||
virtual Archive & operator & (char *& str)
|
||||
{
|
||||
if (ptr > 0) FlushBuffer();
|
||||
int len = strlen (str);
|
||||
fout->write (reinterpret_cast<char*>(&len), sizeof(int));
|
||||
fout->write (&str[0], len);
|
||||
return *this;
|
||||
}
|
||||
void FlushBuffer()
|
||||
{
|
||||
if (ptr > 0)
|
||||
{
|
||||
fout->write(&buffer[0], ptr);
|
||||
ptr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename T>
|
||||
Archive & Write (T x)
|
||||
{
|
||||
if (unlikely(ptr > BUFFERSIZE-sizeof(T)))
|
||||
{
|
||||
fout->write(&buffer[0], ptr);
|
||||
* (T*) (&buffer[0]) = x;
|
||||
ptr = sizeof(T);
|
||||
return *this;
|
||||
}
|
||||
* (T*) (&buffer[ptr]) = x;
|
||||
ptr += sizeof(T);
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
// BinaryInArchive ======================================================================
|
||||
class BinaryInArchive : public Archive
|
||||
{
|
||||
std::shared_ptr<std::istream> fin;
|
||||
public:
|
||||
BinaryInArchive (std::shared_ptr<std::istream> afin) : Archive(false), fin(afin) { ; }
|
||||
BinaryInArchive (std::string filename)
|
||||
: BinaryInArchive(std::make_shared<std::ifstream>(filename)) {}
|
||||
|
||||
virtual Archive & operator & (double & d)
|
||||
{ Read(d); return *this; }
|
||||
virtual Archive & operator & (int & i)
|
||||
{ Read(i); return *this; }
|
||||
virtual Archive & operator & (short & i)
|
||||
{ Read(i); return *this; }
|
||||
virtual Archive & operator & (long & i)
|
||||
{ Read(i); return *this; }
|
||||
virtual Archive & operator & (size_t & i)
|
||||
{ Read(i); return *this; }
|
||||
virtual Archive & operator & (unsigned char & i)
|
||||
{ Read(i); return *this; }
|
||||
virtual Archive & operator & (bool & b)
|
||||
{ Read(b); return *this; }
|
||||
virtual Archive & operator & (std::string & str)
|
||||
{
|
||||
int len;
|
||||
Read(len);
|
||||
str.resize(len);
|
||||
fin->read(&str[0], len);
|
||||
return *this;
|
||||
}
|
||||
virtual Archive & operator & (char *& str)
|
||||
{
|
||||
int len;
|
||||
Read(len);
|
||||
str = new char[len+1];
|
||||
fin->read(&str[0], len);
|
||||
str[len] = '\0';
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual Archive & Do (double * d, size_t n)
|
||||
{ fin->read(reinterpret_cast<char*>(d), n*sizeof(double)); return *this; }
|
||||
virtual Archive & Do (int * i, size_t n)
|
||||
{ fin->read(reinterpret_cast<char*>(i), n*sizeof(int)); return *this; }
|
||||
virtual Archive & Do (size_t * i, size_t n)
|
||||
{ fin->read(reinterpret_cast<char*>(i), n*sizeof(size_t)); return *this; }
|
||||
|
||||
private:
|
||||
template<typename T>
|
||||
inline void Read(T& val)
|
||||
{ fin->read(reinterpret_cast<char*>(&val), sizeof(T)); }
|
||||
};
|
||||
|
||||
// TextOutArchive ======================================================================
|
||||
class TextOutArchive : public Archive
|
||||
{
|
||||
std::shared_ptr<std::ostream> fout;
|
||||
public:
|
||||
TextOutArchive (std::shared_ptr<std::ostream> afout) : Archive(true), fout(afout) { }
|
||||
TextOutArchive (std::string filename) :
|
||||
TextOutArchive(std::make_shared<std::ofstream>(filename.c_str())) { }
|
||||
|
||||
using Archive::operator&;
|
||||
virtual Archive & operator & (double & d)
|
||||
{ *fout << d << '\n'; return *this; }
|
||||
virtual Archive & operator & (int & i)
|
||||
{ *fout << i << '\n'; return *this; }
|
||||
virtual Archive & operator & (short & i)
|
||||
{ *fout << i << '\n'; return *this; }
|
||||
virtual Archive & operator & (long & i)
|
||||
{ *fout << i << '\n'; return *this; }
|
||||
virtual Archive & operator & (size_t & i)
|
||||
{ *fout << i << '\n'; return *this; }
|
||||
virtual Archive & operator & (unsigned char & i)
|
||||
{ *fout << int(i) << '\n'; return *this; }
|
||||
virtual Archive & operator & (bool & b)
|
||||
{ *fout << (b ? 't' : 'f') << '\n'; return *this; }
|
||||
virtual Archive & operator & (std::string & str)
|
||||
{
|
||||
int len = str.length();
|
||||
*fout << len << '\n';
|
||||
fout->write(&str[0], len);
|
||||
*fout << '\n';
|
||||
return *this;
|
||||
}
|
||||
virtual Archive & operator & (char *& str)
|
||||
{
|
||||
int len = strlen (str);
|
||||
*fout << len << '\n';
|
||||
fout->write (&str[0], len);
|
||||
*fout << '\n';
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
// TextInArchive ======================================================================
|
||||
class TextInArchive : public Archive
|
||||
{
|
||||
std::shared_ptr<std::istream> fin;
|
||||
public:
|
||||
TextInArchive (std::shared_ptr<std::istream> afin) : Archive(false), fin(afin) { ; }
|
||||
TextInArchive (std::string filename)
|
||||
: TextInArchive(std::make_shared<std::ifstream>(filename)) {}
|
||||
|
||||
using Archive::operator&;
|
||||
virtual Archive & operator & (double & d)
|
||||
{ *fin >> d; return *this; }
|
||||
virtual Archive & operator & (int & i)
|
||||
{ *fin >> i; return *this; }
|
||||
virtual Archive & operator & (short & i)
|
||||
{ *fin >> i; return *this; }
|
||||
virtual Archive & operator & (long & i)
|
||||
{ *fin >> i; return *this; }
|
||||
virtual Archive & operator & (size_t & i)
|
||||
{ *fin >> i; return *this; }
|
||||
virtual Archive & operator & (unsigned char & i)
|
||||
{ int _i; *fin >> _i; i = _i; return *this; }
|
||||
virtual Archive & operator & (bool & b)
|
||||
{ char c; *fin >> c; b = (c=='t'); return *this; }
|
||||
virtual Archive & operator & (std::string & str)
|
||||
{
|
||||
int len;
|
||||
*fin >> len;
|
||||
char ch;
|
||||
fin->get(ch); // '\n'
|
||||
str.resize(len);
|
||||
fin->get(&str[0], len+1, '\0');
|
||||
return *this;
|
||||
}
|
||||
virtual Archive & operator & (char *& str)
|
||||
{
|
||||
int len;
|
||||
*fin >> len;
|
||||
char ch;
|
||||
fin->get(ch); // '\n'
|
||||
str = new char[len+1];
|
||||
fin->get(&str[0], len, '\0');
|
||||
str[len] = 0;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif // NG_ARCHIVE_HPP
|
11
libsrc/core/basearchive.cpp
Normal file
11
libsrc/core/basearchive.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
#include "ngcore.hpp"
|
||||
|
||||
namespace ngcore
|
||||
{
|
||||
std::map<std::string, std::function<void*()>>& GetArchiveRegister()
|
||||
{
|
||||
static std::map<std::string, std::function<void*()>> type_register = {};
|
||||
return type_register;
|
||||
}
|
||||
}
|
266
libsrc/core/basearchive.hpp
Normal file
266
libsrc/core/basearchive.hpp
Normal file
@ -0,0 +1,266 @@
|
||||
#ifndef NG_BASEARCHIVE_HPP
|
||||
#define NG_BASEARCHIVE_HPP
|
||||
|
||||
namespace ngcore
|
||||
{
|
||||
class Archive;
|
||||
|
||||
// Type trait to check if a class implements a 'void DoArchive(Archive&)' function
|
||||
template<typename T>
|
||||
struct has_DoArchive
|
||||
{
|
||||
private:
|
||||
template<typename T2>
|
||||
static constexpr auto check(T2*) ->
|
||||
typename std::is_same<decltype(std::declval<T2>().DoArchive(std::declval<Archive&>())),void>::type;
|
||||
template<typename>
|
||||
static constexpr std::false_type check(...);
|
||||
typedef decltype(check<T>(0)) type;
|
||||
public:
|
||||
static constexpr bool value = type::value;
|
||||
};
|
||||
|
||||
std::map<std::string, std::function<void*()>>& GetArchiveRegister();
|
||||
|
||||
// Base Archive class
|
||||
class Archive
|
||||
{
|
||||
bool is_output;
|
||||
// how many different shared_ptr/pointer have been (un)archived
|
||||
int shared_ptr_count, ptr_count;
|
||||
// maps for archived shared pointers and pointers
|
||||
std::map<void*, int> shared_ptr2nr, ptr2nr;
|
||||
// vectors for storing the unarchived (shared) pointers
|
||||
std::vector<std::shared_ptr<void>> nr2shared_ptr;
|
||||
std::vector<void*> nr2ptr;
|
||||
public:
|
||||
Archive (bool ais_output) : is_output(ais_output), shared_ptr_count(0), ptr_count(0) { ; }
|
||||
virtual ~Archive() { ; }
|
||||
|
||||
bool Output () { return is_output; }
|
||||
bool Input () { return !is_output; }
|
||||
|
||||
// Pure virtual functions that have to be implemented by In-/OutArchive
|
||||
virtual Archive & operator & (double & d) = 0;
|
||||
virtual Archive & operator & (int & i) = 0;
|
||||
virtual Archive & operator & (long & i) = 0;
|
||||
virtual Archive & operator & (size_t & i) = 0;
|
||||
virtual Archive & operator & (short & i) = 0;
|
||||
virtual Archive & operator & (unsigned char & i) = 0;
|
||||
virtual Archive & operator & (bool & b) = 0;
|
||||
virtual Archive & operator & (std::string & str) = 0;
|
||||
virtual Archive & operator & (char *& str) = 0;
|
||||
|
||||
|
||||
// Archive std classes ================================================
|
||||
template<typename T>
|
||||
Archive& operator & (std::complex<T>& c)
|
||||
{
|
||||
if(is_output)
|
||||
(*this) << c.real() << c.imag();
|
||||
else
|
||||
{
|
||||
T tmp;
|
||||
(*this) & tmp;
|
||||
c.real(tmp);
|
||||
(*this) & tmp;
|
||||
c.imag(tmp);
|
||||
}
|
||||
return (*this);
|
||||
}
|
||||
template<typename T>
|
||||
Archive& operator & (std::vector<T>& v)
|
||||
{
|
||||
size_t size;
|
||||
if(is_output)
|
||||
size = v.size();
|
||||
(*this) & size;
|
||||
if(!is_output)
|
||||
v.reserve(size);
|
||||
Do(&v[0], size);
|
||||
return (*this);
|
||||
}
|
||||
// Archive arrays =====================================================
|
||||
template <typename T>
|
||||
Archive & Do (T * data, size_t n)
|
||||
{ for (size_t j = 0; j < n; j++) { (*this) & data[j]; }; return *this; };
|
||||
|
||||
virtual Archive & Do (double * d, size_t n)
|
||||
{ for (size_t j = 0; j < n; j++) { (*this) & d[j]; }; return *this; };
|
||||
|
||||
virtual Archive & Do (int * i, size_t n)
|
||||
{ for (size_t j = 0; j < n; j++) { (*this) & i[j]; }; return *this; };
|
||||
|
||||
virtual Archive & Do (long * i, size_t n)
|
||||
{ for (size_t j = 0; j < n; j++) { (*this) & i[j]; }; return *this; };
|
||||
|
||||
virtual Archive & Do (size_t * i, size_t n)
|
||||
{ for (size_t j = 0; j < n; j++) { (*this) & i[j]; }; return *this; };
|
||||
|
||||
virtual Archive & Do (short * i, size_t n)
|
||||
{ for (size_t j = 0; j < n; j++) { (*this) & i[j]; }; return *this; };
|
||||
|
||||
virtual Archive & Do (unsigned char * i, size_t n)
|
||||
{ for (size_t j = 0; j < n; j++) { (*this) & i[j]; }; return *this; };
|
||||
|
||||
virtual Archive & Do (bool * b, size_t n)
|
||||
{ for (size_t j = 0; j < n; j++) { (*this) & b[j]; }; return *this; };
|
||||
|
||||
// Archive a class implementing a (void DoArchive(Archive&)) method =======
|
||||
template<typename T, typename=std::enable_if_t<has_DoArchive<T>::value>>
|
||||
Archive& operator & (T& val)
|
||||
{
|
||||
val.DoArchive(*this); return *this;
|
||||
}
|
||||
|
||||
// Archive shared_ptrs =================================================
|
||||
template <typename T>
|
||||
Archive& operator & (std::shared_ptr<T>& ptr)
|
||||
{
|
||||
if(Output())
|
||||
{
|
||||
// save -2 for nullptr
|
||||
if(!ptr)
|
||||
return (*this) << -2;
|
||||
auto pos = shared_ptr2nr.find((void*) ptr.get());
|
||||
// if not found store -1 and the pointer
|
||||
if(pos == shared_ptr2nr.end())
|
||||
{
|
||||
shared_ptr2nr[(void*) ptr.get()] = shared_ptr_count++;
|
||||
auto p = ptr.get();
|
||||
return (*this) << -1 & p;
|
||||
}
|
||||
// if found store the position
|
||||
return (*this) << pos->second;
|
||||
}
|
||||
else // Input
|
||||
{
|
||||
int nr;
|
||||
(*this) & nr;
|
||||
if(nr == -2)
|
||||
ptr = nullptr;
|
||||
else if (nr == -1)
|
||||
{
|
||||
T* p;
|
||||
(*this) & p;
|
||||
ptr = std::shared_ptr<T>(p);
|
||||
nr2shared_ptr.push_back(ptr);
|
||||
}
|
||||
else
|
||||
ptr = std::reinterpret_pointer_cast<T>(nr2shared_ptr[nr]);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Archive pointers =======================================================
|
||||
template <typename T>
|
||||
Archive & operator& (T *& p)
|
||||
{
|
||||
if (Output())
|
||||
{
|
||||
// if the pointer is null store -2
|
||||
if (!p)
|
||||
{
|
||||
int m2 = -2;
|
||||
(*this) & m2;
|
||||
return *this;
|
||||
}
|
||||
auto pos = ptr2nr.find( (void*) p);
|
||||
// if the pointer is not found in the map create a new entry
|
||||
if (pos == ptr2nr.end())
|
||||
{
|
||||
ptr2nr[(void*) p] = ptr_count++;
|
||||
if(typeid(*p) == typeid(T))
|
||||
if constexpr (std::is_constructible<T>::value)
|
||||
{
|
||||
return (*this) << -1 & (*p);
|
||||
}
|
||||
else
|
||||
throw std::runtime_error(std::string("Archive error: Class ") +
|
||||
typeid(*p).name() + " does not provide a default constructor!");
|
||||
else
|
||||
{
|
||||
// We want this special behaviour only for our classes that implement DoArchive
|
||||
if constexpr(has_DoArchive<T>::value)
|
||||
{
|
||||
if(GetArchiveRegister().count(typeid(*p).name()) == 0)
|
||||
throw std::runtime_error(std::string("Archive error: Polimorphic type ")
|
||||
+ typeid(*p).name()
|
||||
+ " not registered for archive");
|
||||
else
|
||||
return (*this) << -3 << std::string(typeid(*p).name()) & (*p);
|
||||
}
|
||||
else
|
||||
throw std::runtime_error(std::string("Archive error: Class ")
|
||||
+ typeid(*p).name()
|
||||
+ " is polymorphic but not registered for archiving");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
(*this) & pos->second;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int nr;
|
||||
(*this) & nr;
|
||||
// cout << "in, got nr " << nr << endl;
|
||||
if (nr == -2)
|
||||
{
|
||||
p = nullptr;
|
||||
}
|
||||
else if (nr == -1)
|
||||
{
|
||||
if constexpr (std::is_constructible<T>::value)
|
||||
{
|
||||
p = new T;
|
||||
// cout << "create new ptr, p = " << p << endl;
|
||||
(*this) & *p;
|
||||
nr2ptr.push_back(p);
|
||||
}
|
||||
else
|
||||
throw std::runtime_error("Class isn't registered properly");
|
||||
|
||||
}
|
||||
else if(nr == -3)
|
||||
{
|
||||
// We want this special behaviour only for our classes that implement DoArchive
|
||||
if constexpr(has_DoArchive<T>::value)
|
||||
{
|
||||
std::string name;
|
||||
(*this) & name;
|
||||
p = reinterpret_cast<T*>(GetArchiveRegister()[name]());
|
||||
nr2ptr.push_back(p);
|
||||
}
|
||||
else
|
||||
throw std::runtime_error("Class isn't registered properly");
|
||||
}
|
||||
else
|
||||
{
|
||||
p = (T*)nr2ptr[nr];
|
||||
// cout << "reuse ptr " << nr << ": " << p << endl;
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Write a read only variable
|
||||
template <typename T>
|
||||
Archive & operator << (const T & t)
|
||||
{
|
||||
T ht(t);
|
||||
(*this) & ht;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
void RegisterClassForArchive()
|
||||
{
|
||||
static_assert(std::is_constructible_v<T>, "Class registered for archive must be default constructible");
|
||||
GetArchiveRegister()[std::string(typeid(T).name())] = []() -> void* { return new T; };
|
||||
}
|
||||
}
|
||||
|
||||
#endif // NG_BASEARCHIVE_HPP
|
30
libsrc/core/ngcore.hpp
Normal file
30
libsrc/core/ngcore.hpp
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef NG_CORE_HPP
|
||||
#define NG_CORE_HPP
|
||||
|
||||
// std includes
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <type_traits>
|
||||
#include <functional>
|
||||
#include <stdexcept>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cstring>
|
||||
#include <complex>
|
||||
|
||||
|
||||
#if defined(__GNUC__)
|
||||
inline bool likely (bool x) { return __builtin_expect((x), true); }
|
||||
inline bool unlikely (bool x) { return __builtin_expect((x), false); }
|
||||
#else
|
||||
inline bool likely (bool x) { return x; }
|
||||
inline bool unlikely (bool x) { return x; }
|
||||
#endif
|
||||
|
||||
// own includes
|
||||
#include "basearchive.hpp"
|
||||
#include "archive.hpp"
|
||||
|
||||
#endif // NG_CORE_HPP
|
@ -324,6 +324,12 @@ namespace netgen
|
||||
}
|
||||
|
||||
|
||||
void CSGeometry :: DoArchive(Archive& archive)
|
||||
{
|
||||
archive & surfaces & surf2prim & solids & toplevelobjects & userpoints & userpoints_ref_factor
|
||||
& identpoints & boundingbox & identicsurfaces & isidenticto & ideps
|
||||
& filename & spline_surfaces; // TODO: & splinecurves2d & splinecurves3d
|
||||
}
|
||||
|
||||
void CSGeometry :: SaveSurfaces (ostream & out) const
|
||||
{
|
||||
|
@ -124,6 +124,11 @@ namespace netgen
|
||||
UserPoint() = default;
|
||||
UserPoint (Point<3> p, int _index) : Point<3>(p), index(_index) { ; }
|
||||
int GetIndex() const { return index; }
|
||||
void DoArchive(Archive& archive)
|
||||
{
|
||||
archive & index;
|
||||
Point<3>::DoArchive(archive);
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
@ -198,6 +203,8 @@ namespace netgen
|
||||
void SetSplineCurve (const char * name, SplineGeometry<3> * spl);
|
||||
const SplineGeometry<2> * GetSplineCurve2d (const string & name) const;
|
||||
const SplineGeometry<3> * GetSplineCurve3d (const string & name) const;
|
||||
|
||||
void DoArchive(Archive& archive);
|
||||
|
||||
|
||||
void SetFlags (const char * solidname, const Flags & flags);
|
||||
|
@ -360,37 +360,32 @@ However, when r = 0, the top part becomes a point(tip) and meshing fails!
|
||||
|
||||
py::class_<CSGeometry, NetgenGeometry, shared_ptr<CSGeometry>> (m, "CSGeometry")
|
||||
.def(py::init<>())
|
||||
.def("__init__",
|
||||
[](CSGeometry *instance, const string & filename)
|
||||
{
|
||||
cout << "load geometry";
|
||||
ifstream ist(filename);
|
||||
ParseCSG(ist, instance);
|
||||
instance -> FindIdenticSurfaces(1e-8 * instance->MaxSize());
|
||||
})
|
||||
.def("__init__",
|
||||
[](CSGeometry *instance, const py::list & solidlist)
|
||||
{
|
||||
cout << "csg from list";
|
||||
new (instance) CSGeometry();
|
||||
for (int i = 0; i < len(solidlist); i++)
|
||||
{
|
||||
py::object obj = solidlist[i];
|
||||
cout << "obj " << i << endl;
|
||||
|
||||
py::extract<shared_ptr<SPSolid>> solid(solidlist[i]);
|
||||
if(solid.check())
|
||||
{
|
||||
cout << "its a solid" << endl;
|
||||
solid()->AddSurfaces (*instance);
|
||||
solid()->GiveUpOwner();
|
||||
int tlonr = instance->SetTopLevelObject (solid()->GetSolid());
|
||||
instance->GetTopLevelObject(tlonr) -> SetMaterial(solid()->GetMaterial());
|
||||
}
|
||||
}
|
||||
instance -> FindIdenticSurfaces(1e-8 * instance->MaxSize());
|
||||
})
|
||||
|
||||
.def(py::init([](const string& filename)
|
||||
{
|
||||
ifstream ist (filename);
|
||||
auto geo = make_shared<CSGeometry>();
|
||||
ParseCSG(ist, geo.get());
|
||||
geo->FindIdenticSurfaces(1e-8 * geo->MaxSize());
|
||||
return geo;
|
||||
}), py::arg("filename"))
|
||||
.def(py::pickle(
|
||||
[](CSGeometry& self)
|
||||
{
|
||||
stringstream ss;
|
||||
self.Save(ss);
|
||||
cout << "pickle = " << endl << ss.str() << endl;
|
||||
return py::make_tuple(ss.str());
|
||||
},
|
||||
[](py::tuple state)
|
||||
{
|
||||
auto geo = make_shared<CSGeometry>();
|
||||
auto val = py::cast<string>(state[0]);
|
||||
cout << "unpickle = " << endl << val << endl;
|
||||
stringstream ss(py::cast<string>(state[0]));
|
||||
// geo->Load(ss);
|
||||
// geo->FindIdenticSurfaces(1e-8 * geo->MaxSize());
|
||||
return geo;
|
||||
}))
|
||||
.def("Save", FunctionPointer([] (CSGeometry & self, string filename)
|
||||
{
|
||||
cout << "save geometry to file " << filename << endl;
|
||||
|
@ -63,6 +63,12 @@ namespace netgen
|
||||
//@}
|
||||
public:
|
||||
|
||||
virtual void DoArchive(Archive& archive)
|
||||
{
|
||||
archive & inverse & maxh & name & bcprop & bcname
|
||||
& p1 & p2 & ex & ey & ez;
|
||||
}
|
||||
|
||||
void SetName (const char * aname);
|
||||
const char * Name () const { return name; }
|
||||
|
||||
@ -234,6 +240,9 @@ namespace netgen
|
||||
|
||||
class Primitive
|
||||
{
|
||||
protected:
|
||||
Array<int> surfaceids;
|
||||
Array<int> surfaceactive;
|
||||
|
||||
public:
|
||||
|
||||
@ -241,6 +250,10 @@ namespace netgen
|
||||
|
||||
virtual ~Primitive();
|
||||
|
||||
virtual void DoArchive(Archive& archive)
|
||||
{
|
||||
archive & surfaceids & surfaceactive;
|
||||
}
|
||||
|
||||
/*
|
||||
Check, whether box intersects solid defined by surface.
|
||||
@ -299,9 +312,6 @@ namespace netgen
|
||||
virtual Surface & GetSurface (int i = 0) = 0;
|
||||
virtual const Surface & GetSurface (int i = 0) const = 0;
|
||||
|
||||
Array<int> surfaceids;
|
||||
Array<int> surfaceactive;
|
||||
|
||||
int GetSurfaceId (int i = 0) const;
|
||||
void SetSurfaceId (int i, int id);
|
||||
int SurfaceActive (int i) const { return surfaceactive[i]; }
|
||||
@ -329,6 +339,12 @@ namespace netgen
|
||||
OneSurfacePrimitive();
|
||||
~OneSurfacePrimitive();
|
||||
|
||||
virtual void DoArchive(Archive& archive)
|
||||
{
|
||||
Surface::DoArchive(archive);
|
||||
Primitive::DoArchive(archive);
|
||||
}
|
||||
|
||||
virtual INSOLID_TYPE PointInSolid (const Point<3> & p,
|
||||
double eps) const;
|
||||
virtual INSOLID_TYPE VecInSolid (const Point<3> & p,
|
||||
|
@ -11,7 +11,7 @@ set_target_properties( gen PROPERTIES POSITION_INDEPENDENT_CODE ON )
|
||||
install( FILES ngexception.hpp DESTINATION ${NG_INSTALL_DIR_INCLUDE} COMPONENT netgen_devel )
|
||||
|
||||
install(FILES
|
||||
archive_base.hpp array.hpp autodiff.hpp autoptr.hpp bitarray.hpp
|
||||
array.hpp autodiff.hpp autoptr.hpp bitarray.hpp
|
||||
dynamicmem.hpp flags.hpp hashtabl.hpp mpi_interface.hpp myadt.hpp
|
||||
ngsimd.hpp mystring.hpp netgenout.hpp ngexception.hpp ngpython.hpp
|
||||
optmem.hpp parthreads.hpp profiler.hpp seti.hpp sort.hpp
|
||||
|
@ -1,144 +0,0 @@
|
||||
#ifndef NGS_ARCHIVE_BASE
|
||||
#define NGS_ARCHIVE_BASE
|
||||
|
||||
// copied from netgen
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
namespace ngstd
|
||||
{
|
||||
|
||||
class Archive
|
||||
{
|
||||
bool is_output;
|
||||
public:
|
||||
Archive (bool ais_output) : is_output(ais_output) { ; }
|
||||
virtual ~Archive() { ; }
|
||||
|
||||
bool Output () { return is_output; }
|
||||
bool Input () { return !is_output; }
|
||||
|
||||
virtual Archive & operator & (double & d) = 0;
|
||||
virtual Archive & operator & (int & i) = 0;
|
||||
virtual Archive & operator & (long & i) = 0;
|
||||
virtual Archive & operator & (size_t & i) = 0;
|
||||
virtual Archive & operator & (short & i) = 0;
|
||||
virtual Archive & operator & (unsigned char & i) = 0;
|
||||
virtual Archive & operator & (bool & b) = 0;
|
||||
virtual Archive & operator & (string & str) = 0;
|
||||
virtual Archive & operator & (char *& str) = 0;
|
||||
|
||||
template <typename T>
|
||||
Archive & Do (T * data, size_t n)
|
||||
{ for (size_t j = 0; j < n; j++) { (*this) & data[j]; }; return *this; };
|
||||
|
||||
|
||||
virtual Archive & Do (double * d, size_t n)
|
||||
{ for (size_t j = 0; j < n; j++) { (*this) & d[j]; }; return *this; };
|
||||
|
||||
virtual Archive & Do (int * i, size_t n)
|
||||
{ for (size_t j = 0; j < n; j++) { (*this) & i[j]; }; return *this; };
|
||||
|
||||
virtual Archive & Do (long * i, size_t n)
|
||||
{ for (size_t j = 0; j < n; j++) { (*this) & i[j]; }; return *this; };
|
||||
|
||||
virtual Archive & Do (size_t * i, size_t n)
|
||||
{ for (size_t j = 0; j < n; j++) { (*this) & i[j]; }; return *this; };
|
||||
|
||||
virtual Archive & Do (short * i, size_t n)
|
||||
{ for (size_t j = 0; j < n; j++) { (*this) & i[j]; }; return *this; };
|
||||
|
||||
virtual Archive & Do (unsigned char * i, size_t n)
|
||||
{ for (size_t j = 0; j < n; j++) { (*this) & i[j]; }; return *this; };
|
||||
|
||||
virtual Archive & Do (bool * b, size_t n)
|
||||
{ for (size_t j = 0; j < n; j++) { (*this) & b[j]; }; return *this; };
|
||||
|
||||
|
||||
// nvirtual Archive & Do (string * str, size_t n)
|
||||
// { for (size_t j = 0; j < n; j++) { (*this) & str[j]; }; return *this; };
|
||||
// virtual Archive & operator & (char *& str) = 0;
|
||||
|
||||
|
||||
// archive a pointer ...
|
||||
|
||||
int cnt = 0;
|
||||
std::map<void*,int> ptr2nr;
|
||||
std::vector<void*> nr2ptr;
|
||||
|
||||
/*
|
||||
// necessary for msvc ???
|
||||
Archive & operator& (string* & ps)
|
||||
{
|
||||
return operator&<string> (ps);
|
||||
}
|
||||
*/
|
||||
|
||||
template <typename T>
|
||||
Archive & operator& (T *& p)
|
||||
{
|
||||
if (Output())
|
||||
{
|
||||
if (!p)
|
||||
{
|
||||
int m2 = -2;
|
||||
(*this) & m2;
|
||||
return *this;
|
||||
}
|
||||
auto pos = ptr2nr.find( (void*) p);
|
||||
if (pos == ptr2nr.end())
|
||||
{
|
||||
ptr2nr[p] = cnt;
|
||||
int m1 = -1;
|
||||
(*this) & m1;
|
||||
cnt++;
|
||||
(*this) & (*p);
|
||||
}
|
||||
else
|
||||
{
|
||||
(*this) & pos->second;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int nr;
|
||||
(*this) & nr;
|
||||
// cout << "in, got nr " << nr << endl;
|
||||
if (nr == -2)
|
||||
{
|
||||
p = nullptr;
|
||||
}
|
||||
else if (nr == -1)
|
||||
{
|
||||
p = new T;
|
||||
// cout << "create new ptr, p = " << p << endl;
|
||||
(*this) & *p;
|
||||
nr2ptr.push_back(p);
|
||||
}
|
||||
else
|
||||
{
|
||||
p = (T*)nr2ptr[nr];
|
||||
// cout << "reuse ptr " << nr << ": " << p << endl;
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T>
|
||||
Archive & operator << (const T & t)
|
||||
{
|
||||
T ht(t);
|
||||
(*this) & ht;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
@ -400,6 +400,19 @@ namespace netgen
|
||||
ownmem = false;
|
||||
return data;
|
||||
}
|
||||
|
||||
void DoArchive(Archive& archive)
|
||||
{
|
||||
if(archive.Output())
|
||||
archive << size;
|
||||
else
|
||||
{
|
||||
size_t s;
|
||||
archive & s;
|
||||
SetSize(s);
|
||||
}
|
||||
archive.Do(data, size);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@ -778,30 +791,6 @@ namespace netgen
|
||||
if(in2.Contains(in1[i]) && in3.Contains(in1[i]))
|
||||
out.Append(in1[i]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, int BASE, typename TIND>
|
||||
ngstd::Archive & operator & (ngstd::Archive & archive, Array<T,BASE,TIND> & a)
|
||||
{
|
||||
if (archive.Output())
|
||||
archive << a.Size();
|
||||
else
|
||||
{
|
||||
size_t size;
|
||||
archive & size;
|
||||
a.SetSize (size);
|
||||
}
|
||||
|
||||
/*
|
||||
for (auto & ai : a)
|
||||
archive & ai;
|
||||
*/
|
||||
archive.Do (&a[BASE], a.Size());
|
||||
return archive;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -259,20 +259,13 @@ public:
|
||||
const T & GetData (const Iterator & it) const
|
||||
{ return cont[it.BagNr()][it.Pos()]; }
|
||||
|
||||
ngstd::Archive & DoArchive (ngstd::Archive & ar)
|
||||
void DoArchive (Archive & ar)
|
||||
{
|
||||
ar & hash & cont;
|
||||
return ar;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
inline ngstd::Archive & operator & (ngstd::Archive & archive, INDEX_2_HASHTABLE<T> & mp)
|
||||
{ return mp.DoArchive(archive); }
|
||||
|
||||
|
||||
|
||||
template <typename T>
|
||||
inline ostream & operator<< (ostream & ost, const INDEX_2_HASHTABLE<T> & ht)
|
||||
{
|
||||
@ -436,24 +429,15 @@ public:
|
||||
{ return cont[it.BagNr()][it.Pos()]; }
|
||||
|
||||
|
||||
ngstd::Archive & DoArchive (ngstd::Archive & ar)
|
||||
void DoArchive (Archive & ar)
|
||||
{
|
||||
ar & hash & cont;
|
||||
return ar;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
template <typename T>
|
||||
inline ngstd::Archive & operator & (ngstd::Archive & archive, INDEX_3_HASHTABLE<T> & mp)
|
||||
{ return mp.DoArchive(archive); }
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T>
|
||||
inline ostream & operator<< (ostream & ost, const INDEX_3_HASHTABLE<T> & ht)
|
||||
{
|
||||
|
@ -17,11 +17,15 @@
|
||||
#include "../include/mydefs.hpp"
|
||||
|
||||
|
||||
#include "../core/ngcore.hpp"
|
||||
namespace netgen
|
||||
{
|
||||
using namespace ngcore;
|
||||
}
|
||||
#include "ngexception.hpp"
|
||||
#include "parthreads.hpp"
|
||||
// #include "moveablemem.hpp"
|
||||
#include "dynamicmem.hpp"
|
||||
#include "archive_base.hpp"
|
||||
|
||||
#include "template.hpp"
|
||||
#include "array.hpp"
|
||||
|
@ -69,6 +69,8 @@ public:
|
||||
/// Deletes symboltable
|
||||
inline void DeleteAll ();
|
||||
|
||||
void DoArchive(Archive& archive) { archive & names & data;}
|
||||
|
||||
inline T & operator[] (int i)
|
||||
{ return data[i]; }
|
||||
inline const T & operator[] (int i) const
|
||||
|
@ -213,7 +213,7 @@ namespace netgen
|
||||
|
||||
|
||||
|
||||
ngstd::Archive & BASE_TABLE :: DoArchive (ngstd::Archive & ar, int elemsize)
|
||||
void BASE_TABLE :: DoArchive (Archive & ar, int elemsize)
|
||||
{
|
||||
if (ar.Output())
|
||||
{
|
||||
@ -248,7 +248,6 @@ namespace netgen
|
||||
cnt += data[i].size*elemsize;
|
||||
}
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
|
||||
|
@ -89,7 +89,7 @@ public:
|
||||
|
||||
void SetElementSizesToMaxSizes ();
|
||||
|
||||
ngstd::Archive & DoArchive (ngstd::Archive & ar, int elemsize);
|
||||
void DoArchive (Archive & ar, int elemsize);
|
||||
};
|
||||
|
||||
|
||||
@ -238,21 +238,13 @@ public:
|
||||
return FlatArray<T> (data[i-BASE].size, (T*)data[i-BASE].col);
|
||||
}
|
||||
|
||||
ngstd::Archive & DoArchive (ngstd::Archive & ar)
|
||||
void DoArchive (Archive & ar)
|
||||
{
|
||||
return BASE_TABLE::DoArchive(ar, sizeof(T));
|
||||
BASE_TABLE::DoArchive(ar, sizeof(T));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
template <typename T, int BASE>
|
||||
inline ngstd::Archive & operator & (ngstd::Archive & archive, TABLE<T,BASE> & mp)
|
||||
{ return mp.DoArchive(archive); }
|
||||
|
||||
|
||||
|
||||
|
||||
template <class T, int BASE>
|
||||
inline ostream & operator<< (ostream & ost, const TABLE<T,BASE> & table)
|
||||
{
|
||||
|
@ -64,6 +64,12 @@ namespace netgen
|
||||
const T & operator() (int i) const { return x[i]; }
|
||||
|
||||
operator const T* () const { return x; }
|
||||
|
||||
void DoArchive(Archive& archive)
|
||||
{
|
||||
for(int i=0; i<D; i++)
|
||||
archive & x[i];
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T>
|
||||
@ -117,6 +123,12 @@ namespace netgen
|
||||
|
||||
operator const T* () const { return x; }
|
||||
|
||||
void DoArchive(Archive& archive)
|
||||
{
|
||||
for(int i=0; i<D; i++)
|
||||
archive & x[i];
|
||||
}
|
||||
|
||||
T Length () const
|
||||
{
|
||||
T l = 0;
|
||||
@ -324,6 +336,9 @@ namespace netgen
|
||||
pmax(i) += dist;
|
||||
}
|
||||
}
|
||||
|
||||
void DoArchive(Archive& archive)
|
||||
{ archive & pmin & pmax; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -230,7 +230,7 @@ namespace netgen
|
||||
void LoadMesh (istream & str);
|
||||
void SaveMesh (ostream & str) const;
|
||||
void UpdateTopology ();
|
||||
void DoArchive (ngstd::Archive & archive);
|
||||
void DoArchive (Archive & archive);
|
||||
|
||||
virtual ~Ngx_Mesh();
|
||||
|
||||
|
@ -69,7 +69,7 @@ namespace netgen
|
||||
mesh -> Save (ost);
|
||||
}
|
||||
|
||||
void Ngx_Mesh :: DoArchive (ngstd::Archive & archive)
|
||||
void Ngx_Mesh :: DoArchive (Archive & archive)
|
||||
{
|
||||
if (archive.Input()) mesh = make_shared<Mesh>();
|
||||
mesh->DoArchive(archive);
|
||||
|
@ -4,6 +4,7 @@ if(NOT WIN32)
|
||||
$<TARGET_OBJECTS:la>
|
||||
$<TARGET_OBJECTS:gprim>
|
||||
$<TARGET_OBJECTS:gen>
|
||||
$<TARGET_OBJECTS:ngcore>
|
||||
)
|
||||
endif(NOT WIN32)
|
||||
|
||||
|
@ -1304,7 +1304,7 @@ namespace netgen
|
||||
}
|
||||
|
||||
|
||||
void Mesh :: DoArchive (ngstd::Archive & archive)
|
||||
void Mesh :: DoArchive (Archive & archive)
|
||||
{
|
||||
archive & dimension;
|
||||
archive & points;
|
||||
|
@ -517,7 +517,7 @@ namespace netgen
|
||||
DLL_HEADER void Merge (const string & filename, const int surfindex_offset = 0);
|
||||
|
||||
|
||||
DLL_HEADER void DoArchive (ngstd::Archive & archive);
|
||||
DLL_HEADER void DoArchive (Archive & archive);
|
||||
///
|
||||
DLL_HEADER void ImproveMesh (const MeshingParameters & mp, OPTIMIZEGOAL goal = OPT_QUALITY);
|
||||
|
||||
|
@ -148,9 +148,9 @@ namespace netgen
|
||||
return *this;
|
||||
}
|
||||
|
||||
ngstd::Archive & Segment :: DoArchive (ngstd::Archive & ar)
|
||||
void Segment :: DoArchive (Archive & ar)
|
||||
{
|
||||
return ar & pnums[0] & pnums[1] & pnums[2]
|
||||
ar & pnums[0] & pnums[1] & pnums[2]
|
||||
& edgenr & singedge_left & singedge_right
|
||||
& si & cd2i & domin & domout & tlosurf
|
||||
& surfnr1 & surfnr2
|
||||
@ -2427,9 +2427,9 @@ namespace netgen
|
||||
bcn = &default_bcname;
|
||||
}
|
||||
|
||||
ngstd::Archive & FaceDescriptor :: DoArchive (ngstd::Archive & ar)
|
||||
void FaceDescriptor :: DoArchive (Archive & ar)
|
||||
{
|
||||
return ar & surfnr & domin & domout & tlosurf & bcprop
|
||||
ar & surfnr & domin & domout & tlosurf & bcprop
|
||||
& surfcolour.X() & surfcolour.Y() & surfcolour.Z()
|
||||
& bcname
|
||||
& domin_singular & domout_singular ;
|
||||
@ -2482,7 +2482,7 @@ namespace netgen
|
||||
maxidentnr = 0;
|
||||
}
|
||||
|
||||
ngstd::Archive & Identifications :: DoArchive (ngstd::Archive & ar)
|
||||
void Identifications :: DoArchive (Archive & ar)
|
||||
{
|
||||
ar & maxidentnr;
|
||||
ar & identifiedpoints & identifiedpoints_nr;
|
||||
@ -2503,7 +2503,6 @@ namespace netgen
|
||||
for (auto & t : type)
|
||||
ar & (unsigned char&)(t);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
|
||||
|
@ -171,13 +171,9 @@ namespace netgen
|
||||
enum { BASE = 1 };
|
||||
#endif
|
||||
|
||||
ngstd::Archive & DoArchive (ngstd::Archive & ar) { return ar & i; }
|
||||
void DoArchive (Archive & ar) { ar & i; }
|
||||
};
|
||||
|
||||
inline ngstd::Archive & operator & (ngstd::Archive & archive, PointIndex & mp)
|
||||
{ return mp.DoArchive(archive); }
|
||||
|
||||
|
||||
inline istream & operator>> (istream & ist, PointIndex & pi)
|
||||
{
|
||||
int i; ist >> i; pi = PointIndex(i); return ist;
|
||||
@ -247,14 +243,9 @@ namespace netgen
|
||||
SurfaceElementIndex & operator-- () { --i; return *this; }
|
||||
SurfaceElementIndex & operator+= (int inc) { i+=inc; return *this; }
|
||||
|
||||
ngstd::Archive & DoArchive (ngstd::Archive & ar) { return ar & i; }
|
||||
void DoArchive (Archive & ar) { ar & i; }
|
||||
};
|
||||
|
||||
inline ngstd::Archive & operator & (ngstd::Archive & archive, SurfaceElementIndex & mp)
|
||||
{ return mp.DoArchive(archive); }
|
||||
|
||||
|
||||
|
||||
inline istream & operator>> (istream & ist, SurfaceElementIndex & pi)
|
||||
{
|
||||
int i; ist >> i; pi = i; return ist;
|
||||
@ -337,19 +328,13 @@ namespace netgen
|
||||
static MPI_Datatype MyGetMPIType ( );
|
||||
#endif
|
||||
|
||||
ngstd::Archive & DoArchive (ngstd::Archive & ar)
|
||||
void DoArchive (Archive & ar)
|
||||
{
|
||||
ar & x[0] & x[1] & x[2] & layer & singular;
|
||||
ar & (unsigned char&)(type);
|
||||
return ar;
|
||||
}
|
||||
};
|
||||
|
||||
inline ngstd::Archive & operator & (ngstd::Archive & archive, MeshPoint & mp)
|
||||
{ return mp.DoArchive(archive); }
|
||||
|
||||
|
||||
|
||||
inline ostream & operator<<(ostream & s, const MeshPoint & pt)
|
||||
{
|
||||
return (s << Point<3> (pt));
|
||||
@ -497,7 +482,7 @@ namespace netgen
|
||||
///
|
||||
const PointGeomInfo & GeomInfoPiMod (int i) const { return geominfo[(i-1) % np]; }
|
||||
|
||||
ngstd::Archive & DoArchive (ngstd::Archive & ar)
|
||||
void DoArchive (Archive & ar)
|
||||
{
|
||||
short _np, _typ;
|
||||
bool _curved, _vis, _deleted;
|
||||
@ -511,7 +496,6 @@ namespace netgen
|
||||
visible = _vis; deleted = _deleted; }
|
||||
for (size_t i = 0; i < np; i++)
|
||||
ar & pnum[i];
|
||||
return ar;
|
||||
}
|
||||
|
||||
void SetIndex (int si) { index = si; }
|
||||
@ -630,9 +614,6 @@ namespace netgen
|
||||
#endif
|
||||
};
|
||||
|
||||
inline ngstd::Archive & operator & (ngstd::Archive & archive, Element2d & mp)
|
||||
{ return mp.DoArchive(archive); }
|
||||
|
||||
ostream & operator<<(ostream & s, const Element2d & el);
|
||||
|
||||
|
||||
@ -774,7 +755,7 @@ namespace netgen
|
||||
///
|
||||
const PointIndex & PNumMod (int i) const { return pnum[(i-1) % np]; }
|
||||
|
||||
ngstd::Archive & DoArchive (ngstd::Archive & ar)
|
||||
void DoArchive (Archive & ar)
|
||||
{
|
||||
short _np, _typ;
|
||||
if (ar.Output())
|
||||
@ -784,7 +765,6 @@ namespace netgen
|
||||
{ np = _np; typ = ELEMENT_TYPE(_typ); }
|
||||
for (size_t i = 0; i < np; i++)
|
||||
ar & pnum[i];
|
||||
return ar;
|
||||
}
|
||||
|
||||
///
|
||||
@ -928,9 +908,6 @@ namespace netgen
|
||||
int hp_elnr;
|
||||
};
|
||||
|
||||
inline ngstd::Archive & operator & (ngstd::Archive & archive, Element & mp)
|
||||
{ return mp.DoArchive(archive); }
|
||||
|
||||
ostream & operator<<(ostream & s, const Element & el);
|
||||
|
||||
|
||||
@ -1049,12 +1026,9 @@ namespace netgen
|
||||
#else
|
||||
int GetPartition () const { return 0; }
|
||||
#endif
|
||||
ngstd::Archive & DoArchive (ngstd::Archive & ar);
|
||||
void DoArchive (Archive & ar);
|
||||
};
|
||||
|
||||
inline ngstd::Archive & operator & (ngstd::Archive & archive, Segment & mp)
|
||||
{ return mp.DoArchive(archive); }
|
||||
|
||||
ostream & operator<<(ostream & s, const Segment & seg);
|
||||
|
||||
|
||||
@ -1142,13 +1116,9 @@ namespace netgen
|
||||
// friend ostream & operator<<(ostream & s, const FaceDescriptor & fd);
|
||||
friend class Mesh;
|
||||
|
||||
ngstd::Archive & DoArchive (ngstd::Archive & ar);
|
||||
void DoArchive (Archive & ar);
|
||||
};
|
||||
|
||||
inline ngstd::Archive & operator & (ngstd::Archive & archive, FaceDescriptor & mp)
|
||||
{ return mp.DoArchive(archive); }
|
||||
|
||||
|
||||
ostream & operator<< (ostream & s, const FaceDescriptor & fd);
|
||||
|
||||
|
||||
@ -1516,12 +1486,8 @@ namespace netgen
|
||||
|
||||
DLL_HEADER void Print (ostream & ost) const;
|
||||
|
||||
ngstd::Archive & DoArchive (ngstd::Archive & ar);
|
||||
void DoArchive (Archive & ar);
|
||||
};
|
||||
|
||||
inline ngstd::Archive & operator & (ngstd::Archive & archive, Identifications & mp)
|
||||
{ return mp.DoArchive(archive); }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user