From bffe7f8b1a846a3014f8dd3c70b9eedce4455a9d Mon Sep 17 00:00:00 2001 From: Soeren Peters <peters@irmb.tu-bs.de> Date: Tue, 30 Jun 2020 13:59:27 +0200 Subject: [PATCH] Merge basics changes from cpu to gpu to merge them later. --- .../basics/container/CbArray3D.h | 2 +- .../basics/container/CbArray4D.h | 2 +- .../basics/container/CbVector.h | 4 +-- .../basics/container/CbVectorPool.h | 18 +++++----- .../basics/utilities/UbLogger.h | 10 +++--- .../basics/utilities/UbScheduler.h | 8 ++--- .../basics/writer/WbWriter.h | 3 +- .../geometry3d/CoordinateTransformation3D.h | 4 +-- .../numerics/geometry3d/GbVoxelMatrix3D.cpp | 2 +- gpu/CMakeLists.txt | 2 +- .../basics/container/CbArray3D.h | 15 ++------ .../basics/container/CbArray4D.h | 16 ++------- .../basics/container/CbVector.h | 6 ++-- .../basics/container/CbVectorPool.h | 22 ++++++------ .../basics/memory/MbSharedPointerDefines.h | 26 +++++++------- .../basics/transmitter/TbTransmitterLocal.h | 9 +++-- .../basics/transmitter/TbTransmitterMpiPool.h | 5 ++- .../basics/utilities/UbFileInputBinary.h | 11 ++++++ .../basics/utilities/UbFileOutputBinary.h | 10 ++++++ .../basics/utilities/UbKeys.h | 25 ------------- .../basics/utilities/UbLogger.h | 12 +++---- .../basics/utilities/UbMath.h | 2 +- .../basics/utilities/UbScheduler.h | 36 +++---------------- .../basics/utilities/UbSystem.h | 3 +- .../basics/writer/WbWriter.h | 9 +---- .../basics/writer/WbWriterVtkXmlASCII.cpp | 5 +-- .../basics/writer/WbWriterVtkXmlASCII.h | 9 +---- .../basics/writer/WbWriterVtkXmlBinary.cpp | 28 ++++++++------- .../basics/writer/WbWriterVtkXmlBinary.h | 9 +---- .../geometry3d/CoordinateTransformation3D.h | 7 ++-- .../numerics/geometry3d/GbCuboid3D.cpp | 6 ++-- .../numerics/geometry3d/GbTriFaceMesh3D.cpp | 6 ++-- .../numerics/geometry3d/GbVoxelMatrix3D.cpp | 12 +++---- .../libs/VirtualFluidsBasics/CMakeLists.txt | 4 +-- 34 files changed, 142 insertions(+), 206 deletions(-) diff --git a/cpu/VirtualFluidsBasic/basics/container/CbArray3D.h b/cpu/VirtualFluidsBasic/basics/container/CbArray3D.h index 36197d1f8..2ec0306c4 100644 --- a/cpu/VirtualFluidsBasic/basics/container/CbArray3D.h +++ b/cpu/VirtualFluidsBasic/basics/container/CbArray3D.h @@ -161,7 +161,7 @@ public: this->resize(uniformDimensionSize,uniformDimensionSize,uniformDimensionSize); } /*=======================================================================*/ - //übernimmt vector als daten vector! (erstellt KEINE kopie!!!, vec ist anschließend leer, da swap verwendet wird) + //�bernimmt vector als daten vector! (erstellt KEINE kopie!!!, vec ist anschlie�end leer, da swap verwendet wird) CbArray3D(std::vector<value_type>& vec, const size_type& nx1,const size_type& nx2, const size_type& nx3) { assert( (nx1*nx2*nx3)==vec.size() ); diff --git a/cpu/VirtualFluidsBasic/basics/container/CbArray4D.h b/cpu/VirtualFluidsBasic/basics/container/CbArray4D.h index 372f7fd47..6566f9b46 100644 --- a/cpu/VirtualFluidsBasic/basics/container/CbArray4D.h +++ b/cpu/VirtualFluidsBasic/basics/container/CbArray4D.h @@ -132,7 +132,7 @@ public: this->resize(uniformDimensionSize,uniformDimensionSize,uniformDimensionSize,uniformDimensionSize); } /*=======================================================================*/ - //ubernimmt vector als daten vector! (erstellt KEINE kopie!!!, vec ist anschließend leer, da swap verwendet wird) + //ubernimmt vector als daten vector! (erstellt KEINE kopie!!!, vec ist anschlie�end leer, da swap verwendet wird) CbArray4D(std::vector<value_type>& vec, const size_type& nx1,const size_type& nx2, const size_type& nx3, const size_type& nx4) { assert( (nx1*nx2*nx3*nx4)==vec.size() ); diff --git a/cpu/VirtualFluidsBasic/basics/container/CbVector.h b/cpu/VirtualFluidsBasic/basics/container/CbVector.h index e0db945d3..bd7174da9 100644 --- a/cpu/VirtualFluidsBasic/basics/container/CbVector.h +++ b/cpu/VirtualFluidsBasic/basics/container/CbVector.h @@ -36,9 +36,9 @@ usage: ... Da es Voraussetzun bei doeser Klasse war, dass lediglich der Typ als template-parameter miteingeht, muss der allcocator eine abstrakte klasse sein -ansonsten hätte sich hier der allokator als zweites argument +ansonsten h�tte sich hier der allokator als zweites argument wie beim STL vector angeboten, womit man auch keinen pointer speichern muesste. -Im letzteren Fall würde aber jeweils ein bestimmeter Klassentyp in Abhaengigkeit +Im letzteren Fall w�rde aber jeweils ein bestimmeter Klassentyp in Abhaengigkeit des allokators zur compilezeit erzeugt. Problem wir wollen ein und denselben typ benutzen und nur der allokator innerhalb der klasse soll sich unterscheiden // diff --git a/cpu/VirtualFluidsBasic/basics/container/CbVectorPool.h b/cpu/VirtualFluidsBasic/basics/container/CbVectorPool.h index 92fbde9c1..b172a674e 100644 --- a/cpu/VirtualFluidsBasic/basics/container/CbVectorPool.h +++ b/cpu/VirtualFluidsBasic/basics/container/CbVectorPool.h @@ -39,20 +39,20 @@ /* Durch Verwendung eines CbVectors in Verbindung mit einem CbVectorAllocatorPool wird der Datenvector nicht direkt im CbVector gehalten, sondern ist ein Teil -des Datenvectors des Übergabe-CbVectorPools. +des Datenvectors des �bergabe-CbVectorPools. Die Methoden der von CbVectors funktionieren fehlerfrei -Es mss einem jedoch bewußt sein, dass die "resize"-Methoden länger benötigen, da +Es mss einem jedoch bewu�t sein, dass die "resize"-Methoden l�nger ben�tigen, da u.U. viele Elemente im Speicher verschoeben werden muessen. -Der Poolvector enthaelt KEINE gaps, so dass er z.B. gut zur Übertragung via MPI +Der Poolvector enthaelt KEINE gaps, so dass er z.B. gut zur �bertragung via MPI geeignet ist... -Verhaltensweise bei Zerstören des Pools: -wird der Pool zerstört bevor man die CbVectoren zerstört, so wird beim nächsten +Verhaltensweise bei Zerst�ren des Pools: +wird der Pool zerst�rt bevor man die CbVectoren zerst�rt, so wird beim n�chsten Datenzugriffsversuch eine entsprechende Exception geworfen, denn alle DatenElemente des CbVEctors werden restet und der Pool dort zu NULL gesetzt. -Verhaltensweise bei Zerstören eines CbVectors: -hier ganz normal der Datenspeicher wieder freigegen und der Poolvektor verkürzt +Verhaltensweise bei Zerst�ren eines CbVectors: +hier ganz normal der Datenspeicher wieder freigegen und der Poolvektor verk�rzt */ ////////////////////////////////////////////////////////////////////////// @@ -289,7 +289,7 @@ protected: UB_THROW( UbException(UB_EXARGS,"index Problem... Annahme falsch?") ); } - //vector zu map hinzufügen (speicher wird dann anschliessend zugwiesen) + //vector zu map hinzuf�gen (speicher wird dann anschliessend zugwiesen) cbVectorMap.insert( std::make_pair( allocator.key, &vec ) ); // ist angeblich performanter als cbVectorMap[ allocator.key ] = cbVector; //aus Effective STL von Scott Meyer allocator.dataSizeOf(vec) = dataSize; @@ -320,7 +320,7 @@ protected: if( tmpVec.size()>0 ) { CbVectorAllocatorPool< value_type >& tmpAllocator = dynamic_cast< CbVectorAllocatorPool<value_type>& >(*tmpVec.getAllocator()); - //liegt CbVector VOR verändertem CbVector? + //liegt CbVector VOR ver�ndertem CbVector? if( tmpAllocator.startIndexInPool <= allocator.startIndexInPool ) //ja: anpassung NUR wenn pool verschoben wurde! { if(poolMoved && tmpVec.size()>0 ) tmpAllocator.ptrDataOf(tmpVec) = &pool[ tmpAllocator.startIndexInPool]; diff --git a/cpu/VirtualFluidsBasic/basics/utilities/UbLogger.h b/cpu/VirtualFluidsBasic/basics/utilities/UbLogger.h index baaf8e5e4..ae29e1f00 100644 --- a/cpu/VirtualFluidsBasic/basics/utilities/UbLogger.h +++ b/cpu/VirtualFluidsBasic/basics/utilities/UbLogger.h @@ -32,7 +32,7 @@ // oder auf dem Bildschirm ausgegeben. Es werden verschiedene LogLevel unterstuetzt // // Hilfsmakro: UBLOG -// Bsp1: UBLOG(logINFO) << "Klasse::foo entered"; //endl wir nicht benötigt +// Bsp1: UBLOG(logINFO) << "Klasse::foo entered"; //endl wir nicht ben�tigt // --> Eintrag: // // Bsp2: siehe Dateiende! @@ -60,7 +60,7 @@ public: virtual ~UbLogger(); std::ostringstream& get(const LogLevel& level = logINFO); public: - //static, weil man so später die ObjErstellunge ersparen kann, + //static, weil man so sp�ter die ObjErstellunge ersparen kann, //falls level kleiner als Level static LogLevel& reportingLevel(); @@ -179,7 +179,7 @@ inline std::string UbLogger<OutputPolicy>::logTimeString() //Anm: die erste Version mit auto_ptr fuer den stream fuehrte zu // exceptions bei Verwedung vom Logger in dtors stat. globaler // Objekte. Aber auch die Pointer-Lsg. ist noch nicht die -// optimale Lösung +// optimale L�sung class Output2Stream // implementation of OutputPolicy { public: @@ -254,7 +254,7 @@ class UbLog : public UbLogger< Output2Stream > }; -//Makro um compilerseitig maxLevel zu beschränken +//Makro um compilerseitig maxLevel zu beschr�nken #ifndef UBLOG_MAX_LEVEL #define UBLOG_MAX_LEVEL logDEBUG5 #endif @@ -297,7 +297,7 @@ class UbLog : public UbLogger< Output2Stream > } \ } ////////////////////////////////////////////////////////////////////////// -//makro3, falls auch bildschirmausgabe erwünscht +//makro3, falls auch bildschirmausgabe erw�nscht // -> es wird sowohl ins logfile als auch auf den "stream" geschrieben // wenn reporting level und level passen :D //example1: UBLOG2ML(logINFO, std::cout, "line1"<<endl<<"line2"<<endl<<"line3" ) diff --git a/cpu/VirtualFluidsBasic/basics/utilities/UbScheduler.h b/cpu/VirtualFluidsBasic/basics/utilities/UbScheduler.h index 7fb991699..81aa89ef9 100644 --- a/cpu/VirtualFluidsBasic/basics/utilities/UbScheduler.h +++ b/cpu/VirtualFluidsBasic/basics/utilities/UbScheduler.h @@ -34,7 +34,7 @@ namespace for global system-functions @version 1.1 - 09.09.06 @version 1.2 - 03.07.08 - nun auch isDue(t) mehrmals fuer dasselbe t moeglich isDue(t) auch fuer t < lastUsedT - bug entfernt, der bei Schedule (5,0,500) auch 505 als Due zurückgibt! + bug entfernt, der bei Schedule (5,0,500) auch 505 als Due zur�ckgibt! */ /* @@ -198,9 +198,9 @@ public: nextDueTime = tmpNextDueTime; } - //wenn t = der aktuuellen oder gar schon der nächstmöglichen ist (hierbei wurde + //wenn t = der aktuuellen oder gar schon der n�chstm�glichen ist (hierbei wurde //zuvor actDueTime und nextDueTime ggf. angepasst) - //Bsp.: nextDuTime war 5, aber für t=400 gilt andere schedule -> Bsp actDue=350 und nextDue 405 + //Bsp.: nextDuTime war 5, aber f�r t=400 gilt andere schedule -> Bsp actDue=350 und nextDue 405 if( UbMath::equal(t,actDueTime) || UbMath::equal(t,nextDueTime) ) { @@ -210,7 +210,7 @@ public: } else if( UbMath::lessEqual(t, lastDueTime) ) { - if(UbMath::equal(t, lastDueTime) ) return true; //braucht man, wenn man für dasselbe t isDue(t) aufruft + if(UbMath::equal(t, lastDueTime) ) return true; //braucht man, wenn man f�r dasselbe t isDue(t) aufruft else { //Fall: Zeit liegt faktisch in der Vergangenheit -> neu initialsisieren diff --git a/cpu/VirtualFluidsBasic/basics/writer/WbWriter.h b/cpu/VirtualFluidsBasic/basics/writer/WbWriter.h index b1a8c1ec4..d49f7b40b 100644 --- a/cpu/VirtualFluidsBasic/basics/writer/WbWriter.h +++ b/cpu/VirtualFluidsBasic/basics/writer/WbWriter.h @@ -76,7 +76,8 @@ public: virtual std::string writeQuadsWithNodeData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt4 >& cells, std::vector< std::string >& datanames, std::vector< std::vector< double > >& nodedata){ throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() ); } virtual std::string writeQuadsWithCellData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt4 >& cells, std::vector< std::string >& datanames, std::vector< std::vector< double > >& celldata){ throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() ); } virtual std::string writeQuadsWithNodeAndCellData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt4 >& cells, - std::vector< std::string >& nodedatanames, std::vector< std::vector< double > >& nodedata, std::vector< std::string >& celldatanames, std::vector< std::vector< double > >&celldata) { throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() ); } + std::vector< std::string >& nodedatanames, std::vector< std::vector< double > >& nodedata, std::vector< std::string >& celldatanames, + std::vector< std::vector< double > >&celldata) { throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() ); } ////////////////////////////////////////////////////////////////////////// //octs diff --git a/cpu/VirtualFluidsBasic/numerics/geometry3d/CoordinateTransformation3D.h b/cpu/VirtualFluidsBasic/numerics/geometry3d/CoordinateTransformation3D.h index f45402052..3179de328 100644 --- a/cpu/VirtualFluidsBasic/numerics/geometry3d/CoordinateTransformation3D.h +++ b/cpu/VirtualFluidsBasic/numerics/geometry3d/CoordinateTransformation3D.h @@ -38,7 +38,7 @@ // |--1--2--3--4--5------------- > x1 // // Bemerkung: kann sein, dass die Verdrehung um x1 und x3 vertauschst sind -// - muss mal einer prüfen ... +// - muss mal einer pr�fen ... @@ -61,7 +61,7 @@ public: double getRotationX2Angle() const { return this->beta; } double getRotationX3Angle() const { return this->gamma; } //Rotation - //Achtung die Winkel passen nicht überein -siehe setTransformationValues + //Achtung die Winkel passen nicht �berein -siehe setTransformationValues void setRotationX1Angle(double alpha) { this->setTransformationValues(this->Tx1, this->Tx2, this->Tx3, this->Sx1, this->Sx2, this->Sx3, alpha, this->beta, this->gamma); } void setRotationX2Angle(double beta ) { this->setTransformationValues(this->Tx1, this->Tx2, this->Tx3, this->Sx1, this->Sx2, this->Sx3, this->alpha, beta, this->gamma); } void setRotationX3Angle(double gamma) { this->setTransformationValues(this->Tx1, this->Tx2, this->Tx3, this->Sx1, this->Sx2, this->Sx3, this->alpha, this->beta, gamma); } diff --git a/cpu/VirtualFluidsBasic/numerics/geometry3d/GbVoxelMatrix3D.cpp b/cpu/VirtualFluidsBasic/numerics/geometry3d/GbVoxelMatrix3D.cpp index d8bad0feb..5552482bb 100644 --- a/cpu/VirtualFluidsBasic/numerics/geometry3d/GbVoxelMatrix3D.cpp +++ b/cpu/VirtualFluidsBasic/numerics/geometry3d/GbVoxelMatrix3D.cpp @@ -279,7 +279,7 @@ bool GbVoxelMatrix3D::isPointInGbObject3D(const double& x1p, const double& x2p, bool GbVoxelMatrix3D::isCellInsideGbObject3D(const double& x1p1, const double& x2p1, const double& x3p1, const double& x1p2, const double& x2p2, const double& x3p2) { return false; - //dass hängt von der Konfigration ab, aber meist ist der Block grösser wie etliche Poren ... + //dass h�ngt von der Konfigration ab, aber meist ist der Block gr�sser wie etliche Poren ... //indizes ermitteln int startix1 = (int)std::floor((x1p1-minX1)/deltaX1+1E-13); diff --git a/gpu/CMakeLists.txt b/gpu/CMakeLists.txt index d12c3aeef..f3cc24ebf 100644 --- a/gpu/CMakeLists.txt +++ b/gpu/CMakeLists.txt @@ -126,7 +126,7 @@ set(CMAKE_CUDA_FLAGS_DEBUG " -G" CACHE STRING "" FORCE) ### Core ### ############################################################# -#add_subdirectory(targets/libs/VirtualFluidsBasics) +add_subdirectory(src/VirtualFluidsBasics) add_subdirectory(src/core) #add_subdirectory(targets/libs/GridGenerator) diff --git a/gpu/src/VirtualFluidsBasics/basics/container/CbArray3D.h b/gpu/src/VirtualFluidsBasics/basics/container/CbArray3D.h index f1e080d1b..2ec0306c4 100644 --- a/gpu/src/VirtualFluidsBasics/basics/container/CbArray3D.h +++ b/gpu/src/VirtualFluidsBasics/basics/container/CbArray3D.h @@ -35,7 +35,7 @@ #include <basics/utilities/UbEqual.h> #include <algorithm> #include <typeinfo> -#include <boost/serialization/serialization.hpp> +#include "PointerDefinitions.h" #ifdef CAB_RCF #include <3rdParty/rcf/RcfSerializationIncludes.h> @@ -126,7 +126,7 @@ template<typename T, typename IndexClass = IndexerX3X2X1> class CbArray3D { public: - typedef std::shared_ptr< CbArray3D <T,IndexClass> > CbArray3DPtr; + typedef SPtr< CbArray3D <T,IndexClass> > CbArray3DPtr; typedef T value_type; typedef IndexClass indexer_type; @@ -161,7 +161,7 @@ public: this->resize(uniformDimensionSize,uniformDimensionSize,uniformDimensionSize); } /*=======================================================================*/ - //übernimmt vector als daten vector! (erstellt KEINE kopie!!!, vec ist anschließend leer, da swap verwendet wird) + //�bernimmt vector als daten vector! (erstellt KEINE kopie!!!, vec ist anschlie�end leer, da swap verwendet wird) CbArray3D(std::vector<value_type>& vec, const size_type& nx1,const size_type& nx2, const size_type& nx3) { assert( (nx1*nx2*nx3)==vec.size() ); @@ -464,15 +464,6 @@ protected: indexer_type indexer; std::vector< value_type > data; - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & nx1; - ar & nx2; - ar & nx3; - ar & data; - } }; #endif //CBARRAY3D_H diff --git a/gpu/src/VirtualFluidsBasics/basics/container/CbArray4D.h b/gpu/src/VirtualFluidsBasics/basics/container/CbArray4D.h index 49708fd43..b9fbcb802 100644 --- a/gpu/src/VirtualFluidsBasics/basics/container/CbArray4D.h +++ b/gpu/src/VirtualFluidsBasics/basics/container/CbArray4D.h @@ -30,7 +30,7 @@ #include <basics/utilities/UbEqual.h> #include <algorithm> #include <typeinfo> -#include <boost/serialization/serialization.hpp> +#include "PointerDefinitions.h" #include <VirtualFluidsDefinitions.h> @@ -99,7 +99,7 @@ template<typename T, typename IndexClass = IndexerX4X3X2X1> class CbArray4D { public: - typedef std::shared_ptr< CbArray4D <T,IndexClass> > CbArray4DPtr; + typedef SPtr< CbArray4D <T,IndexClass> > CbArray4DPtr; typedef T value_type; typedef IndexClass indexer_type; @@ -134,7 +134,7 @@ public: this->resize(uniformDimensionSize,uniformDimensionSize,uniformDimensionSize,uniformDimensionSize); } /*=======================================================================*/ - //ubernimmt vector als daten vector! (erstellt KEINE kopie!!!, vec ist anschließend leer, da swap verwendet wird) + //ubernimmt vector als daten vector! (erstellt KEINE kopie!!!, vec ist anschlie�end leer, da swap verwendet wird) CbArray4D(std::vector<value_type>& vec, const size_type& nx1,const size_type& nx2, const size_type& nx3, const size_type& nx4) { assert( (nx1*nx2*nx3*nx4)==vec.size() ); @@ -447,16 +447,6 @@ protected: indexer_type indexer; std::vector< value_type > data; - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & nx1; - ar & nx2; - ar & nx3; - ar & nx4; - ar & data; - } }; #endif //CBARRAY4D_H diff --git a/gpu/src/VirtualFluidsBasics/basics/container/CbVector.h b/gpu/src/VirtualFluidsBasics/basics/container/CbVector.h index 6bb181957..bd7174da9 100644 --- a/gpu/src/VirtualFluidsBasics/basics/container/CbVector.h +++ b/gpu/src/VirtualFluidsBasics/basics/container/CbVector.h @@ -15,7 +15,7 @@ #include <vector> #include <algorithm> //for std::swap #include <typeinfo> //for typeid -#include <memory> //for memcopy +#include <PointerDefinitions.h> //for memcopy #include <basics/utilities/UbSystem.h> #include <basics/utilities/UbEqual.h> @@ -36,9 +36,9 @@ usage: ... Da es Voraussetzun bei doeser Klasse war, dass lediglich der Typ als template-parameter miteingeht, muss der allcocator eine abstrakte klasse sein -ansonsten hätte sich hier der allokator als zweites argument +ansonsten h�tte sich hier der allokator als zweites argument wie beim STL vector angeboten, womit man auch keinen pointer speichern muesste. -Im letzteren Fall würde aber jeweils ein bestimmeter Klassentyp in Abhaengigkeit +Im letzteren Fall w�rde aber jeweils ein bestimmeter Klassentyp in Abhaengigkeit des allokators zur compilezeit erzeugt. Problem wir wollen ein und denselben typ benutzen und nur der allokator innerhalb der klasse soll sich unterscheiden // diff --git a/gpu/src/VirtualFluidsBasics/basics/container/CbVectorPool.h b/gpu/src/VirtualFluidsBasics/basics/container/CbVectorPool.h index 57b5dfa08..e3978e2a1 100644 --- a/gpu/src/VirtualFluidsBasics/basics/container/CbVectorPool.h +++ b/gpu/src/VirtualFluidsBasics/basics/container/CbVectorPool.h @@ -39,20 +39,20 @@ /* Durch Verwendung eines CbVectors in Verbindung mit einem CbVectorAllocatorPool wird der Datenvector nicht direkt im CbVector gehalten, sondern ist ein Teil -des Datenvectors des Übergabe-CbVectorPools. +des Datenvectors des �bergabe-CbVectorPools. Die Methoden der von CbVectors funktionieren fehlerfrei -Es mss einem jedoch bewußt sein, dass die "resize"-Methoden länger benötigen, da +Es mss einem jedoch bewu�t sein, dass die "resize"-Methoden l�nger ben�tigen, da u.U. viele Elemente im Speicher verschoeben werden muessen. -Der Poolvector enthaelt KEINE gaps, so dass er z.B. gut zur Übertragung via MPI +Der Poolvector enthaelt KEINE gaps, so dass er z.B. gut zur �bertragung via MPI geeignet ist... -Verhaltensweise bei Zerstören des Pools: -wird der Pool zerstört bevor man die CbVectoren zerstört, so wird beim nächsten +Verhaltensweise bei Zerst�ren des Pools: +wird der Pool zerst�rt bevor man die CbVectoren zerst�rt, so wird beim n�chsten Datenzugriffsversuch eine entsprechende Exception geworfen, denn alle DatenElemente des CbVEctors werden restet und der Pool dort zu NULL gesetzt. -Verhaltensweise bei Zerstören eines CbVectors: -hier ganz normal der Datenspeicher wieder freigegen und der Poolvektor verkürzt +Verhaltensweise bei Zerst�ren eines CbVectors: +hier ganz normal der Datenspeicher wieder freigegen und der Poolvektor verk�rzt */ ////////////////////////////////////////////////////////////////////////// @@ -91,7 +91,7 @@ public: { CbVector< value_type >& vec = *it->second; CbVectorAllocatorPool< value_type >& allocator = dynamic_cast< CbVectorAllocatorPool< value_type >& >(*vec.getAllocator() ); - if(allocator.ptrVectorPool != this) UB_THROW( UbException(UB_EXARGS,"CbVectorAllocator is part of different Pool") ); + //FIXME: //if(allocator.ptrVectorPool != this) UB_THROW( UbException(UB_EXARGS,"CbVectorAllocator is part of different Pool") ); //allocator daten reseten allocator.ptrVectorPool = NULL; @@ -165,7 +165,7 @@ public: } - //CommunicatorPtr comm = MPICommunicator::getInstance(); + //SPtr<Communicator> comm = MPICommunicator::getInstance(); //int myid = comm->getProcessID(); // // Get the name of the processor @@ -289,7 +289,7 @@ protected: UB_THROW( UbException(UB_EXARGS,"index Problem... Annahme falsch?") ); } - //vector zu map hinzufügen (speicher wird dann anschliessend zugwiesen) + //vector zu map hinzuf�gen (speicher wird dann anschliessend zugwiesen) cbVectorMap.insert( std::make_pair( allocator.key, &vec ) ); // ist angeblich performanter als cbVectorMap[ allocator.key ] = cbVector; //aus Effective STL von Scott Meyer allocator.dataSizeOf(vec) = dataSize; @@ -320,7 +320,7 @@ protected: if( tmpVec.size()>0 ) { CbVectorAllocatorPool< value_type >& tmpAllocator = dynamic_cast< CbVectorAllocatorPool<value_type>& >(*tmpVec.getAllocator()); - //liegt CbVector VOR verändertem CbVector? + //liegt CbVector VOR ver�ndertem CbVector? if( tmpAllocator.startIndexInPool <= allocator.startIndexInPool ) //ja: anpassung NUR wenn pool verschoben wurde! { if(poolMoved && tmpVec.size()>0 ) tmpAllocator.ptrDataOf(tmpVec) = &pool[ tmpAllocator.startIndexInPool]; diff --git a/gpu/src/VirtualFluidsBasics/basics/memory/MbSharedPointerDefines.h b/gpu/src/VirtualFluidsBasics/basics/memory/MbSharedPointerDefines.h index 3481255fc..5d959e5ef 100644 --- a/gpu/src/VirtualFluidsBasics/basics/memory/MbSharedPointerDefines.h +++ b/gpu/src/VirtualFluidsBasics/basics/memory/MbSharedPointerDefines.h @@ -3,19 +3,19 @@ #define MBSHAREDPOINTERDEFINES_H -#include <memory> - -#define VFSharedFromThis std::enable_shared_from_this -#define VFSharedPtr std::shared_ptr -#define VFWeakPtr std::weak_ptr -#define VFDynamicPtrCast std::dynamic_pointer_cast - -template<typename T> -class VFPtrDeleter -{ -public: - void operator()(T* p) { delete p; } -}; +#include <PointerDefinitions.h> + +//#define VFSharedFromThis std::enable_shared_from_this +//#define VFSharedPtr std::shared_ptr +//#define VFWeakPtr std::weak_ptr +//#define VFDynamicPtrCast std::dynamic_pointer_cast +// +//template<typename T> +//class VFPtrDeleter +//{ +//public: +// void operator()(T* p) { delete p; } +//}; diff --git a/gpu/src/VirtualFluidsBasics/basics/transmitter/TbTransmitterLocal.h b/gpu/src/VirtualFluidsBasics/basics/transmitter/TbTransmitterLocal.h index c37ea83e6..fba8f150c 100644 --- a/gpu/src/VirtualFluidsBasics/basics/transmitter/TbTransmitterLocal.h +++ b/gpu/src/VirtualFluidsBasics/basics/transmitter/TbTransmitterLocal.h @@ -9,8 +9,7 @@ #include <basics/utilities/UbException.h> #include <basics/transmitter/TbTransmitter.h> - -#include <memory> +#include <PointerDefinitions.h> /*================================================================================*/ /* TbLocalTransmitter, TbVectorSenderLocal, TbVectorReceiverLocal */ @@ -33,7 +32,7 @@ template<typename T> class TbLocalTransmitter : public TbTransmitter<T> { public: - typedef std::shared_ptr< TbLocalTransmitter<T> > TbLocalTransmitterPtr; + typedef SPtr< TbLocalTransmitter<T> > TbLocalTransmitterPtr; typedef T value_type; @@ -93,7 +92,7 @@ public: typedef T value_type; public: - TbVectorSenderLocal(std::shared_ptr< TbVectorReceiverLocal< value_type > > receiver) + TbVectorSenderLocal(SPtr< TbVectorReceiverLocal< value_type > > receiver) : TbTransmitter< value_type >(), receiver(receiver) { @@ -124,7 +123,7 @@ public: std::string toString() const { return "TbVectorSenderLocal<"+(std::string)typeid(T).name()+">"; } protected: - std::shared_ptr< TbVectorReceiverLocal< value_type > > receiver; + SPtr< TbVectorReceiverLocal< value_type > > receiver; }; #endif //TOTRANSMITTERLOCAL_H diff --git a/gpu/src/VirtualFluidsBasics/basics/transmitter/TbTransmitterMpiPool.h b/gpu/src/VirtualFluidsBasics/basics/transmitter/TbTransmitterMpiPool.h index 8968fcc38..78decb50c 100644 --- a/gpu/src/VirtualFluidsBasics/basics/transmitter/TbTransmitterMpiPool.h +++ b/gpu/src/VirtualFluidsBasics/basics/transmitter/TbTransmitterMpiPool.h @@ -21,8 +21,7 @@ #include <basics/container/CbVector.h> #include <basics/container/CbVectorPool.h> -#include <memory> - +#include <PointerDefinitions.h> ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// //TbCbVectorMpiPoolSender/Receiver @@ -42,7 +41,7 @@ template<typename T> class TbCbVectorMpiPool : public CbVectorPool<T> { public: - typedef std::shared_ptr< TbCbVectorMpiPool< T > > MpiPoolPtr; + typedef SPtr< TbCbVectorMpiPool< T > > MpiPoolPtr; ////////////////////////////////////////////////////////////////////////// typedef std::map<std::string, MpiPoolPtr > MpiPoolPtrMap; diff --git a/gpu/src/VirtualFluidsBasics/basics/utilities/UbFileInputBinary.h b/gpu/src/VirtualFluidsBasics/basics/utilities/UbFileInputBinary.h index 6b622c6a3..c410c822f 100644 --- a/gpu/src/VirtualFluidsBasics/basics/utilities/UbFileInputBinary.h +++ b/gpu/src/VirtualFluidsBasics/basics/utilities/UbFileInputBinary.h @@ -64,6 +64,17 @@ public: file.infile.read((char*)&data,sizeof(T)); return file; } + + template< typename T> + void readVector(std::vector<T>& v) + { + size_t size = v.size(); + if (size > 0) + { + infile.read((char*)&v[0], sizeof(T)*size); + } + } + }; #endif diff --git a/gpu/src/VirtualFluidsBasics/basics/utilities/UbFileOutputBinary.h b/gpu/src/VirtualFluidsBasics/basics/utilities/UbFileOutputBinary.h index 13d94265c..76c502467 100644 --- a/gpu/src/VirtualFluidsBasics/basics/utilities/UbFileOutputBinary.h +++ b/gpu/src/VirtualFluidsBasics/basics/utilities/UbFileOutputBinary.h @@ -63,6 +63,16 @@ public: file.outfile.write((char*)&data,sizeof(T)); return file; } + + template< typename T> + void writeVector(std::vector<T>& v) + { + size_t size = v.size(); + if (size > 0) + { + outfile.write((char*)&v[0],sizeof(T)*size); + } + } }; #endif diff --git a/gpu/src/VirtualFluidsBasics/basics/utilities/UbKeys.h b/gpu/src/VirtualFluidsBasics/basics/utilities/UbKeys.h index b077c8aca..609c08dbe 100644 --- a/gpu/src/VirtualFluidsBasics/basics/utilities/UbKeys.h +++ b/gpu/src/VirtualFluidsBasics/basics/utilities/UbKeys.h @@ -9,7 +9,6 @@ #include <iostream> -#include <boost/serialization/serialization.hpp> #ifdef CAB_RCF #include <3rdParty/rcf/RcfSerializationIncludes.h> @@ -102,13 +101,6 @@ namespace UbKeys T1 t1; T2 t2; - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & t1; - ar & t2; - } }; ////////////////////////////////////////////////////////////////////////// @@ -198,14 +190,6 @@ namespace UbKeys T2 t2; T3 t3; - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & t1; - ar & t2; - ar & t3; - } }; ////////////////////////////////////////////////////////////////////////// @@ -296,15 +280,6 @@ namespace UbKeys T3 t3; T4 t4; - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & t1; - ar & t2; - ar & t3; - ar & t4; - } }; } diff --git a/gpu/src/VirtualFluidsBasics/basics/utilities/UbLogger.h b/gpu/src/VirtualFluidsBasics/basics/utilities/UbLogger.h index e531f47f4..b239621eb 100644 --- a/gpu/src/VirtualFluidsBasics/basics/utilities/UbLogger.h +++ b/gpu/src/VirtualFluidsBasics/basics/utilities/UbLogger.h @@ -12,8 +12,6 @@ #include <iostream> #include <fstream> #include <iomanip> -#include <memory> - #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) || defined(__WIN64__) #include <windows.h> #else @@ -33,7 +31,7 @@ // oder auf dem Bildschirm ausgegeben. Es werden verschiedene LogLevel unterstuetzt // // Hilfsmakro: UBLOG -// Bsp1: UBLOG(logINFO) << "Klasse::foo entered"; //endl wir nicht benötigt +// Bsp1: UBLOG(logINFO) << "Klasse::foo entered"; //endl wir nicht ben�tigt // --> Eintrag: // // Bsp2: siehe Dateiende! @@ -61,7 +59,7 @@ public: virtual ~UbLogger(); std::ostringstream& get(const LogLevel& level = logINFO); public: - //static, weil man so später die ObjErstellunge ersparen kann, + //static, weil man so sp�ter die ObjErstellunge ersparen kann, //falls level kleiner als Level static LogLevel& reportingLevel(); @@ -180,7 +178,7 @@ inline std::string UbLogger<OutputPolicy>::logTimeString() //Anm: die erste Version mit auto_ptr fuer den stream fuehrte zu // exceptions bei Verwedung vom Logger in dtors stat. globaler // Objekte. Aber auch die Pointer-Lsg. ist noch nicht die -// optimale Lösung +// optimale L�sung class Output2Stream // implementation of OutputPolicy { public: @@ -255,7 +253,7 @@ class UbLog : public UbLogger< Output2Stream > }; -//Makro um compilerseitig maxLevel zu beschränken +//Makro um compilerseitig maxLevel zu beschr�nken #ifndef UBLOG_MAX_LEVEL #define UBLOG_MAX_LEVEL logDEBUG5 #endif @@ -298,7 +296,7 @@ class UbLog : public UbLogger< Output2Stream > } \ } ////////////////////////////////////////////////////////////////////////// -//makro3, falls auch bildschirmausgabe erwünscht +//makro3, falls auch bildschirmausgabe erw�nscht // -> es wird sowohl ins logfile als auch auf den "stream" geschrieben // wenn reporting level und level passen :D //example1: UBLOG2ML(logINFO, std::cout, "line1"<<endl<<"line2"<<endl<<"line3" ) diff --git a/gpu/src/VirtualFluidsBasics/basics/utilities/UbMath.h b/gpu/src/VirtualFluidsBasics/basics/utilities/UbMath.h index 8c091893e..98034171b 100644 --- a/gpu/src/VirtualFluidsBasics/basics/utilities/UbMath.h +++ b/gpu/src/VirtualFluidsBasics/basics/utilities/UbMath.h @@ -11,7 +11,7 @@ #include <limits> #include <iostream> #include <cassert> -//#include <basics/utilities/UbSystem.h> +#include <basics/utilities/UbSystem.h> #include <basics/utilities/UbEqual.h> /*=========================================================================*/ diff --git a/gpu/src/VirtualFluidsBasics/basics/utilities/UbScheduler.h b/gpu/src/VirtualFluidsBasics/basics/utilities/UbScheduler.h index 2dfc8e0b6..f132f9528 100644 --- a/gpu/src/VirtualFluidsBasics/basics/utilities/UbScheduler.h +++ b/gpu/src/VirtualFluidsBasics/basics/utilities/UbScheduler.h @@ -22,9 +22,6 @@ #include <basics/utilities/UbFileOutput.h> #include <basics/utilities/UbFileInput.h> -#include <boost/serialization/serialization.hpp> - - /*=========================================================================*/ /* UbScheduler */ /* */ @@ -37,7 +34,7 @@ namespace for global system-functions @version 1.1 - 09.09.06 @version 1.2 - 03.07.08 - nun auch isDue(t) mehrmals fuer dasselbe t moeglich isDue(t) auch fuer t < lastUsedT - bug entfernt, der bei Schedule (5,0,500) auch 505 als Due zurückgibt! + bug entfernt, der bei Schedule (5,0,500) auch 505 als Due zur�ckgibt! */ /* @@ -88,18 +85,6 @@ public: end = in->readDouble(); step = in->readDouble(); } - //------------- implements boost serialization ----- end - - private: - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & begin; - ar & end; - ar & step; - } - private: double step, begin, end; @@ -215,9 +200,9 @@ public: nextDueTime = tmpNextDueTime; } - //wenn t = der aktuuellen oder gar schon der nächstmöglichen ist (hierbei wurde + //wenn t = der aktuuellen oder gar schon der n�chstm�glichen ist (hierbei wurde //zuvor actDueTime und nextDueTime ggf. angepasst) - //Bsp.: nextDuTime war 5, aber für t=400 gilt andere schedule -> Bsp actDue=350 und nextDue 405 + //Bsp.: nextDuTime war 5, aber f�r t=400 gilt andere schedule -> Bsp actDue=350 und nextDue 405 if( UbMath::equal(t,actDueTime) || UbMath::equal(t,nextDueTime) ) { @@ -227,7 +212,7 @@ public: } else if( UbMath::lessEqual(t, lastDueTime) ) { - if(UbMath::equal(t, lastDueTime) ) return true; //braucht man, wenn man für dasselbe t isDue(t) aufruft + if(UbMath::equal(t, lastDueTime) ) return true; //braucht man, wenn man f�r dasselbe t isDue(t) aufruft else { //Fall: Zeit liegt faktisch in der Vergangenheit -> neu initialsisieren @@ -324,19 +309,6 @@ public: this->addSchedule(schedule); } } - //------------- implements boost serialization ----- end - -private: - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & lastUsedT; - ar & lastDueTime; - ar & nextDueTime; - ar & maxT; - ar & schedules; - } protected: /*==========================================================*/ diff --git a/gpu/src/VirtualFluidsBasics/basics/utilities/UbSystem.h b/gpu/src/VirtualFluidsBasics/basics/utilities/UbSystem.h index 5a94ac5a6..a1c336b69 100644 --- a/gpu/src/VirtualFluidsBasics/basics/utilities/UbSystem.h +++ b/gpu/src/VirtualFluidsBasics/basics/utilities/UbSystem.h @@ -25,6 +25,7 @@ #include "sys/stat.h" #include <sys/syscall.h> #include <sys/stat.h> + #include <unistd.h> #elif (defined(__amd64) || defined(__amd64__) || defined(__unix__) || defined(__CYGWIN__)) && !defined(__AIX__) #define UBSYSTEM_LINUX #include "dirent.h" @@ -516,7 +517,7 @@ namespace UbSystem //Anwendung z.B. zur Ueberpruefung von Funktionalitaeten, wie z.B. bei UbMath::getNegativeInfinity<double>(); // //Grund fuer macro ist einfach, dass es besser anzuwenden ist in der praxis! -//ansonsten würde es so aussehen: +//ansonsten wuerde es so aussehen: // UbSystem::ub_static_assert< aaa == 1 > test(); // da ist UB_STATIC_ASSERT(aaa == 1); schoener // diff --git a/gpu/src/VirtualFluidsBasics/basics/writer/WbWriter.h b/gpu/src/VirtualFluidsBasics/basics/writer/WbWriter.h index 23fb67e65..13d64c752 100644 --- a/gpu/src/VirtualFluidsBasics/basics/writer/WbWriter.h +++ b/gpu/src/VirtualFluidsBasics/basics/writer/WbWriter.h @@ -29,8 +29,6 @@ #include <basics/utilities/UbAutoRun.hpp> #include <basics/objects/ObFactory.h> -#include <boost/serialization/serialization.hpp> - class VF_PUBLIC WbWriter { public: @@ -81,7 +79,7 @@ public: virtual std::string writeQuadsWithCellData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt4 >& cells, std::vector< std::string >& datanames, std::vector< std::vector< double > >& celldata){ throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() ); } virtual std::string writeQuadsWithNodeAndCellData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt4 >& cells, std::vector< std::string >& nodedatanames, std::vector< std::vector< double > >& nodedata, std::vector< std::string >& celldatanames, - std::vector< std::vector< double > >& celldata ){ throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() ); } + std::vector< std::vector< double > >&celldata) { throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() ); } ////////////////////////////////////////////////////////////////////////// //octs @@ -97,12 +95,7 @@ public: virtual std::string writeOctsWithNodeData(const std::string& filename,std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleUInt8 >& cells, std::vector<std::string >& datanames, std::vector<std::vector<double > >& nodedata){ throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() ); } private: - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - } }; diff --git a/gpu/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlASCII.cpp b/gpu/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlASCII.cpp index 0dcc7db61..edf5efea9 100644 --- a/gpu/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlASCII.cpp +++ b/gpu/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlASCII.cpp @@ -1,6 +1,7 @@ #include <basics/writer/WbWriterVtkXmlASCII.h> #include <basics/utilities/UbLogger.h> #include <cstring> +#include <limits> using namespace std; @@ -86,7 +87,7 @@ std::string WbWriterVtkXmlASCII::writeParallelFile(const string& filename,vector out<<" </PPoints>\n"; out<<" <PPointData>\n"; for(size_t s=0; s<pointDataNames.size(); s++) - out<< " <PDataArray type=\"Float32\" Name=\""<< pointDataNames[s] <<"\"/>\n"; + out<< " <PDataArray type=\"Float64\" Name=\""<< pointDataNames[s] <<"\"/>\n"; out<<" </PPointData>\n"; if (cellDataNames.size() > 0) { @@ -874,7 +875,7 @@ std::string WbWriterVtkXmlASCII::writeOctsWithNodeData(const string& filename,ve out<<" <PointData Scalars=\"PScalars\"> \n"; for(int s=0; s<(int)datanames.size(); ++s) { - out<< " <DataArray type=\"Float32\" Name=\""<< datanames[s] <<"\" format=\"ascii\">"; + out<< " <DataArray type=\"Float64\" Name=\""<< datanames[s] <<"\" format=\"ascii\">"; for(int d=0; d<(int)nodedata[s].size(); d++) { diff --git a/gpu/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlASCII.h b/gpu/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlASCII.h index 0339011b4..00fc67023 100644 --- a/gpu/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlASCII.h +++ b/gpu/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlASCII.h @@ -7,8 +7,6 @@ #include <basics/writer/WbWriter.h> -#include <boost/serialization/base_object.hpp> - class VF_PUBLIC WbWriterVtkXmlASCII : public WbWriter { public: @@ -90,12 +88,7 @@ public: std::string writeOctsWithNodeData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleUInt8 >& cells, std::vector< std::string >& datanames, std::vector< std::vector< double > >& nodedata); private: - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & boost::serialization::base_object<WbWriter>(*this); - } + }; UB_AUTO_RUN_NAMED(ObFactory<WbWriter>::getInstance()->addObCreator(ObSingletonCreatorImpl<WbWriterVtkXmlASCII ,WbWriter>::getInstance()), CAB_WbWriterVtkXmlASCII); diff --git a/gpu/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlBinary.cpp b/gpu/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlBinary.cpp index be80d2b3d..b44943302 100644 --- a/gpu/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlBinary.cpp +++ b/gpu/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlBinary.cpp @@ -3,7 +3,7 @@ #include <basics/utilities/UbLogger.h> #include <basics/utilities/UbSystem.h> -#include "Core/buildInfo.h" +#include "buildInfo.h" #include <cstring> using namespace std; @@ -732,7 +732,7 @@ string WbWriterVtkXmlBinary::writeQuadsWithNodeData(const string& filename,vecto out<<" <PointData>\n"; for(size_t s=0; s<datanames.size(); ++s) { - out<< " <DataArray type=\"Float32\" Name=\""<< datanames[s] <<"\" format=\"appended\" offset=\""<< offset <<"\" /> \n"; + out<< " <DataArray type=\"Float64\" Name=\""<< datanames[s] <<"\" format=\"appended\" offset=\""<< offset <<"\" /> \n"; offset += (bytesPerByteVal + bytesScalarData); } out<<" </PointData>\n"; @@ -1218,11 +1218,11 @@ string WbWriterVtkXmlBinary::writeOctsWithNodeData(const string& filename,vector int bytesCellConnectivty = 8 /*nodes per oct */ * nofCells * sizeof(int ); int bytesCellOffsets = 1 /*offset per oct*/ * nofCells * sizeof(int ); int bytesCellTypes = 1 /*type of oct */ * nofCells * sizeof(unsigned char); - int bytesScalarData = 1 /*scalar */ * nofNodes * sizeof(float); + int bytesScalarData = 1 /*scalar */ * nofNodes * sizeof(double); - int offset = 0; + unsigned long long offset = 0; //VTK FILE - out<<"<?xml version=\"1.0\"?>\n"; + out<<"<?xml version=\"2.0\"?>\n"; out<< getHeaderTag(); out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n"; out<<" <UnstructuredGrid>"<<"\n"; @@ -1248,7 +1248,7 @@ string WbWriterVtkXmlBinary::writeOctsWithNodeData(const string& filename,vector out<<" <PointData>\n"; for(size_t s=0; s<datanames.size(); ++s) { - out<< " <DataArray type=\"Float32\" Name=\""<< datanames[s] <<"\" format=\"appended\" offset=\""<< offset <<"\" /> \n"; + out<< " <DataArray type=\"Float64\" Name=\""<< datanames[s] <<"\" format=\"appended\" offset=\""<< offset <<"\" /> \n"; offset += (bytesPerByteVal + bytesScalarData); } out<<" </PointData>\n"; @@ -1309,8 +1309,10 @@ string WbWriterVtkXmlBinary::writeOctsWithNodeData(const string& filename,vector for(size_t d=0; d<nodedata[s].size(); ++d) { //loake kopie machen, da in nodedata "doubles" sind - float tmp = (float)nodedata[s][d]; - out.write((char*)&tmp,sizeof(float)); + //float tmp = (float)nodedata[s][d]; + //out.write((char*)&tmp,sizeof(float)); + double tmp = nodedata[s][d]; + out.write((char*)&tmp,sizeof(double)); } } out<<"\n</AppendedData>\n"; @@ -1531,7 +1533,7 @@ std::string WbWriterVtkXmlBinary::writeNodesWithNodeData(const std::string& file int bytesCellConnectivty = 1 /*nodes per cell */ * nofNodes * sizeof(int ); int bytesCellOffsets = 1 /*offset per cell*/ * nofNodes * sizeof(int ); int bytesCellTypes = 1 /*type of oct */ * nofNodes * sizeof(unsigned char); - int bytesScalarData = 1 /*scalar */ * nofNodes * sizeof(float); + int bytesScalarData = 1 /*scalar */ * nofNodes * sizeof(double); int offset = 0; //VTK FILE @@ -1560,7 +1562,7 @@ std::string WbWriterVtkXmlBinary::writeNodesWithNodeData(const std::string& file out<<" <PointData>\n"; for(size_t s=0; s<datanames.size(); ++s) { - out<< " <DataArray type=\"Float32\" Name=\""<< datanames[s] <<"\" format=\"appended\" offset=\""<< offset <<"\" /> \n"; + out<< " <DataArray type=\"Float64\" Name=\""<< datanames[s] <<"\" format=\"appended\" offset=\""<< offset <<"\" /> \n"; offset += (bytesPerByteVal + bytesScalarData); } out<<" </PointData>\n"; @@ -1606,8 +1608,10 @@ std::string WbWriterVtkXmlBinary::writeNodesWithNodeData(const std::string& file for(size_t d=0; d<nodedata[s].size(); ++d) { //loake kopie machen, da in nodedata "doubles" sind - float tmp = (float)nodedata[s][d]; - out.write((char*)&tmp,sizeof(float)); + //float tmp = (float)nodedata[s][d]; + //out.write((char*)&tmp,sizeof(float)); + double tmp = nodedata[s][d]; + out.write((char*)&tmp, sizeof(double)); } } out<<"\n</AppendedData>\n"; diff --git a/gpu/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlBinary.h b/gpu/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlBinary.h index 82db1c330..f1f4e06e2 100644 --- a/gpu/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlBinary.h +++ b/gpu/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlBinary.h @@ -7,8 +7,6 @@ #include <basics/writer/WbWriter.h> -#include <boost/serialization/base_object.hpp> - class VF_PUBLIC WbWriterVtkXmlBinary : public WbWriter { public: @@ -93,12 +91,7 @@ public: std::string writeOctsWithNodeData(const std::string& filename,std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleUInt8 >& cells, std::vector<std::string >& datanames, std::vector<std::vector<double > >& nodedata); private: - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & boost::serialization::base_object<WbWriter>(*this); - } + }; #ifndef SWIG diff --git a/gpu/src/VirtualFluidsBasics/numerics/geometry3d/CoordinateTransformation3D.h b/gpu/src/VirtualFluidsBasics/numerics/geometry3d/CoordinateTransformation3D.h index 8c56d54ef..3179de328 100644 --- a/gpu/src/VirtualFluidsBasics/numerics/geometry3d/CoordinateTransformation3D.h +++ b/gpu/src/VirtualFluidsBasics/numerics/geometry3d/CoordinateTransformation3D.h @@ -38,7 +38,7 @@ // |--1--2--3--4--5------------- > x1 // // Bemerkung: kann sein, dass die Verdrehung um x1 und x3 vertauschst sind -// - muss mal einer prüfen ... +// - muss mal einer pr�fen ... @@ -61,7 +61,7 @@ public: double getRotationX2Angle() const { return this->beta; } double getRotationX3Angle() const { return this->gamma; } //Rotation - //Achtung die Winkel passen nicht überein -siehe setTransformationValues + //Achtung die Winkel passen nicht �berein -siehe setTransformationValues void setRotationX1Angle(double alpha) { this->setTransformationValues(this->Tx1, this->Tx2, this->Tx3, this->Sx1, this->Sx2, this->Sx3, alpha, this->beta, this->gamma); } void setRotationX2Angle(double beta ) { this->setTransformationValues(this->Tx1, this->Tx2, this->Tx3, this->Sx1, this->Sx2, this->Sx3, this->alpha, beta, this->gamma); } void setRotationX3Angle(double gamma) { this->setTransformationValues(this->Tx1, this->Tx2, this->Tx3, this->Sx1, this->Sx2, this->Sx3, this->alpha, this->beta, gamma); } @@ -150,8 +150,11 @@ private: bool active; bool transformation; + friend class MPIIOCoProcessor; friend class MPIIORestartCoProcessor; friend class MPIIOMigrationCoProcessor; + friend class MPIIOMigrationBECoProcessor; + friend class CheckpointConverter; }; #endif //COORDINATETRANSFORMATION3D_H diff --git a/gpu/src/VirtualFluidsBasics/numerics/geometry3d/GbCuboid3D.cpp b/gpu/src/VirtualFluidsBasics/numerics/geometry3d/GbCuboid3D.cpp index de4b50e74..2fa48953c 100644 --- a/gpu/src/VirtualFluidsBasics/numerics/geometry3d/GbCuboid3D.cpp +++ b/gpu/src/VirtualFluidsBasics/numerics/geometry3d/GbCuboid3D.cpp @@ -556,7 +556,7 @@ double GbCuboid3D::getIntersectionRaytraceFactor(const double& x1, const double& return maxT[whichPlane] ; /* ray hits box */ } -// /*==========================================================*/ +/*==========================================================*/ // double GbCuboid3D::getIntersectionRaytraceFactor(const double& x1, const double& x2, const double& x3, const double& rx1, const double& rx2, const double& rx3) // { // double absX,absMaxX,absY,absMaxY,absZ,absMaxZ; @@ -623,8 +623,8 @@ double GbCuboid3D::getIntersectionRaytraceFactor(const double& x1, const double& // //in dieser Fall gibt es keine Verschneidung // if( (tmin > tymax) || (tymin > tmax) ) return -1; // -// tmin = UbMath::max3(tmin,tymin,tzmin); -// tmax = UbMath::min3(tmax,tymax,tzmax); +// tmin = UbMath::max(tmin,tymin,tzmin); +// tmax = UbMath::min(tmax,tymax,tzmax); // // if( (tmin > tzmax) || (tzmin > tmax) ) return -1; // if(tmin >= 0.0) return tmin ; diff --git a/gpu/src/VirtualFluidsBasics/numerics/geometry3d/GbTriFaceMesh3D.cpp b/gpu/src/VirtualFluidsBasics/numerics/geometry3d/GbTriFaceMesh3D.cpp index 888dfc347..4715c64c8 100644 --- a/gpu/src/VirtualFluidsBasics/numerics/geometry3d/GbTriFaceMesh3D.cpp +++ b/gpu/src/VirtualFluidsBasics/numerics/geometry3d/GbTriFaceMesh3D.cpp @@ -590,6 +590,7 @@ vector<GbTriangle3D*> GbTriFaceMesh3D::getSurfaceTriangleSet() /*=======================================================*/ void GbTriFaceMesh3D::addSurfaceTriangleSet(vector<UbTupleFloat3>& pts, vector<UbTupleInt3>& tris) { + int nodeNr = pts.size(); for(int i=0; i<(int)this->triangles->size(); i++) { Vertex& v1 = (*nodes)[(*triangles)[i].v1]; @@ -599,8 +600,9 @@ void GbTriFaceMesh3D::addSurfaceTriangleSet(vector<UbTupleFloat3>& pts, vector<U pts.push_back( makeUbTuple(v2.x,v2.y,v2.z)); pts.push_back( makeUbTuple(v3.x,v3.y,v3.z)); - tris.push_back( makeUbTuple( 3*i, 3*i+1, 3*i+2) ); - } + tris.push_back( makeUbTuple( nodeNr, nodeNr+1, nodeNr+2 ) ); + nodeNr+=3; + } } /*======================================================================*/ //bool GbTriFaceMesh3D::isPointInGbObject3D(const double& x1, const double& x2, const double& x3, int counter) diff --git a/gpu/src/VirtualFluidsBasics/numerics/geometry3d/GbVoxelMatrix3D.cpp b/gpu/src/VirtualFluidsBasics/numerics/geometry3d/GbVoxelMatrix3D.cpp index 1a9d3e06a..5552482bb 100644 --- a/gpu/src/VirtualFluidsBasics/numerics/geometry3d/GbVoxelMatrix3D.cpp +++ b/gpu/src/VirtualFluidsBasics/numerics/geometry3d/GbVoxelMatrix3D.cpp @@ -209,9 +209,9 @@ long GbVoxelMatrix3D::getNumberOfFluid() /*=======================================================*/ double GbVoxelMatrix3D::getIntersectionRaytraceFactor(const double& x1, const double& x2, const double& x3, const double& rx1, const double& rx2, const double& rx3) { - if (!((UbMath::equal(rx1, 0.0)||UbMath::equal(fabs(rx1), 1.0)||UbMath::equal(fabs(rx1), UbMath::one_over_sqrt2)) - &&(UbMath::equal(rx2, 0.0)||UbMath::equal(fabs(rx2), 1.0)||UbMath::equal(fabs(rx2), UbMath::one_over_sqrt2)) - &&(UbMath::equal(rx3, 0.0)||UbMath::equal(fabs(rx3), 1.0)||UbMath::equal(fabs(rx3), UbMath::one_over_sqrt2)))) + if (!((UbMath::equal(rx1, 0.0)||UbMath::equal(fabs(rx1), 1.0)||UbMath::equal(fabs(rx1), UbMath::one_over_sqrt2)||UbMath::equal(fabs(rx1), UbMath::one_over_sqrt3)) + &&(UbMath::equal(rx2, 0.0)||UbMath::equal(fabs(rx2), 1.0)||UbMath::equal(fabs(rx2), UbMath::one_over_sqrt2)||UbMath::equal(fabs(rx2), UbMath::one_over_sqrt3)) + &&(UbMath::equal(rx3, 0.0)||UbMath::equal(fabs(rx3), 1.0)||UbMath::equal(fabs(rx3), UbMath::one_over_sqrt2)||UbMath::equal(fabs(rx3), UbMath::one_over_sqrt3)))) { throw UbException(UB_EXARGS, "nur fuer diskrete Boltzmannrichungen implementiert!!!"); } @@ -279,7 +279,7 @@ bool GbVoxelMatrix3D::isPointInGbObject3D(const double& x1p, const double& x2p, bool GbVoxelMatrix3D::isCellInsideGbObject3D(const double& x1p1, const double& x2p1, const double& x3p1, const double& x1p2, const double& x2p2, const double& x3p2) { return false; - //dass hängt von der Konfigration ab, aber meist ist der Block grösser wie etliche Poren ... + //dass h�ngt von der Konfigration ab, aber meist ist der Block gr�sser wie etliche Poren ... //indizes ermitteln int startix1 = (int)std::floor((x1p1-minX1)/deltaX1+1E-13); @@ -1094,8 +1094,8 @@ void GbVoxelMatrix3D::writeToVTKImageDataAppended(const std::string& fileName) fclose(file); file = fopen(fn.c_str(), "ab"); - int size = (int)voxelMatrix.getDataVector().size()*sizeof(float); - fwrite(&size, sizeof(int), 1, file); + unsigned long long size = (unsigned long long)voxelMatrix.getDataVector().size()*sizeof(float); + fwrite(&size, sizeof(unsigned long long), 1, file); fwrite(voxelMatrix.getStartAdressOfSortedArray(0, 0, 0), sizeof(float), voxelMatrix.getDataVector().size(), file); fclose(file); diff --git a/gpu/targets/libs/VirtualFluidsBasics/CMakeLists.txt b/gpu/targets/libs/VirtualFluidsBasics/CMakeLists.txt index 32d79ad49..1d0e198b3 100644 --- a/gpu/targets/libs/VirtualFluidsBasics/CMakeLists.txt +++ b/gpu/targets/libs/VirtualFluidsBasics/CMakeLists.txt @@ -1,5 +1,5 @@ -setTargetNameToFolderName(${CMAKE_CURRENT_LIST_DIR}) - +#setTargetNameToFolderName(${CMAKE_CURRENT_LIST_DIR}) +set (targetName "VirtualFluidsBasics") set(linkDirectories "") set(libsToLink Core) set(includeDirectories ${CMAKE_SOURCE_DIR}/src/${targetName} -- GitLab