From 152e3cfb7a2d05021e31338a703d1f773806aea8 Mon Sep 17 00:00:00 2001 From: Soeren Peters <peters@irmb.tu-bs.de> Date: Tue, 1 Sep 2020 18:00:08 +0200 Subject: [PATCH] Remove unused basics stuff. --- apps/cpu/VirtualFluids.h | 13 - src/basics/CMakeLists.txt | 52 +- .../examples/CbVectorPool/CMakeLists.txt | 30 - .../examples/CbVectorPool/functions.h | 190 ----- .../container/examples/CbVectorPool/main.cpp | 277 ------- src/basics/basics/memory/MbChessMemPool2D.h | 519 ------------- src/basics/basics/memory/MbChessMemPool3D.h | 537 -------------- src/basics/basics/memory/MbMemPool.h | 87 --- .../basics/memory/MbSharedPointerDefines.h | 22 - src/basics/basics/objects/ObCreator.h | 112 --- src/basics/basics/objects/ObFactory.h | 174 ----- src/basics/basics/objects/ObObject.cpp | 10 - src/basics/basics/objects/ObObjectCreator.h | 58 -- src/basics/basics/objects/ObObjectFactory.cpp | 54 -- src/basics/basics/objects/ObObjectFactory.h | 42 -- src/basics/basics/objects/ObObjectManager.cpp | 216 ------ src/basics/basics/objects/ObObjectManager.h | 79 -- src/basics/basics/parallel/PbMpiTools.h | 303 -------- .../examples/simpleMPI/CMakeLists.txt | 64 -- .../parallel/examples/simpleMPI/functions.h | 193 ----- .../parallel/examples/simpleMPI/main.cpp | 101 --- src/basics/basics/relation/RbAggregation.h | 70 -- src/basics/basics/utilities/UbAutoRun.hpp | 58 -- src/basics/basics/utilities/UbConverter.cpp | 96 --- src/basics/basics/utilities/UbConverter.h | 49 -- .../basics/utilities/UbPointerWrapper.h | 36 - .../basics/utilities/UbStaticPathMap.cpp | 4 - src/basics/basics/utilities/UbStaticPathMap.h | 71 -- src/basics/basics/utilities/UbString.h | 24 - src/basics/basics/utilities/UbTableModel.cpp | 20 - src/basics/basics/utilities/UbTableModel.h | 37 - src/basics/basics/utilities/UbTuple.cpp | 2 - src/basics/geometry3d/GbTriFaceMesh3D.h | 4 +- src/basics/geometry3d/KdTree/KdTree.h | 1 - .../examples/AdvancedPIOTests/CMakeLists.txt | 39 - .../KdTree/examples/AdvancedPIOTests/main.cpp | 542 -------------- .../KdTree/examples/PIOTests/CMakeLists.txt | 36 - .../KdTree/examples/PIOTests/main.cpp | 342 --------- .../insideOutsideTests/CMakeLists.txt | 61 -- .../examples/insideOutsideTests/main.cpp | 46 -- .../examples/stl2inp/CMakeLists.txt | 140 ---- .../examples/stl2inp/QDefineUniformMesh.cpp | 17 - .../examples/stl2inp/QDefineUniformMesh.h | 35 - .../examples/stl2inp/QDefineUniformMesh.ui | 258 ------- .../geometry3d/examples/stl2inp/main.cpp | 15 - .../geometry3d/examples/stl2inp/stl2inp.cpp | 261 ------- .../geometry3d/examples/stl2inp/stl2inp.h | 36 - .../geometry3d/examples/stl2inp/stl2inp.ui | 452 ------------ .../geometry3d/fem/FeAdhocTriFaceMesh3D.cpp | 124 ---- .../geometry3d/fem/FeAdhocTriFaceMesh3D.h | 62 -- src/basics/geometry3d/fem/FeHalfDisc3D.cpp | 622 ---------------- src/basics/geometry3d/fem/FeHalfDisc3D.h | 104 --- .../fem/FePlateTriangularMesh3D.cpp | 223 ------ .../geometry3d/fem/FePlateTriangularMesh3D.h | 50 -- src/basics/geometry3d/fem/FePoint3D.h | 148 ---- src/basics/geometry3d/fem/FeRing3D.cpp | 468 ------------ src/basics/geometry3d/fem/FeRing3D.h | 107 --- src/basics/geometry3d/fem/FeTriFaceMesh3D.cpp | 256 ------- src/basics/geometry3d/fem/FeTriFaceMesh3D.h | 204 ------ .../fem/creator/FeTriFaceMesh3DCreator.cpp | 417 ----------- .../fem/creator/FeTriFaceMesh3DCreator.h | 82 --- .../presentation/QGbCuboid3DInstrument.cpp | 67 -- .../presentation/QGbCuboid3DInstrument.h | 31 - .../presentation/QGbCuboid3DInstrument.ui | 347 --------- .../presentation/QGbCylinder3DInstrument.cpp | 102 --- .../presentation/QGbCylinder3DInstrument.h | 35 - .../presentation/QGbCylinder3DInstrument.ui | 682 ------------------ .../presentation/QGbObject3DInstrument.cpp | 66 -- .../presentation/QGbObject3DInstrument.h | 30 - .../presentation/QGbObject3DInstrument.ui | 512 ------------- .../presentation/QGbSphere3DInstrument.cpp | 60 -- .../presentation/QGbSphere3DInstrument.h | 36 - .../presentation/QGbSphere3DInstrument.ui | 303 -------- .../presentation/QVTKGbObject3DViewer.cpp | 35 - .../presentation/QVTKGbObject3DViewer.h | 22 - .../geometry3d/presentation/vtkGbCuboid3D.cpp | 144 ---- .../geometry3d/presentation/vtkGbCuboid3D.h | 29 - .../presentation/vtkGbCylinder3D.cpp | 103 --- .../geometry3d/presentation/vtkGbCylinder3D.h | 30 - .../geometry3d/presentation/vtkGbSphere3D.cpp | 112 --- .../geometry3d/presentation/vtkGbSphere3D.h | 33 - .../presentation/vtkGbTriangularMesh3D.cpp | 167 ----- .../presentation/vtkGbTriangularMesh3D.h | 31 - .../BoundaryConditions/BCAdapter.h | 2 - .../BoundaryConditions/DensityBCAdapter.h | 1 - .../BoundaryConditions/SlipBCAdapter.h | 1 - .../D3Q27TriFaceMeshInteractor.cpp | 1 - 87 files changed, 10 insertions(+), 11724 deletions(-) delete mode 100644 src/basics/basics/container/examples/CbVectorPool/CMakeLists.txt delete mode 100644 src/basics/basics/container/examples/CbVectorPool/functions.h delete mode 100644 src/basics/basics/container/examples/CbVectorPool/main.cpp delete mode 100644 src/basics/basics/memory/MbChessMemPool2D.h delete mode 100644 src/basics/basics/memory/MbChessMemPool3D.h delete mode 100644 src/basics/basics/memory/MbMemPool.h delete mode 100644 src/basics/basics/memory/MbSharedPointerDefines.h delete mode 100644 src/basics/basics/objects/ObCreator.h delete mode 100644 src/basics/basics/objects/ObFactory.h delete mode 100644 src/basics/basics/objects/ObObject.cpp delete mode 100644 src/basics/basics/objects/ObObjectCreator.h delete mode 100644 src/basics/basics/objects/ObObjectFactory.cpp delete mode 100644 src/basics/basics/objects/ObObjectFactory.h delete mode 100644 src/basics/basics/objects/ObObjectManager.cpp delete mode 100644 src/basics/basics/objects/ObObjectManager.h delete mode 100644 src/basics/basics/parallel/PbMpiTools.h delete mode 100644 src/basics/basics/parallel/examples/simpleMPI/CMakeLists.txt delete mode 100644 src/basics/basics/parallel/examples/simpleMPI/functions.h delete mode 100644 src/basics/basics/parallel/examples/simpleMPI/main.cpp delete mode 100644 src/basics/basics/relation/RbAggregation.h delete mode 100644 src/basics/basics/utilities/UbAutoRun.hpp delete mode 100644 src/basics/basics/utilities/UbConverter.cpp delete mode 100644 src/basics/basics/utilities/UbConverter.h delete mode 100644 src/basics/basics/utilities/UbPointerWrapper.h delete mode 100644 src/basics/basics/utilities/UbStaticPathMap.cpp delete mode 100644 src/basics/basics/utilities/UbStaticPathMap.h delete mode 100644 src/basics/basics/utilities/UbString.h delete mode 100644 src/basics/basics/utilities/UbTableModel.cpp delete mode 100644 src/basics/basics/utilities/UbTableModel.h delete mode 100644 src/basics/basics/utilities/UbTuple.cpp delete mode 100644 src/basics/geometry3d/KdTree/examples/AdvancedPIOTests/CMakeLists.txt delete mode 100644 src/basics/geometry3d/KdTree/examples/AdvancedPIOTests/main.cpp delete mode 100644 src/basics/geometry3d/KdTree/examples/PIOTests/CMakeLists.txt delete mode 100644 src/basics/geometry3d/KdTree/examples/PIOTests/main.cpp delete mode 100644 src/basics/geometry3d/examples/insideOutsideTests/CMakeLists.txt delete mode 100644 src/basics/geometry3d/examples/insideOutsideTests/main.cpp delete mode 100644 src/basics/geometry3d/examples/stl2inp/CMakeLists.txt delete mode 100644 src/basics/geometry3d/examples/stl2inp/QDefineUniformMesh.cpp delete mode 100644 src/basics/geometry3d/examples/stl2inp/QDefineUniformMesh.h delete mode 100644 src/basics/geometry3d/examples/stl2inp/QDefineUniformMesh.ui delete mode 100644 src/basics/geometry3d/examples/stl2inp/main.cpp delete mode 100644 src/basics/geometry3d/examples/stl2inp/stl2inp.cpp delete mode 100644 src/basics/geometry3d/examples/stl2inp/stl2inp.h delete mode 100644 src/basics/geometry3d/examples/stl2inp/stl2inp.ui delete mode 100644 src/basics/geometry3d/fem/FeAdhocTriFaceMesh3D.cpp delete mode 100644 src/basics/geometry3d/fem/FeAdhocTriFaceMesh3D.h delete mode 100644 src/basics/geometry3d/fem/FeHalfDisc3D.cpp delete mode 100644 src/basics/geometry3d/fem/FeHalfDisc3D.h delete mode 100644 src/basics/geometry3d/fem/FePlateTriangularMesh3D.cpp delete mode 100644 src/basics/geometry3d/fem/FePlateTriangularMesh3D.h delete mode 100644 src/basics/geometry3d/fem/FePoint3D.h delete mode 100644 src/basics/geometry3d/fem/FeRing3D.cpp delete mode 100644 src/basics/geometry3d/fem/FeRing3D.h delete mode 100644 src/basics/geometry3d/fem/FeTriFaceMesh3D.cpp delete mode 100644 src/basics/geometry3d/fem/FeTriFaceMesh3D.h delete mode 100644 src/basics/geometry3d/fem/creator/FeTriFaceMesh3DCreator.cpp delete mode 100644 src/basics/geometry3d/fem/creator/FeTriFaceMesh3DCreator.h delete mode 100644 src/basics/geometry3d/presentation/QGbCuboid3DInstrument.cpp delete mode 100644 src/basics/geometry3d/presentation/QGbCuboid3DInstrument.h delete mode 100644 src/basics/geometry3d/presentation/QGbCuboid3DInstrument.ui delete mode 100644 src/basics/geometry3d/presentation/QGbCylinder3DInstrument.cpp delete mode 100644 src/basics/geometry3d/presentation/QGbCylinder3DInstrument.h delete mode 100644 src/basics/geometry3d/presentation/QGbCylinder3DInstrument.ui delete mode 100644 src/basics/geometry3d/presentation/QGbObject3DInstrument.cpp delete mode 100644 src/basics/geometry3d/presentation/QGbObject3DInstrument.h delete mode 100644 src/basics/geometry3d/presentation/QGbObject3DInstrument.ui delete mode 100644 src/basics/geometry3d/presentation/QGbSphere3DInstrument.cpp delete mode 100644 src/basics/geometry3d/presentation/QGbSphere3DInstrument.h delete mode 100644 src/basics/geometry3d/presentation/QGbSphere3DInstrument.ui delete mode 100644 src/basics/geometry3d/presentation/QVTKGbObject3DViewer.cpp delete mode 100644 src/basics/geometry3d/presentation/QVTKGbObject3DViewer.h delete mode 100644 src/basics/geometry3d/presentation/vtkGbCuboid3D.cpp delete mode 100644 src/basics/geometry3d/presentation/vtkGbCuboid3D.h delete mode 100644 src/basics/geometry3d/presentation/vtkGbCylinder3D.cpp delete mode 100644 src/basics/geometry3d/presentation/vtkGbCylinder3D.h delete mode 100644 src/basics/geometry3d/presentation/vtkGbSphere3D.cpp delete mode 100644 src/basics/geometry3d/presentation/vtkGbSphere3D.h delete mode 100644 src/basics/geometry3d/presentation/vtkGbTriangularMesh3D.cpp delete mode 100644 src/basics/geometry3d/presentation/vtkGbTriangularMesh3D.h diff --git a/apps/cpu/VirtualFluids.h b/apps/cpu/VirtualFluids.h index 9d667ae25..c6f3a2a6c 100644 --- a/apps/cpu/VirtualFluids.h +++ b/apps/cpu/VirtualFluids.h @@ -33,22 +33,13 @@ #include <basics/container/CbArray4D.h> #include <basics/container/CbVector.h> #include <basics/container/CbVectorPool.h> -#include <basics/memory/MbMemPool.h> -#include <basics/memory/MbSharedPointerDefines.h> #include <basics/memory/MbSmartPtr.h> #include <basics/memory/MbSmartPtrBase.h> -#include <basics/objects/ObCreator.h> -#include <basics/objects/ObFactory.h> #include <basics/objects/ObObject.h> -#include <basics/objects/ObObjectCreator.h> -#include <basics/objects/ObObjectFactory.h> -#include <basics/objects/ObObjectManager.h> #include <basics/transmitter/TbTransmitter.h> #include <basics/transmitter/TbTransmitterLocal.h> #include <basics/transmitter/TbTransmitterMpiPool.h> -#include <basics/utilities/UbAutoRun.hpp> #include <basics/utilities/UbComparators.h> -#include <basics/utilities/UbConverter.h> #include <basics/utilities/UbEqual.h> #include <basics/utilities/UbException.h> #include <basics/utilities/UbFileInput.h> @@ -65,14 +56,10 @@ #include <basics/utilities/UbNupsTimer.h> #include <basics/utilities/UbObservable.h> #include <basics/utilities/UbObserver.h> -#include <basics/utilities/UbPointerWrapper.h> #include <basics/utilities/UbRandom.h> #include <basics/utilities/UbScheduler.h> -#include <basics/utilities/UbStaticPathMap.h> -#include <basics/utilities/UbString.h> #include <basics/utilities/UbStringInputASCII.h> #include <basics/utilities/UbSystem.h> -#include <basics/utilities/UbTableModel.h> #include <basics/utilities/UbTiming.h> #include <basics/utilities/UbTuple.h> #include <basics/writer/WbWriter.h> diff --git a/src/basics/CMakeLists.txt b/src/basics/CMakeLists.txt index e10456fbe..7b2023b80 100644 --- a/src/basics/CMakeLists.txt +++ b/src/basics/CMakeLists.txt @@ -1,52 +1,18 @@ -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_LIST_DIR}) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_LIST_DIR}/geometry3d) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_LIST_DIR}/geometry3d/KdTree) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_LIST_DIR}/basics/container) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_LIST_DIR}/basics/memory) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_LIST_DIR}/basics/objects) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_LIST_DIR}/basics/transmiitter) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_LIST_DIR}/utilities) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_LIST_DIR}/basics/writer) - - -include (${CMAKE_SOURCE_DIR}/CMake/VirtualFluidsMacros.cmake) -#SET(CAB_ADDITIONAL_LINK_LIBRARIES ${MPI_CXX_LIBRARIES}) - include(Core/buildInfo.cmake) -INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/VirtualFluidsCore) -INCLUDE_DIRECTORIES(${MPI_INCLUDE_PATH}) - - - -vf_add_library(BUILDTYPE static - FOLDER - ${CMAKE_CURRENT_LIST_DIR}/geometry3d - ${CMAKE_CURRENT_LIST_DIR}/geometry3d/KdTree - ${CMAKE_CURRENT_LIST_DIR}/basics/container - ${CMAKE_CURRENT_LIST_DIR}/basics/memory - ${CMAKE_CURRENT_LIST_DIR}/basics/objects - ${CMAKE_CURRENT_LIST_DIR}/basics/transmiitter - ${CMAKE_CURRENT_LIST_DIR}/basics/utilities - ${CMAKE_CURRENT_LIST_DIR}/basics/writer - ${CMAKE_CURRENT_LIST_DIR}/Core - ${CMAKE_CURRENT_LIST_DIR}/Core/Logger - ${CMAKE_CURRENT_LIST_DIR}/Core/Logger/implementations - ${CMAKE_CURRENT_LIST_DIR}/Core/Input - ${CMAKE_CURRENT_LIST_DIR}/Core/Input/ConfigData - ${CMAKE_CURRENT_LIST_DIR}/Core/Input/ConfigFileReader - ${CMAKE_CURRENT_LIST_DIR}/Core/Input/ConfigInput - ${CMAKE_CURRENT_LIST_DIR}/Core/Input/JsonInput - ${CMAKE_CURRENT_LIST_DIR}/Core/StringUtilities - ${CMAKE_CURRENT_LIST_DIR}/Core/Timer - - EXCLUDE buildInfo.in.cpp - ) +vf_add_library(BUILDTYPE static EXCLUDE buildInfo.in.cpp) vf_get_library_name (library_name) target_include_directories(${library_name} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/Core) -target_include_directories(${library_name} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +target_include_directories(${library_name} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/geometry3d) +target_include_directories(${library_name} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/geometry3d/KdTree) +target_include_directories(${library_name} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/basics/container) +target_include_directories(${library_name} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/basics/memory) +target_include_directories(${library_name} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/basics/objects) +target_include_directories(${library_name} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/basics/transmitter) +target_include_directories(${library_name} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/utilities) +target_include_directories(${library_name} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/basics/writer) IF(MSVC) target_compile_definitions(${library_name} PUBLIC NOMINMAX) # Disable Min/Max-Macros diff --git a/src/basics/basics/container/examples/CbVectorPool/CMakeLists.txt b/src/basics/basics/container/examples/CbVectorPool/CMakeLists.txt deleted file mode 100644 index a5113c6e7..000000000 --- a/src/basics/basics/container/examples/CbVectorPool/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -cmake_minimum_required(VERSION 2.6) - -PROJECT(CbVectorPoolTests) - -################################################################# -# MACHINE_SPECIFIC CMAKE_CONFIG_FILE -################################################################# -INCLUDE("../../../../../../../CMake/CMakeCABMacros.txt") - -################################################################# -### PACKAGES ### -################################################################# -INCLUDE(${SOURCE_ROOT}/basics/container/CMakePackage.txt) -INCLUDE(${SOURCE_ROOT}/basics/utilities/CMakePackage.txt) -INCLUDE(${SOURCE_ROOT}/basics/memory/CMakePackage.txt) -INCLUDE(${SOURCE_ROOT}/basics/objects/CMakePackage.txt) - -################################################################# -### OWN DEFINES ### -################################################################# -FILE(GLOB SPECIFIC_FILES ${SOURCE_ROOT}/basics/container/examples/CbVectorPool/*.h - ${SOURCE_ROOT}/basics/container/examples/CbVectorPool/*.cpp ) - -SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES}) -SOURCE_GROUP(z_specific FILES ${SPECIFIC_FILES}) - -################################################################# -### PROJECT ERSTELLEN ### -################################################################# -CREATE_CAB_PROJECT() diff --git a/src/basics/basics/container/examples/CbVectorPool/functions.h b/src/basics/basics/container/examples/CbVectorPool/functions.h deleted file mode 100644 index c9a49cdf5..000000000 --- a/src/basics/basics/container/examples/CbVectorPool/functions.h +++ /dev/null @@ -1,190 +0,0 @@ -#include <iostream> -#include <stdlib.h> -#include <stdio.h> -#include <string> -#include <fstream> - -#include <basics/utilities/UbTuple.h> - -#include <basics/utilities/UbException.h> -#include <basics/utilities/UbSystem.h> -#include <basics/utilities/UbFileOutputASCII.h> -#include <basics/utilities/UbTiming.h> - -#include <basics/memory/MbSmartPtr.h> - -#include <basics/container/CbVector.h> -#include <basics/container/CbVectorPool.h> - -using std::cout; -using std::cerr; -using std::endl; -using std::vector; - -typedef long double value_type; -typedef MbSmartPtr<CbVector< value_type > > CbVectorPtr; -typedef MbSmartPtr<vector< value_type > > StlVectorPtr; - -/*==========================================================*/ -template<typename T> -inline void setValues(vector<T>& stlvec, CbVector<T>& cbvec, CbVector<T>& cbpoolvec) -{ - if(stlvec.size() != cbvec.size() || stlvec.size() != cbpoolvec.size() ) - { - cerr<<"sizes:"<<endl; - cerr<<"stlvec... = "<<(int)stlvec.size()<<endl; - cerr<<"cbvec.... = "<<(int)cbvec.size()<<endl; - cerr<<"cbpoolvec = "<<(int)cbpoolvec.size()<<endl; - throw UB_THROW( UbException("setValues - sizeCheck failed") ); - } - static value_type stlVal = 1; - static value_type cbVal = 1; - static value_type cbPoolVal = 1; - - for(size_t i=0; i<cbvec.size(); i++) stlvec[i] = stlVal ++; - for(size_t i=0; i<cbvec.size(); i++) cbvec[i] = cbVal ++; - for(size_t i=0; i<cbvec.size(); i++) cbpoolvec[i] = cbPoolVal++; -} -/*==========================================================*/ -template<typename T> -inline void setValues(vector< StlVectorPtr >& stlvecs, vector< CbVectorPtr >& cbvecs, vector< CbVectorPtr >& cbpoolvecs) -{ - if(stlvecs.size() != cbvecs.size() || stlvecs.size() != cbpoolvecs.size() ) - { - cerr<<"sizes:"<<endl; - cerr<<"stlvec... = "<<(int)stlvecs.size()<<endl; - cerr<<"cbvec.... = "<<(int)cbvecs.size()<<endl; - cerr<<"cbpoolvec = "<<(int)cbpoolvecs.size()<<endl; - throw UB_THROW( UbException("setValues glob - sizeCheck failed") ); - } - - for(size_t i=0; i<cbvecs.size(); i++) - setValues(*stlvecs[i],*cbvecs[i],*cbpoolvecs[i]); -} -/*==========================================================*/ -template<typename T> -inline void resize(vector<T>& stlvec, CbVector<T>& cbvec, CbVector<T>& cbpoolvec, std::size_t size, const T& val) -{ - stlvec.resize(size,val); - cbvec.resize(size,val); - cbpoolvec.resize(size,val); -} -/*==========================================================*/ -template<typename T> -inline void resize(vector< StlVectorPtr >& stlvecs, vector< CbVectorPtr >& cbvecs, vector< CbVectorPtr >& cbpoolvecs, std::size_t size, const value_type& val, bool timed=false) -{ - if(stlvecs.size() != cbvecs.size() || stlvecs.size() != cbpoolvecs.size() ) - { - cerr<<"sizes:"<<endl; - cerr<<"stlvec... = "<<(int)stlvecs.size()<<endl; - cerr<<"cbvec.... = "<<(int)cbvecs.size()<<endl; - cerr<<"cbpoolvec = "<<(int)cbpoolvecs.size()<<endl; - throw UB_THROW( UbException("resize glob - sizeCheck failed") ); - } - - if(timed) - { - UbTimer timer; - timer.start(); for(size_t i=0; i<cbvecs.size(); i++) stlvecs[i]->resize(size,val); if(timed) cout<<"stl-resize in "<<timer.stop()<<"s"<<endl; - timer.start(); for(size_t i=0; i<cbvecs.size(); i++) cbvecs[i]->resize(size,val); if(timed) cout<<"cbStd-resize in "<<timer.stop()<<"s"<<endl; - timer.start(); for(size_t i=0; i<cbvecs.size(); i++) cbpoolvecs[i]->resize(size,val); if(timed) cout<<"cbPool-resize in "<<timer.stop()<<"s"<<endl; - } - else - { - for(size_t i=0; i<cbvecs.size(); i++) - resize(*stlvecs[i],*cbvecs[i],*cbpoolvecs[i],size,val); - } -} -/*==========================================================*/ -inline void createVecs(size_t number, int size,vector< StlVectorPtr >& stlvecs, vector< CbVectorPtr >& cbvecs, vector< CbVectorPtr >& cbpoolvecs, CbVectorPool<value_type>*& pool, bool timed=false) -{ - UbTimer timer; - timer.start(); for(size_t i=0; i<number; i++) stlvecs.push_back(StlVectorPtr(new vector<value_type>(size))); if(timed) cout<<"stl-createVecs in "<<timer.stop()<<"s"<<endl; - timer.start(); for(size_t i=0; i<number; i++) cbvecs.push_back(CbVectorPtr(new CbVector<value_type>(size))); if(timed) cout<<"cbStd-createVecs in "<<timer.stop()<<"s"<<endl; - timer.start(); for(size_t i=0; i<number; i++) cbpoolvecs.push_back(CbVectorPtr(new CbVector<value_type>(size,new CbVectorAllocatorPool<value_type>(pool)))); if(timed) cout<<"cbPool-createVecs in "<<timer.stop()<<"s"<<endl; - - for(size_t i=0; i<cbvecs.size(); i++) setValues(*stlvecs.back(),*cbvecs.back(),*cbpoolvecs.back()); -} -/*==========================================================*/ -inline void createVecs(size_t number, size_t size, const value_type& val,vector< StlVectorPtr >& stlvecs, vector< CbVectorPtr >& cbvecs, vector< CbVectorPtr >& cbpoolvecs, CbVectorPool<value_type>*& pool, bool timed=false) -{ - UbTimer timer; - timer.start(); for(size_t i=0; i<number; i++) stlvecs.push_back(StlVectorPtr(new vector<value_type>(size,val))); if(timed) cout<<"stl-createVecs in "<<timer.stop()<<"s"<<endl; - timer.start(); for(size_t i=0; i<number; i++) cbvecs.push_back(CbVectorPtr(new CbVector<value_type>(size,new CbVectorAllocatorStd<value_type>(),val))); if(timed) cout<<"cbStd-createVecs in "<<timer.stop()<<"s"<<endl; - timer.start(); for(size_t i=0; i<number; i++) cbpoolvecs.push_back(CbVectorPtr(new CbVector<value_type>(size,new CbVectorAllocatorPool<value_type>(pool),val))); if(timed) cout<<"cbPool-createVecs in "<<timer.stop()<<"s"<<endl; -} -/*==========================================================*/ -template<typename T> -inline void equalCheck(vector<T>& stlvec, CbVector<T>& cbvec, CbVector<T>& cbpoolvec) -{ - if(stlvec.size() != cbvec.size() || stlvec.size() != cbpoolvec.size() ) - { - cerr<<"sizes:"<<endl; - cerr<<"stlvec... = "<<(int)stlvec.size()<<endl; - cerr<<"cbvec.... = "<<(int)cbvec.size()<<endl; - cerr<<"cbpoolvec = "<<(int)cbpoolvec.size()<<endl; - throw UB_THROW( UbException("equalCheck - sizeCheck failed") ); - } - - bool check=true; - for(size_t i=0; i<cbvec.size(); i++) - if(stlvec[i] != cbvec[i] || stlvec[i] != cbpoolvec[i] ) - check=false; - - if(!check) - { - cerr<<"\nstl - "; for(size_t i=0; i<cbvec.size(); i++) cout<<stlvec[i]<<" "; cout<<endl; - cerr<< "cbv - "; for(size_t i=0; i<cbvec.size(); i++) cout<<cbvec[i]<<" "; cout<<endl; - cerr<< "cbp - "; for(size_t i=0; i<cbvec.size(); i++) cout<<cbpoolvec[i]<<" "; cout<<endl; - throw UB_THROW( UbException("equalCheck - equalCheck failed") ); - } -} -/*==========================================================*/ -template<typename T> -void equalCheck(vector< StlVectorPtr >& stlvecs, vector< CbVectorPtr >& cbvecs, vector< CbVectorPtr >& cbpoolvecs) -{ - if(stlvecs.size() != cbvecs.size() || stlvecs.size() != cbpoolvecs.size() ) - { - cerr<<"sizes:"<<endl; - cerr<<"stlvec... = "<<(int)stlvecs.size()<<endl; - cerr<<"cbvec.... = "<<(int)cbvecs.size()<<endl; - cerr<<"cbpoolvec = "<<(int)cbpoolvecs.size()<<endl; - throw UB_THROW( UbException("equalCheck - sizeCheck failed") ); - } - - for(size_t i=0; i<cbvecs.size(); i++) - { - //cout<<"equalCheck i="<<i<<"/"<<cbvecs.size()-1; - equalCheck(*stlvecs[i],*cbvecs[i],*cbpoolvecs[i]); - //cout<<" passed"<<endl; - } -} -/*==========================================================*/ -void accessCheck(int times,vector< StlVectorPtr >& stlvecs, vector< CbVectorPtr >& cbvecs, vector< CbVectorPtr >& cbpoolvecs) -{ - UbTimer timer; - timer.start(); - for(size_t i=0; i<stlvecs.size(); i++) - { - vector<value_type>& vec = *stlvecs[i]; - for(int m=0; m<times; m++) - for(vector<value_type>::size_type k=0; k<vec.size(); k++) vec[k] = k; - } - cout<<"stl-accessCheck in "<<timer.stop()<<"s"<<endl; - timer.start(); - for(size_t i=0; i<cbvecs.size(); i++) - { - CbVector<value_type>& vec = *cbvecs[i]; - for(int m=0; m<times; m++) - for(vector<value_type>::size_type k=0; k<vec.size(); k++) vec[k] = k; - } - cout<<"cbStd-accessCheck in "<<timer.stop()<<"s"<<endl; - timer.start(); - for(size_t i=0; i<cbpoolvecs.size(); i++) - { - CbVector<value_type>& vec = *cbpoolvecs[i]; - for(int m=0; m<times; m++) - for(vector<value_type>::size_type k=0; k<vec.size(); k++) vec[k] = k; - } - cout<<"cbPool-accessCheck in "<<timer.stop()<<"s"<<endl; -} diff --git a/src/basics/basics/container/examples/CbVectorPool/main.cpp b/src/basics/basics/container/examples/CbVectorPool/main.cpp deleted file mode 100644 index ede778c94..000000000 --- a/src/basics/basics/container/examples/CbVectorPool/main.cpp +++ /dev/null @@ -1,277 +0,0 @@ -#include "./functions.h" - -using namespace std; - -////////////////////////////////////////////////////////////////////////// -int main(int argc, char** argv) -{ - try - { - { - CbVectorPool<float>* floatPool = new CbVectorPool<float>(0); - CbVector<float> v1,v2,v3; - CbVector<float> v0(new CbVectorAllocatorPool<float>(104,floatPool) ); - v0.resize(20); - v0[3] = 60000; - v0.resize(40); - v0[3] = 90000; - v1.setAllocator( new CbVectorAllocatorPool<float>(100,floatPool) ); - v2.setAllocator( new CbVectorAllocatorPool<float>(101,floatPool) ); - v3.setAllocator( new CbVectorAllocatorPool<float>(102,floatPool) ); - v1.resize(20, 0.0); - v1.resize(30, 0.0); - v2.resize(0); - v2.resize(40, 0.0); - v3.resize(30, 0.0); - v3.resize(50, 0.0); - - for(CbVector<float>::size_type i=v1.size()-1; i>=15; i--) - v1[i] = (CbVector<float>::value_type)i; - for(CbVector<float>::size_type i=v2.size()-1; i>=35; i--) - v2[i] = (CbVector<float>::value_type)i; - for(CbVector<float>::size_type i=v3.size()-1; i>=10; i--) - v3[i] = (CbVector<float>::value_type)i; - v1.size(); - v2.size(); - v3.size(); - for(CbVector<float>::size_type i=0; i<v1.size(); i++) v1[i]; - v1.size(); - v2.size(); - v3.size(); - for(CbVector<float>::size_type i=0; i<v2.size(); i++) v2[i]; - v1.size(); - v2.size(); - v3.size(); - for(CbVector<float>::size_type i=0; i<v3.size(); i++) v3[i]; - } - - CbVectorPool<value_type>* vectorPool = new CbVectorPool<value_type>(0); - - vector< StlVectorPtr > stlVecs; - vector< CbVectorPtr > cbVecs; - vector< CbVectorPtr > cbPoolVecs; - - cout<<"check"<<__LINE__<<endl; - createVecs(10,12,0,stlVecs,cbVecs,cbPoolVecs,vectorPool); - equalCheck(stlVecs,cbVecs,cbPoolVecs); - - cout<<"check"<<__LINE__<<endl; - resize(stlVecs,cbVecs,cbPoolVecs,0,2); - equalCheck(stlVecs,cbVecs,cbPoolVecs); - - cout<<"check"<<__LINE__<<endl; - resize(stlVecs,cbVecs,cbPoolVecs,3,3); - equalCheck(stlVecs,cbVecs,cbPoolVecs); - - cout<<"check"<<__LINE__<<endl; - setValues(stlVecs,cbVecs,cbPoolVecs); - equalCheck(stlVecs,cbVecs,cbPoolVecs); - - cout<<"check"<<__LINE__<<endl; - createVecs(8,5,stlVecs,cbVecs,cbPoolVecs,vectorPool); - equalCheck(stlVecs,cbVecs,cbPoolVecs); - - cout<<"check"<<__LINE__<<endl; - resize(stlVecs,cbVecs,cbPoolVecs,20,7); - equalCheck(stlVecs,cbVecs,cbPoolVecs); - - cout<<"check"<<__LINE__<<endl; - equalCheck(stlVecs,cbVecs,cbPoolVecs); - - cout<<"check"<<__LINE__<<endl; - setValues(stlVecs,cbVecs,cbPoolVecs); - equalCheck(stlVecs,cbVecs,cbPoolVecs); - - cout<<"check"<<__LINE__<<endl; - resize(stlVecs,cbVecs,cbPoolVecs,20,3); - equalCheck(stlVecs,cbVecs,cbPoolVecs); - - cout<<"check"<<__LINE__<<endl; - setValues(stlVecs,cbVecs,cbPoolVecs); - equalCheck(stlVecs,cbVecs,cbPoolVecs); - - cout<<"check"<<__LINE__<<endl; - resize(stlVecs,cbVecs,cbPoolVecs,0,7); - equalCheck(stlVecs,cbVecs,cbPoolVecs); - - cout<<"check"<<__LINE__<<endl; - setValues(stlVecs,cbVecs,cbPoolVecs); - equalCheck(stlVecs,cbVecs,cbPoolVecs); - - cout<<"check"<<__LINE__<<endl; - resize(stlVecs,cbVecs,cbPoolVecs,20,3); - equalCheck(stlVecs,cbVecs,cbPoolVecs); - - cout<<"check"<<__LINE__<<endl; - setValues(stlVecs,cbVecs,cbPoolVecs); - equalCheck(stlVecs,cbVecs,cbPoolVecs); - - cout<<"check"<<__LINE__<<endl; - createVecs(4,3,stlVecs,cbVecs,cbPoolVecs,vectorPool); - equalCheck(stlVecs,cbVecs,cbPoolVecs); - - cout<<"check"<<__LINE__<<endl; - resize(stlVecs,cbVecs,cbPoolVecs,20,3); - equalCheck(stlVecs,cbVecs,cbPoolVecs); - - cout<<"check"<<__LINE__<<endl; - setValues(stlVecs,cbVecs,cbPoolVecs); - equalCheck(stlVecs,cbVecs,cbPoolVecs); - - cout<<"check"<<__LINE__<<endl; - resize(stlVecs,cbVecs,cbPoolVecs,0,7); - equalCheck(stlVecs,cbVecs,cbPoolVecs); - - cout<<"check"<<__LINE__<<endl; - setValues(stlVecs,cbVecs,cbPoolVecs); - equalCheck(stlVecs,cbVecs,cbPoolVecs); - - cout<<"check"<<__LINE__<<endl; - resize(stlVecs,cbVecs,cbPoolVecs,20,3); - equalCheck(stlVecs,cbVecs,cbPoolVecs); - - cout<<"check"<<__LINE__<<endl; - //dealloc check - stlVecs.resize(5); - cbVecs.resize(5); - cbPoolVecs.resize(5); - - cout<<"check"<<__LINE__<<endl; - createVecs(4,3,stlVecs,cbVecs,cbPoolVecs,vectorPool); - equalCheck(stlVecs,cbVecs,cbPoolVecs); - - cout<<"check"<<__LINE__<<endl; - setValues(stlVecs,cbVecs,cbPoolVecs); - equalCheck(stlVecs,cbVecs,cbPoolVecs); - - cout<<"check"<<__LINE__<<endl; - createVecs(4,3,stlVecs,cbVecs,cbPoolVecs,vectorPool); - equalCheck(stlVecs,cbVecs,cbPoolVecs); - - - //operator= check - CbVector<value_type> testPool1(10, new CbVectorAllocatorPool<value_type>(vectorPool)); - CbVector<value_type> testPool2(1 , new CbVectorAllocatorPool<value_type>(vectorPool)); - CbVector<value_type> testPool3(8 , new CbVectorAllocatorPool<value_type>(vectorPool)); - CbVector<value_type> testPool4(8 , new CbVectorAllocatorPool<value_type>(vectorPool)); - CbVector<value_type> testStd1(10); - - for(CbVector<value_type>::size_type i=0; i<testStd1.size(); i++ ) - testStd1[i] = (value_type)i*10; - - testPool1 = testStd1; - testPool4 = testStd1; - testPool3 = testPool4; - testPool2 = testPool3; - - for(CbVector<value_type>::size_type i=0; i<testStd1.size(); i++ ) - cout<<testStd1[i]<<" "; cout<<endl; - for(CbVector<value_type>::size_type i=0; i<testPool1.size(); i++ ) - cout<<testPool1[i]<<" "; cout<<endl; - for(CbVector<value_type>::size_type i=0; i<testPool2.size(); i++ ) - cout<<testPool2[i]<<" "; cout<<endl; - for(CbVector<value_type>::size_type i=0; i<testPool3.size(); i++ ) - cout<<testPool3[i]<<" "; cout<<endl; - for(CbVector<value_type>::size_type i=0; i<testPool4.size(); i++ ) - cout<<testPool4[i]<<" "; cout<<endl; - ///end - - - cout<<"//////////////////////////////////////////////////////////////////////////"<<endl; - cout<<"// access test - start"<<endl; - cout<<"//////////////////////////////////////////////////////////////////////////"<<endl; - cout<<"check"<<__LINE__<<endl; - createVecs(1000,1000,stlVecs,cbVecs,cbPoolVecs,vectorPool,true); - - CbVectorPool<value_type>* pool2 = new CbVectorPool<value_type>(1); - vector< StlVectorPtr > stlVecs2; - vector< CbVectorPtr > cbVecs2; - vector< CbVectorPtr > cbPoolVecs2; - createVecs(1000,1000,stlVecs2,cbVecs2,cbPoolVecs2,pool2,true); - - cout<<"access check\n"; - //accessCheck(1000,stlVecs,cbVecs,cbPoolVecs); - - cout<<"check"<<__LINE__<<endl; - setValues(stlVecs,cbVecs,cbPoolVecs); - equalCheck(stlVecs,cbVecs,cbPoolVecs); - - cout<<"check"<<__LINE__<<endl; - resize(stlVecs,cbVecs,cbPoolVecs,120,3,true); - equalCheck(stlVecs,cbVecs,cbPoolVecs); - - cout<<"//////////////////////////////////////////////////////////////////////////"<<endl; - cout<<"// access test - end"<<endl; - cout<<"//////////////////////////////////////////////////////////////////////////"<<endl; - - cout<<"//////////////////////////////////////////////////////////////////////////"<<endl; - cout<<"// EXCEPTION TEST - start"<<endl; - cout<<"//////////////////////////////////////////////////////////////////////////"<<endl; - delete vectorPool; - vectorPool = NULL; - try - { - resize(stlVecs,cbVecs,cbPoolVecs,20,3); - } - catch(UbException& e) - { - cout<<"if exception tells something about \"vectorPool==NULL\" -> test successfully passed:"<<endl; - cout<<e<<endl; - } - cout<<"//////////////////////////////////////////////////////////////////////////"<<endl; - cout<<"// EXCEPTION TEST - end"<<endl; - cout<<"//////////////////////////////////////////////////////////////////////////"<<endl; - - cout<<"\n\n\nALL TESTS PASSED\n"; - } - catch(UbException& e) - { - std::cerr<<e<<std::endl; - } - catch(const std::exception &e) - { - std::cerr << "Caught exception:\n"; - std::cerr << "Type: " << typeid(e).name() << "\n"; - std::cerr << "What: " << e.what() << "\n"; - } - catch(...) - { - std::cerr<<" ** Verdammte Scheisse - mal wieder Mist gebaut! **"<<endl; - } - return 0; -} - -// #include <functional> -// #include <iostream> -// #include <vector> -// #include <algorithm> -// #include <typeinfo> -// -// struct bar -// { -// bar() -// : data(0) -// {} -// -// void foo(const std::size_t value) { std::cout << "data = " << value << " (old: " << data << ");" << std::endl; data = value; } -// -// private: -// std::size_t data; -// }; -// -// int main() -// { -// std::vector<bar> data(10); -// -// /* operator[] => Indexoperator */ -// for (std::size_t i(0); i < data.size(); ++i) -// data[i].foo(2); -// -// /* begin(), end() => Iterator */ -// const std::vector<bar>::iterator it_end(data.end()); -// for (std::vector<bar>::iterator it(data.begin()); it != it_end; ++it) -// it->foo(3); -// -// /* for_each => Algorithm | Iterator */ -// std::for_each(data.begin(), data.end(), std::bind2nd(std::mem_fun_ref(&bar::foo), 2)); -// } diff --git a/src/basics/basics/memory/MbChessMemPool2D.h b/src/basics/basics/memory/MbChessMemPool2D.h deleted file mode 100644 index 3ae46d2a5..000000000 --- a/src/basics/basics/memory/MbChessMemPool2D.h +++ /dev/null @@ -1,519 +0,0 @@ -// _ ___ __ __________ _ __ -// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ -// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) -// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ -// -#ifndef MBCHESSMEMPOOL2D_H -#define MBCHESSMEMPOOL2D_H - -#include <map> -#include <vector> -#include <iostream> -#include <iomanip> -#include <string> -#include <sstream> -#include <fstream> -#include <cmath> -#include <typeinfo> - -#include <basics/utilities/UbException.h> - - -template <class TData, std::size_t cachSize> -class MbChessMemPool2D; - -////////////////////////////////////////////////////////////////////////// -//class MbChessMap2DKey -//key zum Auffinden der ChessMem2DBlocks -class MbChessMap2DKey -{ -public: - ////////////////////////////////////////////////////////////////////////// - //Konstruktoren - MbChessMap2DKey(): mVectorPos(0),mFirstCriteria(0),mSecondCriteria(0) - { - - } - /*==========================================================*/ - MbChessMap2DKey(std::size_t vectorPos, std::size_t firstCriteria, std::size_t secondCriteria) - : mVectorPos(vectorPos), mFirstCriteria(firstCriteria), mSecondCriteria(secondCriteria) - { - } - /*==========================================================*/ - MbChessMap2DKey& operator=(const MbChessMap2DKey& srcKey) - { - if(this == &srcKey ) return *this; - - mVectorPos = srcKey.mVectorPos; - mFirstCriteria = srcKey.mFirstCriteria; - mSecondCriteria = srcKey.mSecondCriteria; - - return *this; - } - - ////////////////////////////////////////////////////////////////////////// - //global ueberladene Operatoren - friend inline bool operator<(const MbChessMap2DKey& lhsKey,const MbChessMap2DKey& rhsKey) - { - if(lhsKey.mFirstCriteria < rhsKey.mFirstCriteria ) return true; - if(lhsKey.mFirstCriteria > rhsKey.mFirstCriteria ) return false; - if(lhsKey.mSecondCriteria < rhsKey.mSecondCriteria) return true; - - return false; - } - /*==========================================================*/ - friend inline bool operator==(const MbChessMap2DKey& lhsKey,const MbChessMap2DKey& rhsKey) - { - if(lhsKey.mVectorPos != rhsKey.mVectorPos ) return false; - if(lhsKey.mFirstCriteria != rhsKey.mFirstCriteria ) return false; - if(lhsKey.mSecondCriteria != rhsKey.mSecondCriteria ) return false; - - return true; - } - //ueberladene Operatoren - friend inline bool operator!=(const MbChessMap2DKey& lhsKey,const MbChessMap2DKey& rhsKey) - { - return !(lhsKey==rhsKey); - } - //ueberladene Operatoren - /*==========================================================*/ - friend inline std::ostream& operator << (std::ostream& os, const MbChessMap2DKey& key) - { - os<<"VectorPos,first-,second-,third Criteria) ("; - os<<key.mVectorPos<<","<<key.mFirstCriteria<<","<<key.mSecondCriteria<<")"; - return os; - } - - ////////////////////////////////////////////////////////////////////////// - //public Methoden - std::size_t getVectorPos() {return mVectorPos;} -private: - ////////////////////////////////////////////////////////////////////////// - //private Member - std::size_t mVectorPos; - std::size_t mFirstCriteria; - std::size_t mSecondCriteria; -}; - - - -template<class T,std::size_t cachSize> -class MbChessMem2DBlock -{ - friend class MbChessMemPool2D<T,cachSize>; -public: - ////////////////////////////////////////////////////////////////////////// - //Konstruktoren - MbChessMem2DBlock() - { - mUsedElements = 0; - std::size_t arrayLength = mBlockWidth*mBlockWidth; - //mDataElements = new T[arrayLength]; - mDataElements = operator new(arrayLength*sizeof(T)); - mFlagVector = new bool[arrayLength]; - for(std::size_t i=0;i<arrayLength;i++) mFlagVector[i] = false; - } - ////////////////////////////////////////////////////////////////////////// - //Destruktor - ~MbChessMem2DBlock() - { - //if(mDataElements) delete[] mDataElements; - if(mDataElements) operator delete(mDataElements); - if(mFlagVector) delete[] mFlagVector; - } - -private: - ////////////////////////////////////////////////////////////////////////// - //private Methoden - void* getReference(std::size_t chessX1, std::size_t chessX2) - { - std::size_t arrayIndex = chessX2*mBlockWidth + chessX1; - #ifdef _DEBUG - if(arrayIndex>=mBlockWidth*mBlockWidth) UB_THROW( UbException(UB_EXARGS,"index out of range") ); - #endif - - if(mFlagVector[arrayIndex]==true) UB_THROW( UbException(UB_EXARGS,"memory already allocated!") ); - - mUsedElements++; - mFlagVector[arrayIndex]=true; - - return (void*)((T*)(mDataElements)+arrayIndex);//&(mDataElements[arrayIndex]); - } - /*==========================================================*/ - std::size_t freeReference(void* p) - { - //std::size_t arrayIndex = static_cast<std::size_t>(static_cast<T*>(p) - mDataElements); //mDataElements = &mDataElements[0] - std::size_t arrayIndex = static_cast<std::size_t>(static_cast<T*>(p) - static_cast<T*>(mDataElements)); - - #ifdef _DEBUG - if(arrayIndex>=mBlockWidth*mBlockWidth) UB_THROW( UbException(UB_EXARGS,"index out of range") ); - #endif - - if(mFlagVector[arrayIndex]==false) UB_THROW( UbException(UB_EXARGS,"memory not allocated!") ); - - mFlagVector[arrayIndex]=false; - - return --mUsedElements; - } - /*==========================================================*/ - std::size_t getNofUsedElements() { return mUsedElements; } - /*==========================================================*/ - void addPointerToTElementsToVector(std::vector<T*>& tdataVector) - { - std::size_t arrayLength = mBlockWidth*mBlockWidth; - for(std::size_t arrayIndex=0;arrayIndex<arrayLength;arrayIndex++) - { - //if(mFlagVector[arrayIndex]) tdataVector.push_back(&mDataElements[arrayIndex]); - if(mFlagVector[arrayIndex]) tdataVector.push_back(static_cast<T*>(mDataElements)+arrayIndex); - } - } - /*==========================================================*/ - template<typename Pred> - void addPointerToTElementsToVector(std::vector<T*>& tdataVector, Pred& pred) - { - std::size_t arrayLength = mBlockWidth*mBlockWidth; - T* tmp; - for(std::size_t arrayIndex=0;arrayIndex<arrayLength;arrayIndex++) - { - if(mFlagVector[arrayIndex]) - { - //tmp = &mDataElements[arrayIndex]; - tmp = (static_cast<T*>(mDataElements))+arrayIndex; - if( pred(*tmp) ) tdataVector.push_back(tmp); - } - } - } -private: - ////////////////////////////////////////////////////////////////////////// - //static Member - static const std::size_t mBlockWidth; - - ////////////////////////////////////////////////////////////////////////// - //private Member - std::size_t mUsedElements; - //T* mDataElements; - void* mDataElements; - bool* mFlagVector; - -}; - -////////////////////////////////////////////////////////////////////////// -//class MbChessMemPool2D -//zum Verwalten von TData Elementen in einer Schabrett-artigen Struktur -//die ChessMemBloecke haben hier eine Groesse von ~cachSize -template <class TData, std::size_t cachSize> -class MbChessMemPool2D -{ -private: - ////////////////////////////////////////////////////////////////////////// - //protected static const Member - const static std::size_t mCacheSize; - - ////////////////////////////////////////////////////////////////////////// - //protected Member - static std::vector< std::map< MbChessMap2DKey , MbChessMem2DBlock< TData,cachSize >* > > mMapVector; - static std::map< void*, MbChessMap2DKey > mPointerKeyMap; - - ////////////////////////////////////////////////////////////////////////// - //protected Konstrukoren - MbChessMemPool2D() //protected, um max einmal vererbt werden zu koennen!!! - { //zudem kann man so keine elmente von TreeBasedMemPool erstellen - - } - ////////////////////////////////////////////////////////////////////////// - //Destruktor - ~MbChessMemPool2D() - { - } - -public: - - ////////////////////////////////////////////////////////////////////////// - //static public Methoden - static void* getReference(std::size_t level, std::size_t ix1, std::size_t ix2) - { - if(!MbChessMem2DBlock< TData,cachSize >::mBlockWidth) - { - std::stringstream ss; - ss<<"TreeBasedMemPool() - InitialisationError\n"; - ss<<"\t size of StorageData ("<<typeid(TData).name()<<", "<<sizeof(TData)<<" byte)\n"; - ss<<"\t exceeds user-specifyed cache-zize ("<<mCacheSize<<" byte)\n"; - ss<<"\t cache-size has to be larger than data-size"; - UB_THROW( UbException(ss.str()) ); - } - - if( mMapVector.size()<=level ) mMapVector.resize(level+1); - - std::size_t chessX1 = ix1/(MbChessMem2DBlock<TData,cachSize>::mBlockWidth); - std::size_t chessX2 = ix2/(MbChessMem2DBlock<TData,cachSize>::mBlockWidth); - - MbChessMap2DKey mapKey(level,chessX1,chessX2); - - typename std::map<MbChessMap2DKey,MbChessMem2DBlock<TData,cachSize>* >::iterator pos = mMapVector[level].find(mapKey); - - MbChessMem2DBlock<TData,cachSize>* memBlock = NULL; - - if(pos==mMapVector[level].end()) - { - memBlock = new MbChessMem2DBlock<TData,cachSize>; - (mMapVector[level])[mapKey] = memBlock; - } - else memBlock = pos->second; - - std::size_t internalChessX1 = ix1%(MbChessMem2DBlock<TData,cachSize>::mBlockWidth); - std::size_t internalChessX2 = ix2%(MbChessMem2DBlock<TData,cachSize>::mBlockWidth); - - void* p = memBlock->getReference(internalChessX1,internalChessX2); - - mPointerKeyMap[p]=mapKey; - - return p; - } - /*==========================================================*/ - static void freeReference(void *p) - { - typename std::map<void*,MbChessMap2DKey>::iterator posPointerKeyMap = mPointerKeyMap.find(p); - - if(posPointerKeyMap==mPointerKeyMap.end()) UB_THROW( UbException(UB_EXARGS,"pointer not in map") ); - - MbChessMap2DKey mapKey = posPointerKeyMap->second; - mPointerKeyMap.erase(posPointerKeyMap); - - typename std::map<MbChessMap2DKey,MbChessMem2DBlock<TData,cachSize>* >::iterator posMemBlockMap; - posMemBlockMap = mMapVector[mapKey.getVectorPos()].find(mapKey); - - if(posMemBlockMap == mMapVector[mapKey.getVectorPos()].end()) - UB_THROW( UbException(UB_EXARGS,"mapKey not in ChessMem2DBlockMap") ); - - std::size_t leftElements = posMemBlockMap->second->freeReference(p); - if(!leftElements) - { - MbChessMem2DBlock<TData,cachSize>* tmp = posMemBlockMap->second; - mMapVector[mapKey.getVectorPos()].erase(posMemBlockMap); - delete tmp; - } - } - /*==========================================================*/ - static void fillVectorWithPointerToTDataElements(std::size_t level,std::vector<TData*>& tdataVector) - { - tdataVector.clear(); - - if(level>=mMapVector.size()) return; - typename std::map<MbChessMap2DKey,MbChessMem2DBlock<TData,cachSize>* >::iterator pos; - for(pos=mMapVector[level].begin();pos!=mMapVector[level].end();++pos) - { - pos->second->addPointerToTElementsToVector(tdataVector); - } - } - /*==========================================================*/ - static void fillVectorWithPointerToTDataElements(std::vector<TData*>& tdataVector) - { - tdataVector.clear(); - - typename std::map<MbChessMap2DKey,MbChessMem2DBlock<TData,cachSize>* >::iterator pos; - - for(std::size_t vecIndex=0; vecIndex<mMapVector.size(); vecIndex++ ) - { - for(pos=mMapVector[vecIndex].begin();pos!=mMapVector[vecIndex].end();++pos) - { - pos->second->addPointerToTElementsToVector(tdataVector); - } - } - } - /*==========================================================*/ - template<typename Pred> - static void fillVectorWithPointerToTDataElements(std::size_t level,std::vector<TData*>& tdataVector, Pred pred) - { - tdataVector.clear(); - - if(level>=mMapVector.size()) return; - typename std::map<MbChessMap2DKey,MbChessMem2DBlock<TData,cachSize>* >::iterator pos; - for(pos=mMapVector[level].begin();pos!=mMapVector[level].end();++pos) - { - pos->second->addPointerToTElementsToVector(tdataVector,pred); - } - } - /*==========================================================*/ - template<typename Pred> - static void fillVectorWithPointerToTDataElements(std::vector<TData*>& tdataVector, Pred pred) - { - tdataVector.clear(); - - typename std::map<MbChessMap2DKey,MbChessMem2DBlock<TData,cachSize>* >::iterator pos; - - for(std::size_t vecIndex=0; vecIndex<mMapVector.size(); vecIndex++ ) - { - for(pos=mMapVector[vecIndex].begin();pos!=mMapVector[vecIndex].end();++pos) - { - pos->second->addPointerToTElementsToVector(tdataVector,pred); - } - } - } - /*==========================================================*/ - static std::size_t getNumberOfChessMemoryBlocks() - { - std::size_t nofElements = 0; - for(std::size_t i=0; i<mMapVector.size(); i++) - { - nofElements+=mMapVector[i].size(); - } - return nofElements; - } - /*==========================================================*/ - static std::size_t getNumberOfChessMemoryBlocks(std::size_t level) - { - if(level<mMapVector.size() )return mMapVector[level].size(); - return 0; - } - /*==========================================================*/ - static std::size_t getNumberOfStoredDataElements() - { - return mPointerKeyMap.size(); - } - /*==========================================================*/ - static std::size_t getNumberOfStoredDataElements(std::size_t level) - { - if(level<mMapVector.size() ) - { - std::size_t nofElements = 0; - typename std::map< MbChessMap2DKey , MbChessMem2DBlock< TData,cachSize >* >::iterator pos; - - for(pos=mMapVector[level].begin(); pos!=mMapVector[level].end(); ++pos) - { - nofElements += pos->second->getNofUsedElements(); - } - return nofElements; - } - return 0; - - } - /*==========================================================*/ - static std::string toString() - { - long double capaticityPerBlock = (std::size_t)pow((double)MbChessMem2DBlock<TData,cachSize>::mBlockWidth,2.0); - std::size_t storedElements = MbChessMemPool2D<TData,cachSize>::getNumberOfStoredDataElements(); - std::size_t initialisedMemBlocks = MbChessMemPool2D<TData,cachSize>::getNumberOfChessMemoryBlocks(); - - std::stringstream ss; - ss<<std::endl; - ss<<"****************** MbChessMemPool2D-Info (BEGIN) ******************"<<std::endl; - ss<<"type of Storage-Data.................. : "<<typeid(TData).name()<<std::endl; - ss<<"size of Storage-Data........... [bytes]: "<<sizeof(TData)<<std::endl; - ss<<"specified cache-size........... [bytes]: "<<mCacheSize<<std::endl; - ss<<"#elements per MbChessMem2DBlock [bytes]: "<<capaticityPerBlock<<std::endl; - ss<<"mem per MbChessMem2DBlock...... [bytes]: "<<capaticityPerBlock*sizeof(TData)<<std::endl; - ss<<"used cache-size[%]............. [bytes]: "<<capaticityPerBlock*sizeof(TData)/(double)mCacheSize*100<<std::endl; - ss<<"\n"; - ss<<"#stored Elements = "<<storedElements<<std::endl; - ss<<"#ChessMem2DBlocks = "<<initialisedMemBlocks<<std::endl; - ss<<std::endl; - ss<<"level | #ChessMem2DBlocks | #stored Elements | used capaticity [%] \n"; - ss<<"----------------------------------------------------------------\n"; - for(std::size_t level=0;level<mMapVector.size();level++) - { - std::size_t nofStoredElements = MbChessMemPool2D<TData,cachSize>::getNumberOfStoredDataElements(level); - std::size_t nofChessMem2DBlocks = MbChessMemPool2D<TData,cachSize>::getNumberOfChessMemoryBlocks(level); - - ss<<std::left<<" "<<std::setw(5)<<level<<"| " - <<std::setw(16)<<nofChessMem2DBlocks<<"| " - <<std::setw(17)<<nofStoredElements<<"| "; - if(nofStoredElements) - ss<<setw(15)<<nofStoredElements/(double)(capaticityPerBlock*nofChessMem2DBlocks)*100<<std::endl; - else ss<<"-"<<std::endl; - } - ss<<std::endl; - ss<<"called memory..... [bytes]: "<<storedElements*sizeof(TData)<<std::endl; - ss<<"initialised memory [bytes]: "<<initialisedMemBlocks*capaticityPerBlock*sizeof(TData)<<std::endl; - double denominator = (double)(initialisedMemBlocks*capaticityPerBlock*sizeof(TData)); - if(fabs(denominator)>1.E-13) ss<<"used.............. [%] : "<<100.*storedElements*sizeof(TData)/denominator<<std::endl; - else ss<<"used.............. [%] : 0.0"<<std::endl; - ss<<"****************** MbChessMemPool2D-Info (END) *******************"<<std::endl; - return ss.str(); - } - /*==========================================================*/ - static void writeStatisticFiles(const std::string& filename) - { - //liefert Statistik ueber aufuellung der einzelnen bloecke (gesamt und pro level) - //x-Achse: 0... max moegliche Anzahl von moeglichen Elementen pro MemBlock - //y-Achse: Anzahl an Bloecken, die die Anzahl an Elementen beinhalten - std::ofstream spreadingFile(((std::string)(filename+"_spreading.txt")).c_str()); - if(!spreadingFile) UB_THROW( UbException(UB_EXARGS,"couldn't open file") ); - - std::size_t initialisedMemBlocks = MbChessMemPool2D<TData,cachSize>::getNumberOfChessMemoryBlocks(); - std::size_t maxNofDataElementsPerBlock = MbChessMem2DBlock<TData,cachSize>::mBlockWidth - * MbChessMem2DBlock<TData,cachSize>::mBlockWidth - * MbChessMem2DBlock<TData,cachSize>::mBlockWidth; - std::vector<std::size_t> spreading; - spreading.resize(maxNofDataElementsPerBlock+1,0); - std::vector< std::vector<std::size_t> > spreadingPerLevel; - spreadingPerLevel.resize(mMapVector.size()); - - typename std::map<MbChessMap2DKey,MbChessMem2DBlock<TData,cachSize>* >::iterator pos; - - for(std::size_t level=0; level<mMapVector.size(); level++ ) - { - spreadingPerLevel[level].resize(maxNofDataElementsPerBlock+1,0); - for(pos=mMapVector[level].begin();pos!=mMapVector[level].end();++pos) - { - std::size_t number = pos->second->getNofUsedElements(); - spreading[number]++; - spreadingPerLevel[level][number]++; - } - } - spreadingFile<<"#BlockUsage nofBlocks(all Level) "; - for(std::size_t level=0; level<mMapVector.size(); level++ ) - spreadingFile<<"nofBlockLevel"<<level<<" "; - spreadingFile<<std::endl; - - for(std::size_t i=0; i<spreading.size(); i++) - { - spreadingFile<<i<<" "<<spreading[i]; - for(std::size_t level=0; level<mMapVector.size(); level++ ) - spreadingFile<<" "<<spreadingPerLevel[level][i]; - spreadingFile<<std::endl; - } - spreadingFile.flush(); - spreadingFile.close(); - } - ////////////////////////////////////////////////////////////////////////// - //ueberladene operatoren - void* operator new(size_t size, std::size_t level, std::size_t ix1, std::size_t ix2) - { - if(level<0) UB_THROW( UbException(UB_EXARGS,"level ist negativ!") ); - void *p = getReference(level,ix1,ix2); - return p; - } - /*==========================================================*/ - void operator delete(void* p, std::size_t level, std::size_t ix1, std::size_t ix2) - { - //ACHTUNG: wenn man hier ne Exception schmeisst, dann gibts einen BoeSEN compilerFehler!!! - //UB_THROW( UbException(UB_EXARGS,"Scheisse noch nicht gerafft, wie das geht!") ); - std::cerr<<"MbChessMemPool2D::delete(void* p, std::size_t level, std::size_t ix1, std::size_t ix2) - Scheisse noch nicht gerafft, wie das geht!\n"; - } - - /*==========================================================*/ - void operator delete(void* p) - { - freeReference(p); - } - -private: - ////////////////////////////////////////////////////////////////////////// - //private statische Methoden -}; - -//statische Variablen initialisieren -template <class TData, std::size_t cachSize> -std::vector< std::map<MbChessMap2DKey,MbChessMem2DBlock<TData,cachSize>* > > MbChessMemPool2D<TData,cachSize>::mMapVector; - -template <class TData, std::size_t cachSize> -std::map<void*,MbChessMap2DKey > MbChessMemPool2D< TData, cachSize>::mPointerKeyMap; - -template <class TData, std::size_t cachSize> -const std::size_t MbChessMemPool2D<TData,cachSize>::mCacheSize=cachSize; - -template <class TData,std::size_t cachSize> -const std::size_t MbChessMem2DBlock<TData,cachSize>::mBlockWidth=static_cast<std::size_t>(pow(static_cast<double>(static_cast<std::size_t>(cachSize/sizeof(TData))),1./3.)); - -#endif diff --git a/src/basics/basics/memory/MbChessMemPool3D.h b/src/basics/basics/memory/MbChessMemPool3D.h deleted file mode 100644 index ffc74a8d6..000000000 --- a/src/basics/basics/memory/MbChessMemPool3D.h +++ /dev/null @@ -1,537 +0,0 @@ -// _ ___ __ __________ _ __ -// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ -// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) -// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ -// -#ifndef MBCHESSMEMPOOL3D_H -#define MBCHESSMEMPOOL3D_H - -#include <map> -#include <vector> -#include <iostream> -#include <iomanip> -#include <string> -#include <sstream> -#include <fstream> -#include <cmath> - -#include <basics/utilities/UbException.h> - -template <class TData, std::size_t cachSize> -class MbChessMemPool3D; - -////////////////////////////////////////////////////////////////////////// -//class MbChessMap3DKey -//key zum Auffinden der ChessMem3DBlocks -class MbChessMap3DKey -{ -public: - ////////////////////////////////////////////////////////////////////////// - //Konstruktoren - MbChessMap3DKey(): mVectorPos(0),mFirstCriteria(0),mSecondCriteria(0),mThirdCriteria(0) - { - } - /*==========================================================*/ - MbChessMap3DKey(std::size_t vectorPos,std::size_t firstCriteria,std::size_t secondCriteria,std::size_t thirdCriteria) - : mVectorPos(vectorPos), mFirstCriteria(firstCriteria), mSecondCriteria(secondCriteria), mThirdCriteria(thirdCriteria) - { - } - /*==========================================================*/ - MbChessMap3DKey& operator=(const MbChessMap3DKey& srcKey) - { - if(this == &srcKey ) return *this; - - mVectorPos = srcKey.mVectorPos; - mFirstCriteria = srcKey.mFirstCriteria; - mSecondCriteria = srcKey.mSecondCriteria; - mThirdCriteria = srcKey.mThirdCriteria; - - return *this; - } - - ////////////////////////////////////////////////////////////////////////// - //global ueberladene Operatoren - friend inline bool operator<(const MbChessMap3DKey& lhsKey,const MbChessMap3DKey& rhsKey) - { - if(lhsKey.mFirstCriteria < rhsKey.mFirstCriteria ) return true; - if(lhsKey.mFirstCriteria > rhsKey.mFirstCriteria ) return false; - if(lhsKey.mSecondCriteria < rhsKey.mSecondCriteria) return true; - if(lhsKey.mSecondCriteria > rhsKey.mSecondCriteria) return false; - if(lhsKey.mThirdCriteria < rhsKey.mThirdCriteria ) return true; - - return false; - } - /*==========================================================*/ - friend inline bool operator==(const MbChessMap3DKey& lhsKey,const MbChessMap3DKey& rhsKey) - { - if(lhsKey.mVectorPos != rhsKey.mVectorPos ) return false; - if(lhsKey.mFirstCriteria != rhsKey.mFirstCriteria ) return false; - if(lhsKey.mSecondCriteria != rhsKey.mSecondCriteria ) return false; - if(lhsKey.mThirdCriteria != rhsKey.mThirdCriteria ) return false; - - return true; - } - //ueberladene Operatoren - friend inline bool operator!=(const MbChessMap3DKey& lhsKey,const MbChessMap3DKey& rhsKey) - { - return !(lhsKey==rhsKey); - } - //ueberladene Operatoren - /*==========================================================*/ - friend inline std::ostream& operator << (std::ostream& os, const MbChessMap3DKey& key) - { - os<<"VectorPos,first-,second-,third Criteria) ("; - os<<key.mVectorPos<<","<<key.mFirstCriteria<<","<<key.mSecondCriteria<<","<<key.mThirdCriteria<<")"; - return os; - } - - ////////////////////////////////////////////////////////////////////////// - //public Methoden - std::size_t getVectorPos() {return mVectorPos;} -private: - ////////////////////////////////////////////////////////////////////////// - //private Member - std::size_t mVectorPos; - std::size_t mFirstCriteria; - std::size_t mSecondCriteria; - std::size_t mThirdCriteria; -}; - - - -template<class T,std::size_t cachSize> -class MbChessMem3DBlock -{ - friend class MbChessMemPool3D<T,cachSize>; -public: - ////////////////////////////////////////////////////////////////////////// - //Konstruktoren - MbChessMem3DBlock() - { - mUsedElements = 0; - std::size_t arrayLength = mBlockWidth*mBlockWidth*mBlockWidth; - //mDataElements = new T[arrayLength]; - mDataElements = operator new(arrayLength*sizeof(T)); - if(!mDataElements) UB_THROW( UbException(UB_EXARGS,"out of memeory!") ); - mFlagVector = new bool[arrayLength]; - if(!mFlagVector) UB_THROW( UbException(UB_EXARGS,"out of memeory!") ); - for(std::size_t i=0;i<arrayLength;i++) mFlagVector[i] = false; - } - ////////////////////////////////////////////////////////////////////////// - //Destruktor - ~MbChessMem3DBlock() - { - //if(mDataElements) delete[] mDataElements; - if(mDataElements) operator delete(mDataElements); - if(mFlagVector) delete[] mFlagVector; - } - -private: - ////////////////////////////////////////////////////////////////////////// - //private Methoden - void* getReference(std::size_t chessX1, std::size_t chessX2, std::size_t chessX3) - { - //std::size_t arrayIndex = (chessX1*mBlockWidth+chessX2)*mBlockWidth + chessX3; - std::size_t arrayIndex = (chessX3*mBlockWidth+chessX2)*mBlockWidth + chessX1; - #ifdef _DEBUG - if(arrayIndex>=mBlockWidth*mBlockWidth*mBlockWidth) UB_THROW( UbException(UB_EXARGS,"index out of range") ); - #endif - - if(mFlagVector[arrayIndex]==true) UB_THROW( UbException(UB_EXARGS,"memory already allocated!") ); - - mUsedElements++; - mFlagVector[arrayIndex]=true; - - return (void*)((T*)(mDataElements)+arrayIndex);//&(mDataElements[arrayIndex]); - } - /*==========================================================*/ - std::size_t freeReference(void* p) - { - //std::size_t arrayIndex = static_cast<std::size_t>(static_cast<T*>(p) - mDataElements); //mDataElements = &mDataElements[0] - std::size_t arrayIndex = static_cast<std::size_t>(static_cast<T*>(p) - static_cast<T*>(mDataElements)); - - #ifdef _DEBUG - if(arrayIndex>=mBlockWidth*mBlockWidth*mBlockWidth) UB_THROW( UbException(UB_EXARGS,"index out of range") ); - #endif - - if(mFlagVector[arrayIndex]==false) UB_THROW( UbException(UB_EXARGS,"memory not allocated!") ); - - mFlagVector[arrayIndex]=false; - - return --mUsedElements; - } - /*==========================================================*/ - std::size_t getNofUsedElements() { return mUsedElements; } - /*==========================================================*/ - void addPointerToTElementsToVector(std::vector<T*>& tdataVector) - { - std::size_t arrayLength = mBlockWidth*mBlockWidth*mBlockWidth; - for(std::size_t arrayIndex=0; arrayIndex<arrayLength; arrayIndex++) - { - //if(mFlagVector[arrayIndex]) tdataVector.push_back(&mDataElements[arrayIndex]); - if(mFlagVector[arrayIndex]) tdataVector.push_back(static_cast<T*>(mDataElements)+arrayIndex); - } - } - /*==========================================================*/ - template<typename Pred> - void addPointerToTElementsToVector(std::vector<T*>& tdataVector,Pred& pred ) - { - std::size_t arrayLength = mBlockWidth*mBlockWidth*mBlockWidth; - T* tmp; - for(std::size_t arrayIndex=0;arrayIndex<arrayLength;arrayIndex++) - { - if(mFlagVector[arrayIndex]) - { - //tmp = &mDataElements[arrayIndex]; - tmp = static_cast<T*>(mDataElements)+arrayIndex; - if( pred(*tmp) ) tdataVector.push_back(tmp); - } - } - } -private: - ////////////////////////////////////////////////////////////////////////// - //static Member - static const std::size_t mBlockWidth; - - ////////////////////////////////////////////////////////////////////////// - //private Member - std::size_t mUsedElements; - //T* mDataElements; - void* mDataElements; - bool* mFlagVector; - -}; - -////////////////////////////////////////////////////////////////////////// -//class MbChessMemPool3D -//zum Verwalten von TData Elementen in einer Schabrett-artigen Struktur -//die ChessMemBloecke haben hier eine Groesse von ~cachSize -template <class TData, std::size_t cachSize> -class MbChessMemPool3D -{ -private: - ////////////////////////////////////////////////////////////////////////// - //protected static const Member - const static std::size_t mCacheSize; - - ////////////////////////////////////////////////////////////////////////// - //protected Member - static std::vector< std::map< MbChessMap3DKey , MbChessMem3DBlock< TData,cachSize >* > > mMapVector; - static std::map< void*, MbChessMap3DKey > mPointerKeyMap; - - ////////////////////////////////////////////////////////////////////////// - //protected Konstrukoren - MbChessMemPool3D() //private, da NUR static erlaubt!!! - { - - } - ////////////////////////////////////////////////////////////////////////// - //Destruktor - ~MbChessMemPool3D() - { - } - -public: - ////////////////////////////////////////////////////////////////////////// - //static public Methoden - static void* getReference(std::size_t level, std::size_t ix1, std::size_t ix2, std::size_t ix3) - { - if(!MbChessMem3DBlock< TData,cachSize >::mBlockWidth) - { - std::stringstream ss; - ss<<"TreeBasedMemPool() - InitialisationError\n"; - ss<<"\t size of StorageData ("<<typeid(TData).name()<<", "<<sizeof(TData)<<" byte)\n"; - ss<<"\t exceeds user-specifyed cache-zize ("<<mCacheSize<<" byte)\n"; - ss<<"\t cache-size has to be larger than data-size"; - UB_THROW( UbException(UB_EXARGS,ss.str()) ); - } - - if( mMapVector.size()<=level ) mMapVector.resize(level+1); - - std::size_t chessX1 = ix1/(MbChessMem3DBlock<TData,cachSize>::mBlockWidth); - std::size_t chessX2 = ix2/(MbChessMem3DBlock<TData,cachSize>::mBlockWidth); - std::size_t chessX3 = ix3/(MbChessMem3DBlock<TData,cachSize>::mBlockWidth); - - MbChessMap3DKey mapKey(level,chessX1,chessX2,chessX3); - - typename std::map<MbChessMap3DKey,MbChessMem3DBlock<TData,cachSize>* >::iterator pos = mMapVector[level].find(mapKey); - - MbChessMem3DBlock<TData,cachSize>* memBlock = NULL; - - if(pos==mMapVector[level].end()) - { - memBlock = new MbChessMem3DBlock<TData,cachSize>; - (mMapVector[level])[mapKey] = memBlock; - } - else memBlock = pos->second; - - std::size_t internalChessX1 = ix1%(MbChessMem3DBlock<TData,cachSize>::mBlockWidth); - std::size_t internalChessX2 = ix2%(MbChessMem3DBlock<TData,cachSize>::mBlockWidth); - std::size_t internalChessX3 = ix3%(MbChessMem3DBlock<TData,cachSize>::mBlockWidth); - - void* p = memBlock->getReference(internalChessX1,internalChessX2,internalChessX3); - - mPointerKeyMap[p]=mapKey; - - return p; - } - static void freeReference(void *p) - { - typename std::map<void*,MbChessMap3DKey>::iterator posPointerKeyMap = mPointerKeyMap.find(p); - - if(posPointerKeyMap==mPointerKeyMap.end()) UB_THROW( UbException(UB_EXARGS,"pointer not in map") ); - - MbChessMap3DKey mapKey = posPointerKeyMap->second; - mPointerKeyMap.erase(posPointerKeyMap); - - - typename std::map<MbChessMap3DKey,MbChessMem3DBlock<TData,cachSize>* >::iterator posMemBlockMap; - posMemBlockMap = mMapVector[mapKey.getVectorPos()].find(mapKey); - - - if(posMemBlockMap == mMapVector[mapKey.getVectorPos()].end()) - UB_THROW( UbException(UB_EXARGS,"mapKey not in ChessMem3DBlockMap") ); - - std::size_t leftElements = posMemBlockMap->second->freeReference(p); - if(!leftElements) - { - MbChessMem3DBlock<TData,cachSize>* tmp = posMemBlockMap->second; - mMapVector[mapKey.getVectorPos()].erase(posMemBlockMap); - try{ delete tmp; } - catch(...){UB_THROW( UbException(UB_EXARGS,"could not delete MbChessMem3DBlock") );} - } - } - /*==========================================================*/ - static void fillVectorWithPointerToTDataElements(std::size_t level,std::vector<TData*>& tdataVector) - { - tdataVector.clear(); - - if(level>=mMapVector.size()) return; - typename std::map<MbChessMap3DKey,MbChessMem3DBlock<TData,cachSize>* >::iterator pos; - for(pos=mMapVector[level].begin();pos!=mMapVector[level].end();++pos) - { - pos->second->addPointerToTElementsToVector(tdataVector); - } - } - /*==========================================================*/ - static void fillVectorWithPointerToTDataElements(std::vector<TData*>& tdataVector) - { - tdataVector.clear(); - - typename std::map<MbChessMap3DKey,MbChessMem3DBlock<TData,cachSize>* >::iterator pos; - - for(std::size_t vecIndex=0; vecIndex<mMapVector.size(); vecIndex++ ) - { - for(pos=mMapVector[vecIndex].begin();pos!=mMapVector[vecIndex].end();++pos) - { - pos->second->addPointerToTElementsToVector(tdataVector); - } - } - } - /*==========================================================*/ - template<class Pred> - static void fillVectorWithPointerToTDataElements(std::size_t level,std::vector<TData*>& tdataVector, Pred pred) - { - tdataVector.clear(); - - if(level>=mMapVector.size()) return; - typename std::map<MbChessMap3DKey,MbChessMem3DBlock<TData,cachSize>* >::iterator pos; - for(pos=mMapVector[level].begin();pos!=mMapVector[level].end();++pos) - { - pos->second->addPointerToTElementsToVector(tdataVector,pred); - } - } - /*==========================================================*/ - template<typename Pred> - static void fillVectorWithPointerToTDataElements(std::vector<TData*>& tdataVector, Pred pred) - { - tdataVector.clear(); - - typename std::map<MbChessMap3DKey,MbChessMem3DBlock<TData,cachSize>* >::iterator pos; - - for(std::size_t vecIndex=0; vecIndex<mMapVector.size(); vecIndex++ ) - { - for(pos=mMapVector[vecIndex].begin();pos!=mMapVector[vecIndex].end();++pos) - { - pos->second->addPointerToTElementsToVector(tdataVector,pred); - } - } - } - /*==========================================================*/ - static std::size_t getNumberOfChessMemoryBlocks() - { - std::size_t nofElements = 0; - for(std::size_t i=0;i<mMapVector.size();i++) - { - nofElements+=mMapVector[i].size(); - } - return nofElements; - } - /*==========================================================*/ - static std::size_t getNumberOfChessMemoryBlocks(std::size_t level) - { - if(level<mMapVector.size() ) return mMapVector[level].size(); - return 0; - } - /*==========================================================*/ - static std::size_t getNumberOfStoredDataElements() - { - return mPointerKeyMap.size(); - } - /*==========================================================*/ - static std::size_t getNumberOfStoredDataElements(std::size_t level) - { - if(level<mMapVector.size() ) - { - std::size_t nofElements = 0; - typename std::map< MbChessMap3DKey , MbChessMem3DBlock< TData,cachSize >* >::iterator pos; - - for(pos=mMapVector[level].begin(); pos!=mMapVector[level].end(); ++pos) - { - nofElements+= pos->second->getNofUsedElements(); - } - return nofElements; - } - return 0; - } - /*==========================================================*/ - static std::string toString() - { - long double capaticityPerBlock = pow((double)MbChessMem3DBlock<TData,cachSize>::mBlockWidth,3.0); - std::size_t storedElements = MbChessMemPool3D<TData,cachSize>::getNumberOfStoredDataElements(); - std::size_t initialisedMemBlocks = MbChessMemPool3D<TData,cachSize>::getNumberOfChessMemoryBlocks(); - - std::stringstream ss; - ss<<std::endl; - ss<<"****************** MbChessMemPool3D-Info (BEGIN) ******************"<<std::endl; - ss<<"type of Storage-Data.................. : "<<typeid(TData).name()<<std::endl; - ss<<"size of Storage-Data........... [bytes]: "<<sizeof(TData)<<std::endl; - ss<<"specified cache-size........... [bytes]: "<<mCacheSize<<std::endl; - ss<<"#elements per MbChessMem3DBlock [bytes]: "<<capaticityPerBlock<<std::endl; - ss<<"mem per MbChessMem3DBlock...... [bytes]: "<<capaticityPerBlock*sizeof(TData)<<std::endl; - ss<<"used cache-size[%]............. [bytes]: "<<capaticityPerBlock*sizeof(TData)/(double)mCacheSize*100<<std::endl; - ss<<"\n"; - ss<<"#stored Elements = "<<storedElements<<std::endl; - ss<<"#ChessMem3DBlocks = "<<initialisedMemBlocks<<std::endl; - ss<<std::endl; - ss<<"level | #ChessMem3DBlocks | #stored Elements | used capaticity [%] \n"; - ss<<"----------------------------------------------------------------\n"; - for(std::size_t level=0;level<mMapVector.size();level++) - { - std::size_t nofStoredElements = MbChessMemPool3D<TData,cachSize>::getNumberOfStoredDataElements(level); - std::size_t nofChessMem3DBlocks = MbChessMemPool3D<TData,cachSize>::getNumberOfChessMemoryBlocks(level); - - ss<<std::left<<" "<<std::setw(5)<<level<<"| " - <<std::setw(16)<<nofChessMem3DBlocks<<"| " - <<std::setw(17)<<nofStoredElements<<"| "; - if(nofStoredElements) - ss<<std::setw(15)<<nofStoredElements/(double)(capaticityPerBlock*nofChessMem3DBlocks)*100<<std::endl; - else ss<<"-"<<std::endl; - } - ss<<std::endl; - ss<<"called memory..... [bytes]: "<<storedElements*sizeof(TData)<<std::endl; - ss<<"initialised memory [bytes]: "<<initialisedMemBlocks*capaticityPerBlock*sizeof(TData)<<std::endl; - double denominator = (double)(initialisedMemBlocks*capaticityPerBlock*sizeof(TData)); - if(fabs(denominator)>1.E-13) ss<<"used.............. [%] : "<<100.*storedElements*sizeof(TData)/denominator<<std::endl; - else ss<<"used.............. [%] : 0.0"<<std::endl; - ss<<"****************** MbChessMemPool3D-Info (END) *******************"<<std::endl; - return ss.str(); - } - /*==========================================================*/ - static void writeStatisticFiles(const std::string& filename) - { - //liefert Statistik ueber aufuellung der einzelnen bloecke (gesamt und pro level) - //x-Achse: 0... max moegliche Anzahl von moeglichen Elementen pro MemBlock - //y-Achse: Anzahl an Bloecken, die die Anzahl an Elementen beinhalten - std::ofstream spreadingFile(((std::string)(filename+"_spreading.txt")).c_str()); - if(!spreadingFile) UB_THROW( UbException(UB_EXARGS,"couldn't open file") ); - - //std::size_t initialisedMemBlocks = MbChessMemPool3D<TData,cachSize>::getNumberOfChessMemoryBlocks(); - std::size_t maxNofDataElementsPerBlock = MbChessMem3DBlock<TData,cachSize>::mBlockWidth - *MbChessMem3DBlock<TData,cachSize>::mBlockWidth - *MbChessMem3DBlock<TData,cachSize>::mBlockWidth; - std::vector<std::size_t> spreading; - spreading.resize(maxNofDataElementsPerBlock+1,0); - std::vector< std::vector<std::size_t> > spreadingPerLevel; - spreadingPerLevel.resize(mMapVector.size()); - - typename std::map<MbChessMap3DKey,MbChessMem3DBlock<TData,cachSize>* >::iterator pos; - - for(std::size_t level=0; level<mMapVector.size(); level++ ) - { - spreadingPerLevel[level].resize(maxNofDataElementsPerBlock+1,0); - for(pos=mMapVector[level].begin();pos!=mMapVector[level].end();++pos) - { - std::size_t number = pos->second->getNofUsedElements(); - spreading[number]++; - spreadingPerLevel[level][number]++; - } - } - spreadingFile<<"#BlockUsage nofBlocks(all Level) "; - for(std::size_t level=0; level<mMapVector.size(); level++ ) - spreadingFile<<"nofBlockLevel"<<level<<" "; - spreadingFile<<std::endl; - - for(std::size_t i=0;i<spreading.size();i++) - { - spreadingFile<<i<<" "<<spreading[i]; - for(std::size_t level=0; level<mMapVector.size(); level++ ) - spreadingFile<<" "<<spreadingPerLevel[level][i]; - spreadingFile<<std::endl; - } - spreadingFile.flush(); - spreadingFile.close(); - } - - //////////////////////////////////////////////////////////////////////////// - ////ueberladene operatoren - //void* operator new(size_t size, std::size_t level, std::size_t ix1, std::size_t ix2, std::size_t ix3) - //{ - // if(level<0) UB_THROW( UbException(UB_EXARGS,"level ist negativ!") ); - // void *p = getReference(level,ix1,ix2,ix3); - // return p; - //} - ///*==========================================================*/ - //void operator delete(void* p, std::size_t level, std::size_t ix1, std::size_t ix2, std::size_t ix3) - //{ - // //ACHTUNG: wenn man hier ne Exception schmeisst, dann gibts einen BoeSEN compilerFehler!!! - // //UB_THROW( UbException(__FILE__, __LINE__, "MbChessMemPool3D::delete - Scheisse noch nicht gerafft, wie das geht!") ); - // cout<<"MbChessMemPool3D::delete(void* p, std::size_t level, std::size_t ix1, std::size_t ix2, std::size_t ix3) - Scheisse noch nicht gerafft, wie das geht!\n"; - //} - - ///*==========================================================*/ - //void operator delete(void* p) - //{ - // freeReference(p); - //} - -private: - ////////////////////////////////////////////////////////////////////////// - //private statische Methoden -}; - - -//statische Variablen initialisieren -template <class TData, std::size_t cachSize> -std::vector< std::map<MbChessMap3DKey,MbChessMem3DBlock<TData,cachSize>* > > MbChessMemPool3D<TData,cachSize>::mMapVector; - -template <class TData, std::size_t cachSize> -std::map<void*,MbChessMap3DKey > MbChessMemPool3D< TData, cachSize>::mPointerKeyMap; - -template <class TData, std::size_t cachSize> -const std::size_t MbChessMemPool3D<TData,cachSize>::mCacheSize=cachSize; - -//template <class TData, std::size_t cachSize> -//const std::size_t MbChessMemPool3D<TData,cachSize>::mNofElementsWidthMemBlock=static_cast<std::size_t>(pow(static_cast<double>(static_cast<std::size_t>(cachSize/sizeof(TData))),1./3.)); - -//template <class TData, std::size_t cachSize> -//const std::size_t MbChessMemPool3D<TData,cachSize>::mNofElementsInMemBlock=static_cast<std::size_t>(pow(static_cast<double>(static_cast<std::size_t>(pow(static_cast<double>(static_cast<std::size_t>(cachSize/sizeof(TData))),1./3.))),3.0)); - -template <class TData,std::size_t cachSize> -const std::size_t MbChessMem3DBlock<TData,cachSize>::mBlockWidth=static_cast<std::size_t>(std::pow(static_cast<double>(static_cast<std::size_t>(cachSize/sizeof(TData))),1./3.)); - -//template <class TData,std::size_t cachSize> -//const std::size_t MbChessMem3DBlock<TData,cachSize>::mMaxElements=static_cast<std::size_t>(pow(static_cast<double>(static_cast<std::size_t>(pow(static_cast<double>(static_cast<std::size_t>(pow(static_cast<double>(static_cast<std::size_t>(cachSize/sizeof(TData))),1.0/3.0))),3.0))),3.0)); - -#endif diff --git a/src/basics/basics/memory/MbMemPool.h b/src/basics/basics/memory/MbMemPool.h deleted file mode 100644 index e2482caa7..000000000 --- a/src/basics/basics/memory/MbMemPool.h +++ /dev/null @@ -1,87 +0,0 @@ -// _ ___ __ __________ _ __ -// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ -// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) -// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ -// -#ifndef MBMEMPOOL_H -#define MBMEMPOOL_H - -#include <queue> -#include <list> - - -template <typename TData, int asize> -class MbMemPool -{ - -protected: - MbMemPool(){} - // Alle 3 Attribute sind Singleton-Objekte ! - // Allokiere Blocke der Groesse m_asize - static int m_asize; - // Halte alle freien Pointer (jedes einzelne Element) in eine FIFO Liste - static std::queue<void*> m_queue; - // Pointer auf Bloecke zum Loeschen ! - static std::list<TData*> m_list; - -public: - - - ~MbMemPool(){} - - // Daten-Bloecke Loeschen, damit wird der gesamte Speicher freigegeben, - // erst aufrufen, wenn die objekte nicht mehr gebraucht werden! - static void deallocatePool(); - - void* operator new(std::size_t size) - { - void* pNew; - TData* feld; - int i; - - //i=m_queue.size(); - //pNew = m_queue.front(); - if(m_queue.size()==0) - { - //Wenn kein freier Speicher mehr vorhanden, Block anlegen - feld = new TData[m_asize]; - m_list.push_back(feld); - for(i=0 ; i<m_asize ; i++) - { - pNew = (void*) &(feld[i]); - m_queue.push( pNew ); - } - } - pNew = m_queue.front(); - m_queue.pop(); - return pNew; - - } - - void operator delete(void* p) - { - m_queue.push(p); - } -}; - - -template <typename TData, int asize> -std::queue<void*> MbMemPool<TData,asize>::m_queue; - -template <typename TData, int asize> -std::list<TData*> MbMemPool<TData,asize>::m_list; - -template <typename TData, int asize> -int MbMemPool<TData,asize>::m_asize=asize; - -template <typename TData, int asize> -void MbMemPool<TData,asize>::deallocatePool() -{ - for(typename std::list<TData*>::iterator pos=m_list.begin() ; pos!=m_list.end(); ++pos) - { - delete[] pos; - } -} - -#endif //MBMEMPOOL_H diff --git a/src/basics/basics/memory/MbSharedPointerDefines.h b/src/basics/basics/memory/MbSharedPointerDefines.h deleted file mode 100644 index 5d959e5ef..000000000 --- a/src/basics/basics/memory/MbSharedPointerDefines.h +++ /dev/null @@ -1,22 +0,0 @@ - -#ifndef MBSHAREDPOINTERDEFINES_H -#define MBSHAREDPOINTERDEFINES_H - - -#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; } -//}; - - - -#endif diff --git a/src/basics/basics/objects/ObCreator.h b/src/basics/basics/objects/ObCreator.h deleted file mode 100644 index 8b9ef047c..000000000 --- a/src/basics/basics/objects/ObCreator.h +++ /dev/null @@ -1,112 +0,0 @@ -// _ ___ __ __________ _ __ -// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ -// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) -// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ -// -#ifndef OBCREATOR_H -#define OBCREATOR_H - -#include <string> - -/*=========================================================================*/ -/* ObCreator / ObCreatorImpl */ -/* */ -/** -generic factory -<BR><BR> -@author <A HREF="mailto:muffmolch@gmx.de">S. Freudiger</A> -@version 1.0 - 14.06.07 -@version 1.1 - 12.04.08 -*/ - -/* -usage: see bottom of file "./ObFactory.h" -*/ - -////////////////////////////////////////////////////////////////////////// -// ObCreator -// Um in der Factory verschiedene Typen von Creaors in einer -// std::map<std::string,ObCreator<BaseT>*> halten zu koennen -// muss eine gemeinsame Basisklasse existieren -////////////////////////////////////////////////////////////////////////// -template< class BaseT > -class ObCreator -{ -public: - virtual std::string getObjectTypeID()=0; - virtual BaseT* createObject() = 0; - - virtual ~ObCreator() { } - -protected: - ObCreator() {} -private: - ObCreator( const ObCreator< BaseT >& ); //no copy allowed - const ObCreator& operator=( const ObCreator& ); //no copy allowed -}; - -////////////////////////////////////////////////////////////////////////// -// ObCreatorImpl -// Implementierung des speziellen Creators -////////////////////////////////////////////////////////////////////////// -template< class T, class BaseT=T > -class ObCreatorImpl : public ObCreator< BaseT > -{ -public: - static ObCreator<BaseT >* getInstance() - { - static ObCreatorImpl< T, BaseT > instance; - return &instance; - } - -public: - ~ObCreatorImpl() {} - - //aus portabilitaetsgruenden kann man nicht typeinfo nehmen, da diese compilerabhaengig ist - std::string getObjectTypeID() { return T::getStaticClassObjectTypeID(); } - - virtual T* createObject() { return new T(); } - -protected: - ObCreatorImpl() {} -private: - ObCreatorImpl( const ObCreatorImpl< T, BaseT >& ); //no copy allowed - const ObCreatorImpl& operator=( const ObCreatorImpl& ); //no copy allowed -}; - -////////////////////////////////////////////////////////////////////////// -// ObCreatorImpl -// Implementierung des speziellen Creators fuer Singletons -////////////////////////////////////////////////////////////////////////// -template< class T, class BaseT=T > -class ObSingletonCreatorImpl : public ObCreator< BaseT > -{ -public: - static ObCreator<BaseT >* getInstance() - { - static ObSingletonCreatorImpl< T, BaseT > instance; - return &instance; - } -public: - ~ObSingletonCreatorImpl() {} - - //aus portabilitaetsgruenden kann man nicht typeinfo nehmen, da diese compilerabhaengig ist - std::string getObjectTypeID() { return T::getStaticClassObjectTypeID(); } - - virtual T* createObject() { return T::getInstance(); } - -protected: - ObSingletonCreatorImpl() {} -private: - ObSingletonCreatorImpl( const ObSingletonCreatorImpl< T, BaseT >& ); //no copy allowed - const ObSingletonCreatorImpl& operator=( const ObSingletonCreatorImpl& ); //no copy allowed -}; - -//workaround for the not perfect C++ world. typeinfo::name is not usable for this purpose! -//see Andrei Alexandrescu, "Modern C++ Design: Generic Programming and Design Patterns Applied", Chapter 8.5 -#define OBCREATOR_EXT( ClassObject ) \ - static std::string getStaticClassObjectTypeID() { return #ClassObject; } \ - virtual std::string getClassObjectTypeID() { return getStaticClassObjectTypeID(); } - -#endif //OBCREATOR_H diff --git a/src/basics/basics/objects/ObFactory.h b/src/basics/basics/objects/ObFactory.h deleted file mode 100644 index aa522ec5c..000000000 --- a/src/basics/basics/objects/ObFactory.h +++ /dev/null @@ -1,174 +0,0 @@ -// _ ___ __ __________ _ __ -// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ -// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) -// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ -// -#ifndef OBFACTORY_H -#define OBFACTORY_H - - -#include <string> -#include <map> -#include <sstream> -#include <iomanip> -#include <typeinfo> - -#include <basics/objects/ObCreator.h> - -/*=========================================================================*/ -/* ObFactory */ -/* */ -/** -generic factory -<BR><BR> -@author <A HREF="mailto:muffmolch@gmx.de">S. Freudiger</A> -@version 1.0 - 14.06.07 -@version 1.1 - 12.04.08 -*/ - -/* -usage: T = zu erzeugende Klasse - Creator = Erzeugerklasse -////////////////////////////////////////////////////////////////////////// -//example -////////////////////////////////////////////////////////////////////////// -// class Base{ -// public: -// OBCREATOR_EXT(Base) -// }; -// //automatisches registrieren: -// UB_AUTO_RUN_NAMED(ObFactory<Base>::getInstance()->addObCreator(ObCreatorImpl<Base,Base>::getInstance()), CAB_Base); -// class Derived : public Base -// { -// public: -// OBCREATOR_EXT(Derived) -//}; -// //automatisches registrieren: -// UB_AUTO_RUN_NAMED(ObFactory<Base>::getInstance()->addObCreator(ObCreatorImpl<Base,Derived>::getInstance()), CAB_Derived); -//////////////////////////////////////////////////////////////////////////// -// int main() -// { -// //Alternativ zu UB_AUTO_RUN_NAMED: haendisches registrieren -// ObFactory<Base>::getInstance()->addObCreator(ObCreatorImpl<Base>::getInstance()); -// ObFactory<Base>::getInstance()->addObCreator(ObCreatorImpl<Derived,Base>::getInstance()); -// -// //create objects - method1 -// Base* test1 = ObFactory<Base>::getInstance()->createObject<Base>(); -// Base* test2 = ObFactory<Base>::getInstance()->createObject<Derived>(); -// -// //create objects - method2 -// Base* test1 = ObFactory<Base>::getInstance()->createObject(Base::getStaticClassObjectTypeID() ); -// Base* test2 = ObFactory<Base>::getInstance()->createObject(Derived::getStaticClassObjectTypeID() ); -// //... -// } -*/ - - -template<class T, typename Creator = ObCreator< T > > -class ObFactory -{ - typedef std::map< std::string, Creator* > CreatorMap; - typedef typename CreatorMap::iterator CreatorMapIt; - typedef std::pair< std::string, Creator* > CreatorMapElement; - -protected: - ObFactory() {} //so ist vererbung gewahrleistet - -private: - ObFactory( const ObFactory< T, Creator >& ); //no copy allowed - const ObFactory& operator=( const ObFactory& ); //no copy allowed - - -public: - virtual ~ObFactory() {} - - static ObFactory< T, Creator >* getInstance() - { - static ObFactory< T, Creator > instance; - return &instance; - } - - bool addObCreator(Creator* creator); - bool removeObCreator(Creator* creator); - - T* createObject(const std::string& objectTypeID); - - template< typename T2 > - T* createObject() { return this->createObject( T2::getStaticClassObjectTypeID() ); } - - Creator* getCreator(const std::string& objectTypeID); - - virtual std::string toString(); - -private: - CreatorMap creatorMap; -}; - -////////////////////////////////////////////////////////////////////////// -//Implementation -template<class T, typename Creator > -bool ObFactory< T, Creator >::addObCreator(Creator* creator) -{ - if(creatorMap.insert( CreatorMapElement(creator->getObjectTypeID(), creator) ).second ) - { - //insert succeeded - return true; - } - //insert fails - return false; -} -/*======================================================================*/ -template<class T, typename Creator > -bool ObFactory< T, Creator >::removeObCreator(Creator* creator) -{ - if(creator && creatorMap->erase( creator->getClassObjectTypeID() ) ) - return true; - - return false; -} -/*======================================================================*/ -template<class T, typename Creator > -Creator* ObFactory< T, Creator >::getCreator(const std::string& obtypeID) -{ - CreatorMapIt it = creatorMap.find(obtypeID); - if(it == creatorMap.end()) return NULL; - - Creator* creator = it->second; - if(!creator) return NULL; - - return creator; -} -/*======================================================================*/ - template<class T, typename Creator > - T* ObFactory< T, Creator >::createObject(const std::string& objectTypeID) - { - Creator* creator = this->getCreator(objectTypeID); - - if(!creator) - { - UB_THROW( UbException(UB_EXARGS,"no creator avaivlable for ID="+objectTypeID ) ); - } - - return creator->createObject(); - } -/*======================================================================*/ -template<class T, typename Creator > -std::string ObFactory< T, Creator >::toString() -{ - std::size_t maxL = 6; - for(CreatorMapIt it=creatorMap.begin(); it!=creatorMap.end(); ++it) - if( it->first.size() > maxL ) - maxL = it->first.size(); - - std::stringstream os; - os<<(std::string)typeid(*this).name()<<" - info:"<<std::endl; - os<<" "<<std::left<<std::setw(maxL)<<"object"<<" <-> "<<"creator "<<std::endl; - for(CreatorMapIt it=creatorMap.begin(); it!=creatorMap.end(); ++it) - os<< " - " << std::setw(maxL) << it->first << " <-> " << (std::string)typeid(*it->second).name() << std::endl; - - return os.str(); -} -/*======================================================================*/ - -#endif //OBFACTORY_H diff --git a/src/basics/basics/objects/ObObject.cpp b/src/basics/basics/objects/ObObject.cpp deleted file mode 100644 index e7774e916..000000000 --- a/src/basics/basics/objects/ObObject.cpp +++ /dev/null @@ -1,10 +0,0 @@ -//#include <basics/objects/ObObject.h> - -// ObObject::ObObject() -// { -// } -// /*=======================================*/ -// std::string ObObject::getName() -// { -// return name; -// } diff --git a/src/basics/basics/objects/ObObjectCreator.h b/src/basics/basics/objects/ObObjectCreator.h deleted file mode 100644 index 3224466dc..000000000 --- a/src/basics/basics/objects/ObObjectCreator.h +++ /dev/null @@ -1,58 +0,0 @@ -// _ ___ __ __________ _ __ -// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ -// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) -// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ -// -#ifndef OBOBJECTCREATOR_H -#define OBOBJECTCREATOR_H - -#include <string> - -class ObObject; -class ObObjectManager; - -class Presentator; -class QViewer; - -#ifdef CAB_QT -class QObObjectSpecificInstrument; -class QWidget; -class QActionGroup; -#endif - -class ObObjectCreator -{ -public: - virtual ~ObObjectCreator() {} - - virtual ObObject* createObObject()=0; - - virtual std::string getTypeID() { return "ObObject"; } - virtual std::string toString() { return "ObObjectCreator"; } - -#ifdef CAB_QT - //virtual Presentator* createObjectPresentator(ObObject *object)=0; - virtual Presentator* createObjectPresentator(ObObject *object) { return NULL; } - virtual QActionGroup* getSpecificPresentatorGroup(ObObject* object, QViewer *viewer, QWidget* parent) { return NULL; } - virtual QActionGroup* getSpecificActionGroup(ObObjectManager* manager, ObObject* object, QWidget* parent) - { - return NULL; - } - - virtual ObObject* createObObjectWithQt() { return NULL; } - virtual void showSpecificInstrument(ObObject* object, QWidget* parent=0) {} - virtual QObObjectSpecificInstrument* getSpecificInstrument() { return NULL; } - - //virtual QActionGroup *getSpecificContextMenuActionGroup() { return NULL; } -#endif - -protected: - ObObjectCreator() {} - -private: - ObObjectCreator( const ObObjectCreator& ); //no copy allowed - const ObObjectCreator& operator=( const ObObjectCreator& ); //no copy allowed - -}; -#endif diff --git a/src/basics/basics/objects/ObObjectFactory.cpp b/src/basics/basics/objects/ObObjectFactory.cpp deleted file mode 100644 index 49bf03fe3..000000000 --- a/src/basics/basics/objects/ObObjectFactory.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include <basics/objects/ObObjectFactory.h> - -/**** Eigene ****/ -#include <basics/objects/ObObjectCreator.h> -#include <basics/utilities/UbException.h> - -using namespace std; - -//ObObjectFactory::ObObjectFactory() -//{ -//} -// -//ObObjectFactory::~ObObjectFactory() -//{ -//} -/*======================================================================*/ -//ObObjectFactory* ObObjectFactory::getInstance() -//{ -// static ObObjectFactory instance; -// return &instance; -//} -/*======================================================================*/ -void ObObjectFactory::addObObjectCreator(ObObjectCreator *creator) -{ - //cout<<"Meth:"<<creator->toString()<<" Meth-ID:"<<creator->getTypeID()<<endl; - creatorSet.insert(std::pair<string, ObObjectCreator*>(creator->getTypeID(), creator)); -} -/*======================================================================*/ -void ObObjectFactory::removeObObjectCreator(ObObjectCreator *creator) -{ - UB_THROW( UbException(UB_EXARGS,"not implemented") ); -} -/*======================================================================*/ -ObObjectCreator* ObObjectFactory::getCreator(string objectType) -{ - std::map<string, ObObjectCreator*>::iterator creatorIterator = creatorSet.find(objectType); - if(creatorIterator == creatorSet.end()) UB_THROW( UbException(UB_EXARGS,"factory has no creator for "+objectType) ); - ObObjectCreator *creator = creatorIterator->second; - if(!creator) UB_THROW( UbException(UB_EXARGS,"no time series creator for type available") ); - return creator; -} -/*======================================================================*/ -string ObObjectFactory::toString() -{ - stringstream text; - - std::map<string, ObObjectCreator*>::iterator creatorIterator; - std::map<string, ObObjectCreator*>* creatorSet = this->getCreatorSet(); - - for(creatorIterator = creatorSet->begin(); creatorIterator!=creatorSet->end(); ++creatorIterator) - text<<" - "<<(creatorIterator->second)->toString()<<" for "<<(creatorIterator->first)<<endl; - - return text.str(); -} diff --git a/src/basics/basics/objects/ObObjectFactory.h b/src/basics/basics/objects/ObObjectFactory.h deleted file mode 100644 index 2af7458cd..000000000 --- a/src/basics/basics/objects/ObObjectFactory.h +++ /dev/null @@ -1,42 +0,0 @@ -// _ ___ __ __________ _ __ -// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ -// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) -// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ -// -#ifndef OBOBJECTFACTORY_H -#define OBOBJECTFACTORY_H - -#include <string> -#include <map> - -class ObObjectCreator; - -class ObObjectFactory -{ -public: - ObObjectFactory() {} - virtual ~ObObjectFactory() {} - - //static geht nicht, da abgeleitete Factories existieren ... - //static ObObjectFactory* getInstance(); - //virtual ObObjectFactory* getInstance()=0; - - ObObjectCreator* getCreator(std::string objectType); - - void addObObjectCreator(ObObjectCreator* creator); - void removeObObjectCreator(ObObjectCreator* creator); - - std::map<std::string, ObObjectCreator*>* getCreatorSet() { return &creatorSet; } - - virtual std::string toString(); - -private: - ObObjectFactory( const ObObjectFactory& ); //no copy allowed - const ObObjectFactory& operator=( const ObObjectFactory& ); //no copy allowed - - std::map<std::string, ObObjectCreator*> creatorSet; -}; - - -#endif //OBOBJECTFACTORY_H diff --git a/src/basics/basics/objects/ObObjectManager.cpp b/src/basics/basics/objects/ObObjectManager.cpp deleted file mode 100644 index d84f49fc1..000000000 --- a/src/basics/basics/objects/ObObjectManager.cpp +++ /dev/null @@ -1,216 +0,0 @@ -#include <basics/objects/ObObjectManager.h> -#include <basics/objects/ObObject.h> -#include <basics/objects/ObObjectCreator.h> -#include <basics/utilities/UbTableModel.h> -#include <basics/utilities/UbException.h> - -using namespace std; - -ObObjectEntry::ObObjectEntry(ObObjectManager *parent, ObObject *object) -{ - this->parent = parent; - this->object = object; -} -/*======================================================*/ -ObObjectManager::ObObjectManager() -{ - this->selectedObject = NULL; - this->tableModel = NULL; -} - -/*======================================================*/ -ObObjectManager::~ObObjectManager() -{ - //cerr<<"NEIN, notifyObserversObjectWillBeDeleted wird AUSSCHLIESSLICH von BasisKlasse aufgerufen!!!"<<endl; - // cerr<<"das muss so sein, denn ansonsten duerfte diese funktion nur in der speziellen klasse stehen, da\n"; - // cerr<<"virtuelle destruktoren sich rekursiv vom speziellen ins allg. aufrufen --> notify.. wuerde\n"; - // cerr<<"oefters aufgerufen werden...\n"; - - this->objectList.clear(); - if(this->tableModel) delete this->tableModel; -} -/*======================================================*/ -UbTableModel* ObObjectManager::getTableModel() -{ - return tableModel; -} -/*======================================================*/ -//bool ObObjectManager::addObObject(ObObject *object) -//{ -// cout<<"ObObjectManager::addObObject "<<object->toString()<<endl; -// for(int pos=0; pos<(int)this->objectList.size(); pos++) -// if(this->objectList[pos]->object==object) -// return false; -// -// this->objectList.push_back(new ObObjectEntry(this,object)); -// //object->addObserver(this); -// this->selectObObject(object); -// return true; -//} -/*======================================================*/ -bool ObObjectManager::addObObjectEntry(ObObjectEntry* objectEntry) -{ - for(int pos=0; pos<(int)this->objectList.size(); pos++) - if(this->objectList[pos]->object==objectEntry->object) - return false; - - this->objectList.push_back(objectEntry); -// objectEntry->getObject()->addObserver(this); - this->selectObObject(objectEntry->object); - return true; -} -/*======================================================*/ -bool ObObjectManager::removeObObject(ObObject* object) -{ - if (this->selectedObject == object) this->selectedObject=NULL; - for(int pos=0; pos<(int)this->objectList.size(); pos++) - { - - if(this->objectList[pos]->object==object) - { - return this->removeObObject(pos); -// this->objectList.erase(objectList.begin()+pos); -// //this->removeObserver(this); -// return true; - } - } - return false; -} -/*======================================================*/ -bool ObObjectManager::removeObObject(int index) -{ - try - { - if ( objectList[index]->object == this->selectedObject ) this->selectedObject=NULL; - //den entry loeschen ... das object im Entry ??? erstmal ausserhalb ... - delete objectList[index]; - objectList.erase(objectList.begin()+index); - this->notifyObserversObjectChanged(); - return true; - } - catch(const std::exception& e) { cerr<<e.what()<<endl; } - catch(...) { cerr<<"Fehler in ObObjectManager::removeObObject"<<endl; } - return false; -} -/*======================================================*/ -void ObObjectManager::removeAllObObjects() -{ - //TODO: implementieren!! - //foreach grid: - //grid->removeObserver(this); - //vector<ObObject*>::iterator it; - //for(it=objectList.begin(); it!=objectList.end(); it++) - //{ - // it->removeObserver(this); - //} -// for(int i=0; i<(int)objectList.size(); i++) -// { -// delete objectList[i]->object->removeObserver(this); -// } - this->objectList.clear(); - this->selectedObject = NULL; - this->notifyObserversObjectChanged(); -} -/*======================================================*/ -int ObObjectManager::getNumberOfObObjects() -{ - return (int)this->objectList.size(); -} -/*======================================================*/ -vector<ObObject*>* ObObjectManager::getAllObObjects() -{ - UB_THROW( UbException(UB_EXARGS,"hier muss noch was getan werden") ); -// return this->objectList; -} -vector<ObObjectEntry*>* ObObjectManager::getAllObObjectEntries() -{ - return &this->objectList; -} -/*======================================================*/ -ObObject* ObObjectManager::getObObject(int index) -{ - if(index < 0) return NULL; - if(index >= (int)this->objectList.size()) return NULL; - - return(this->objectList[index]->object); -} -/*======================================================*/ -ObObjectEntry* ObObjectManager::getObObjectEntry(int index) -{ - if(index < 0) return NULL; - if(index >= (int)this->objectList.size()) return NULL; - - return(this->objectList[index]); -} -/*====================================================*/ -string ObObjectManager::toString() -{ - stringstream ss; ss<<endl; - - for(int pos=0; pos<(int)this->objectList.size(); pos++) - { - ObObject* object = this->objectList[pos]->object; - ss<<(pos+1)<<". "<<object->toString()<<endl; - } - return ss.str(); -} -/*======================================================*/ -void ObObjectManager::objectChanged(UbObservable* observable) -{ - //cout<<"ObObjectManager::objectChanged ??"; - this->notifyObserversObjectChanged(); -} -/*======================================================*/ -void ObObjectManager::objectWillBeDeleted(UbObservable* observable) -{ - cout<<"ObObjectManager::objectWillBeDeleted ??"; - //observable->removeObserver(this); -} -/*======================================================*/ -bool ObObjectManager::selectObObject(int index) -{ - if((int)this->objectList.size()==0) - { - this->selectedObject = NULL; return false; - } - if (index > (int)this->objectList.size()-1 || index < 0) return false; - if ( this->selectedObject == this->getObObject(index) ) return true; - - this->selectedObject = this->getObObject(index); - //cout<<this->getObserverList()->size()<<endl; - - this->notifyObserversObjectChanged(); - return true; -} -/*======================================================*/ -bool ObObjectManager::selectObObject(ObObject* object) -{ - if((int)this->objectList.size()==0) { this->selectedObject = NULL; return false; } - for(int pos=0; pos<(int)this->objectList.size(); pos++) - { - if(this->objectList[pos]->object==object) - { - return this->selectObObject(pos); - } - } - return false; -} -/*======================================================*/ -ObObject* ObObjectManager::getSelectedObObject() -{ - return this->selectedObject; -} -/*======================================================*/ -int ObObjectManager::getSelectedIndex() -{ - for(int pos=0; pos<(int)this->objectList.size(); pos++) - { - if(this->objectList[pos]->object==this->selectedObject) - { - return pos; - } - } - return -1; -} -/*======================================================*/ - diff --git a/src/basics/basics/objects/ObObjectManager.h b/src/basics/basics/objects/ObObjectManager.h deleted file mode 100644 index 9d5b42df9..000000000 --- a/src/basics/basics/objects/ObObjectManager.h +++ /dev/null @@ -1,79 +0,0 @@ -// _ ___ __ __________ _ __ -// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ -// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) -// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ -// -#ifndef OBOBJECTMANAGER_H -#define OBOBJECTMANAGER_H - -#include <string> -#include <sstream> -#include <vector> - -#include <basics/utilities/UbObservable.h> -#include <basics/utilities/UbObserver.h> - -class UbException; -class UbTableModel; -class ObObjectManager; -class ObObjectFactory; -class ObObject; - - -class ObObjectEntry -{ - friend class ObObjectManager; -public: - ObObjectManager* getParent() { return parent; } - ObObject* getObject() { return object; } - - ObObjectEntry(ObObjectManager* parent, ObObject* object); - virtual ~ObObjectEntry() { } - -protected: - ObObjectManager* parent; - ObObject* object; -}; - - -class ObObjectManager : public UbObservable, public UbObserver -{ -public: - ObObjectManager(); - ~ObObjectManager(); - - //virtual bool addObObject(ObObject* object); - virtual bool addObObjectEntry(ObObjectEntry* objectEntry); - - virtual ObObjectEntry* createNewObObjectEntry(ObObject* obj) { return new ObObjectEntry(this, obj); } - - bool removeObObject(ObObject* object); - bool removeObObject(int index); - void removeAllObObjects(); - bool selectObObject(int index); - bool selectObObject(ObObject* object); - ObObject* getSelectedObObject(); - int getSelectedIndex(); - - int getNumberOfObObjects(); - std::vector<ObObject*>* getAllObObjects(); - std::vector<ObObjectEntry*>* getAllObObjectEntries(); - ObObject* getObObject(int index); - ObObjectEntry* getObObjectEntry(int index); - - std::string toString(); - - virtual void objectChanged(UbObservable* observable); - virtual void objectWillBeDeleted(UbObservable* observable); - - UbTableModel* getTableModel(); - virtual ObObjectFactory* getObObjectFactory()=0; - -protected: - std::vector<ObObjectEntry*> objectList; - ObObject* selectedObject; - UbTableModel* tableModel; -}; - -#endif //OBOBJECTMANAGER_H diff --git a/src/basics/basics/parallel/PbMpiTools.h b/src/basics/basics/parallel/PbMpiTools.h deleted file mode 100644 index 07ea52881..000000000 --- a/src/basics/basics/parallel/PbMpiTools.h +++ /dev/null @@ -1,303 +0,0 @@ -// _ ___ __ __________ _ __ -// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ -// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) -// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ -// -#ifndef PBMPITOOLS_H -#define PBMPITOOLS_H - -#include <vector> -#include <sstream> - -//#undef SEEK_SET -//#undef SEEK_CUR -//#undef SEEK_END -#include <mpi.h> -#include <basics/utilities/UbException.h> - -#ifdef USE_MPI_CXX_SYNTAX - -namespace PbMpiTools -{ - /*======================================================================*/ - // send a single value "value" of MPI_Datatype - template <class T> - inline void sendSingleValue(const T& value, MPI_Datatype datatype, int dest, int tag, MPI::Intracomm comm); - - /*======================================================================*/ - // receives a single value "value" of MPI_Datatype - template <class T> - inline void receiveSingleValue(T& value, MPI_Datatype datatype, int source, int tag, MPI::Intracomm comm); - - /*======================================================================*/ - // receives and returns a single value of MPI_Datatype - // expample: int value = PbMpiTools::receiveSingleValue<int>(MPI::INT,0,10,comm); - template <class T> - inline T receiveSingleValue(MPI_Datatype datatype, int source, int tag, MPI::Intracomm comm); - - /*======================================================================*/ - // sends bool value (doesn't work with template, why ever... stupid MPI) - inline void sendBoolValue(const bool& value,int dest, int tag, MPI::Intracomm comm); - - /*======================================================================*/ - // receives bool value (doesn't work with template, why ever... stupid MPI) - inline bool receiveBoolValue(int source, int tag, MPI::Intracomm comm); - - /*======================================================================*/ - // sends bool value (doesn't work with template, why ever... stupid MPI) - inline void sendStringValue(const std::string& value,int dest, int tag, MPI::Intracomm comm); - - /*======================================================================*/ - // receives bool value (doesn't work with template, why ever... stupid MPI) - inline std::string receiveStringValue(int source, int tag, MPI::Intracomm comm); - - /*======================================================================*/ - // send a vector of MPI_Datatype - template <class T> - inline void sendVector(const std::vector<T>& v, MPI_Datatype datatype, int dest, int tag, MPI::Intracomm comm); - - /*======================================================================*/ - // receive a std::vector of MPI_Datatype - template <class T> - inline void receiveVector(std::vector<T>& v, MPI_Datatype datatype, int source, int tag, MPI::Intracomm comm); - - /*======================================================================*/ - // receive a vector of MPI_Datatype and adds this vector to existing vector - // ans returns number of received elements - template <class T> - inline int receiveVectorAndAddToVector(std::vector<T>& v, MPI_Datatype datatype, int source, int tag, MPI::Intracomm comm); - - /*======================================================================*/ - // send a std::vector of strings - inline void sendStringVector(const std::vector<std::string>& v, int dest, int tag, MPI::Intracomm comm); - - /*======================================================================*/ - // send a vector of strings - inline void receiveStringVector(std::vector<std::string>& v, int dest, int tag, MPI::Intracomm comm); -}; - -/*======================================================================*/ -// send a single value of MPI_Datatype -template <class T> -void PbMpiTools::sendSingleValue(const T& value, MPI_Datatype datatype, int dest, int tag, MPI::Intracomm comm) -{ - try{ comm.Send(&value, 1, datatype, dest, tag); } - catch(MPI::Exception& e){ std::stringstream ss; ss<<"MPI::Exception error_string="<<e.Get_error_string()<<std::endl; - UB_THROW( UbException(UB_EXARGS,"catched with info at send size\n"+ss.str()) ); } - catch(...) { UB_THROW( UbException(UB_EXARGS,"unknown exception at send size") ); } -} -/*======================================================================*/ -template <class T> -void PbMpiTools::receiveSingleValue(T& value, MPI_Datatype datatype, int source, int tag, MPI::Intracomm comm) -{ - try { comm.Recv(&value, 1, datatype, source, tag); } - catch(MPI::Exception& e){ std::stringstream ss;ss<<"MPI::Exception error_string="<<e.Get_error_string()<<std::endl; - UB_THROW( UbException(UB_EXARGS,"MPI:Exception catched with info at receive size\n"+ss.str()) );} - catch(...) { UB_THROW( UbException(UB_EXARGS,"unknown exception at receive size") ); } -} -/*======================================================================*/ -template <class T> -T PbMpiTools::receiveSingleValue(MPI_Datatype datatype, int source, int tag, MPI::Intracomm comm) -{ - T value; - try { comm.Recv(&value, 1, datatype, source, tag); } - catch(MPI::Exception& e){ std::stringstream ss;ss<<"MPI::Exception error_string="<<e.Get_error_string()<<std::endl; - UB_THROW( UbException(UB_EXARGS,"MPI:Exception catched with info at receive size\n"+ss.str()) );} - catch(...) { UB_THROW( UbException(UB_EXARGS,"unknown exception at receive size") ); } - - return value; -} -/*======================================================================*/ -// send a bool value (bool doesn't work with template, why ever) -void PbMpiTools::sendBoolValue(const bool& value,int dest, int tag, MPI::Intracomm comm) -{ - short dummy; - if(value) dummy=1; - else dummy=0; - - try{ comm.Send(&dummy, 1, MPI::SHORT, dest, tag); } - catch(MPI::Exception& e){ std::stringstream ss; ss<<"MPI::Exception error_string="<<e.Get_error_string()<<std::endl; - UB_THROW( UbException(UB_EXARGS,"MPI:Exception catched with info at send size\n"+ss.str()) ); } - catch(...) { UB_THROW( UbException(UB_EXARGS,"unknown exception at send size") ); } -} -/*======================================================================*/ -bool PbMpiTools::receiveBoolValue(int source, int tag, MPI::Intracomm comm) -{ - short dummy; - try { comm.Recv(&dummy, 1, MPI::SHORT, source, tag); } - catch(MPI::Exception& e){ std::stringstream ss;ss<<"MPI::Exception error_string="<<e.Get_error_string()<<std::endl; - UB_THROW( UbException(UB_EXARGS,"MPI:Exception catched with info at receive size\n"+ss.str()) );} - catch(...) { UB_THROW( UbException(UB_EXARGS,"unknown exception at receive size") ); } - - return (dummy==1); -} -/*======================================================================*/ -// sends bool value (doesn't work with template, why ever... stupid MPI) -void PbMpiTools::sendStringValue(const std::string& value,int dest, int tag, MPI::Intracomm comm) -{ - std::vector<char> vec; - for(std::size_t i=0; i<value.size(); i++) - vec.push_back(value[i]); - PbMpiTools::sendVector(vec,MPI::CHAR,dest,tag,comm); -} - -/*======================================================================*/ -// receives bool value (doesn't work with template, why ever... stupid MPI) -std::string PbMpiTools::receiveStringValue(int source, int tag, MPI::Intracomm comm) -{ - std::vector<char> vec; - PbMpiTools::receiveVector(vec,MPI::CHAR,source,tag,comm); - std::string str; - for(std::size_t i=0; i<vec.size(); i++) - str+=vec[i]; - - return str; -} -/*======================================================================*/ -// send a vector of MPI_Datatype -template <class T> -void PbMpiTools::sendVector(const std::vector<T>& v, MPI_Datatype datatype, int dest, int tag, MPI::Intracomm comm) -{ - // send size - int size = (int)v.size(); - - try{ comm.Send(&size, 1, MPI::INT, dest, tag); } - catch(MPI::Exception& e){ std::stringstream ss; ss<<"MPI::Exception error_string="<<e.Get_error_string()<<std::endl; - UB_THROW( UbException(UB_EXARGS,"MPI:Exception catched with info at send size\n"+ss.str()) ); } - catch(...) { UB_THROW( UbException(UB_EXARGS,"unknown exception at send size") ); } - - if(size>0) - { - try{ comm.Send(&v[0], size, datatype, dest, tag); } - catch(MPI::Exception& e){ std::stringstream ss; ss<<"MPI::Exception error_string="<<e.Get_error_string()<<std::endl; - UB_THROW( UbException(UB_EXARGS,"MPI:Exception catched with info at send vector<T>\n"+ss.str()) );} - catch(...) { UB_THROW( UbException(UB_EXARGS,"unknown exception at send vector<T>") ); } - } -} -/*======================================================================*/ -// receive a vector of MPI_Datatype -template <class T> -void PbMpiTools::receiveVector(std::vector<T>& v, MPI_Datatype datatype, int source, int tag, MPI::Intracomm comm) -{ - int size; - - try { comm.Recv(&size, 1, MPI::INT, source, tag); } - catch(MPI::Exception& e){ std::stringstream ss;ss<<"MPI::Exception error_string="<<e.Get_error_string()<<std::endl; - UB_THROW( UbException(UB_EXARGS,"MPI:Exception catched with info at receive size\n"+ss.str()) );} - catch(...) { UB_THROW( UbException(UB_EXARGS,"unknown exception at receive size") ); } - - v.resize(size); - - if( size>0 ) - { - try{ comm.Recv(&v[0], size, datatype, source, tag); } - catch(MPI::Exception& e){ std::stringstream ss; ss<<"MPI::Exception error_string="<<e.Get_error_string()<<std::endl; - UB_THROW( UbException(UB_EXARGS,"MPI:Exception catched with info at receive vector\n"+ss.str()) ); } - catch(...) { UB_THROW( UbException(UB_EXARGS,"unknown exception at receive vector") ); } - } -} -/*======================================================================*/ -// receive a vector of MPI_Datatype and adds this vector to existing vector -// return value is size of received elements -template <class T> -int PbMpiTools::receiveVectorAndAddToVector(std::vector<T>& v, MPI_Datatype datatype, int source, int tag, MPI::Intracomm comm) -{ - int incommingSize; - - try { comm.Recv(&incommingSize, 1, MPI::INT, source, tag); } - catch(MPI::Exception& e){ std::stringstream ss;ss<<"MPI::Exception error_string="<<e.Get_error_string()<<std::endl; - UB_THROW( UbException(UB_EXARGS,"MPI:Exception catched with info at receive size\n"+ss.str()) );} - catch(...) { UB_THROW( UbException(UB_EXARGS,"unknown exception at receive size") ); } - - int oldSize = (int)v.size(); - v.resize(oldSize+incommingSize); - - if( incommingSize>0 ) - { - try{ comm.Recv(&v[oldSize], incommingSize, datatype, source, tag); } - catch(MPI::Exception& e){ std::stringstream ss; ss<<"MPI::Exception error_string="<<e.Get_error_string()<<std::endl; - UB_THROW( UbException(UB_EXARGS,"MPI:Exception catched with info at receive vector\n"+ss.str()) ); } - catch(...) { UB_THROW( UbException(UB_EXARGS,"unknown exception at receive vector") ); } - } - - return incommingSize; -} -/*======================================================================*/ -// send a vector of strings -void PbMpiTools::sendStringVector(const std::vector<std::string>& v, int dest, int tag, MPI::Intracomm comm) -{ - // send size - int stringVectorSize = (int)v.size(); - - try{ comm.Send(&stringVectorSize, 1, MPI::INT, dest, tag); } - catch(MPI::Exception& e){ std::stringstream ss; ss<<"MPI::Exception error_string="<<e.Get_error_string()<<std::endl; - UB_THROW( UbException(UB_EXARGS,"MPI:Exception catched with info at send size\n"+ss.str()) ); } - catch(...) { UB_THROW( UbException(UB_EXARGS,"unknown exception at send size") ); } - - if(stringVectorSize>0) - { - std::vector<int> singleStringSizes(stringVectorSize+1); - int nofChars = 0; - for(int i=0; i<stringVectorSize; i++) - nofChars += singleStringSizes[i] = (int)v[i].length(); - singleStringSizes[stringVectorSize] = nofChars; - - try{ comm.Send(&singleStringSizes[0], stringVectorSize+1, MPI::INT, dest, tag); } - catch(MPI::Exception& e){ std::stringstream ss; ss<<"MPI::Exception error_string="<<e.Get_error_string()<<std::endl; - UB_THROW( UbException(UB_EXARGS,"MPI:Exception catched with info at send vector<T>\n"+ss.str()) );} - catch(...) { UB_THROW( UbException(UB_EXARGS,"unknown exception at send vector<T>") ); } - - std::vector<char> charVector(nofChars); - int pos = 0; - for(int i=0; i<stringVectorSize; i++) - for(int j=0; j<singleStringSizes[i]; j++) - charVector[pos++] = v[i][j]; - - try{ comm.Send(&charVector[0], nofChars, MPI::CHAR, dest, tag); } - catch(MPI::Exception& e){ std::stringstream ss; ss<<"MPI::Exception error_string="<<e.Get_error_string()<<std::endl; - UB_THROW( UbException(UB_EXARGS,"MPI:Exception catched with info at send vector<T>\n"+ss.str()) );} - catch(...) { UB_THROW( UbException(UB_EXARGS,"unknown exception at send vector<T>") ); } - } -} -/*======================================================================*/ -// send a vector of strings -void PbMpiTools::receiveStringVector(std::vector<std::string>& v, int source, int tag, MPI::Intracomm comm) -{ - // send size - int stringVectorSize; - try { comm.Recv(&stringVectorSize, 1, MPI::INT, source, tag); } - catch(MPI::Exception& e){ std::stringstream ss; ss<<"MPI::Exception error_string="<<e.Get_error_string()<<std::endl; - UB_THROW( UbException(UB_EXARGS,"MPI:Exception catched with info at send size\n"+ss.str()) ); } - catch(...) { UB_THROW( UbException(UB_EXARGS,"unknown exception at send size") ); } - - v.clear(); - v.resize(stringVectorSize); - - if(stringVectorSize>0) - { - std::vector<int> singleStringSizes(stringVectorSize+1); - - try{ comm.Recv(&singleStringSizes[0], stringVectorSize+1, MPI::INT, source, tag); } - catch(MPI::Exception& e){ std::stringstream ss; ss<<"MPI::Exception error_string="<<e.Get_error_string()<<std::endl; - UB_THROW( UbException(UB_EXARGS,"MPI:Exception catched with info at send vector<T>\n"+ss.str()) );} - catch(...) { UB_THROW( UbException(UB_EXARGS,"unknown exception at send vector<T>") ); } - - int nofChars = singleStringSizes[stringVectorSize]; - std::vector<char> charVector(nofChars); - - try{ comm.Recv(&charVector[0], nofChars, MPI::CHAR, source, tag); } - catch(MPI::Exception& e){ std::stringstream ss; ss<<"MPI::Exception error_string="<<e.Get_error_string()<<std::endl; - UB_THROW( UbException(UB_EXARGS,"MPI:Exception catched with info at send vector<T>\n"+ss.str()) );} - catch(...) { UB_THROW( UbException(UB_EXARGS,"unknown exception at send vector<T>") ); } - - int pos=0; - for(int i=0; i<stringVectorSize; i++) - for(int j=0; j<singleStringSizes[i]; j++) - v[i].push_back(charVector[pos++]); - } -} - -#endif - -#endif //PBMPITOOLS_H diff --git a/src/basics/basics/parallel/examples/simpleMPI/CMakeLists.txt b/src/basics/basics/parallel/examples/simpleMPI/CMakeLists.txt deleted file mode 100644 index a44b5c76e..000000000 --- a/src/basics/basics/parallel/examples/simpleMPI/CMakeLists.txt +++ /dev/null @@ -1,64 +0,0 @@ -cmake_minimum_required(VERSION 2.6) - -INCLUDE("../../../../CMakeCABMacros.txt") -INCLUDE("../../../../CMakeSetCompilerFlags.txt") - -CHECK_FOR_VARIABLE(CAB_MACHINE "machine name, e.g. ALTIX, ARWEN") -SET(CMAKE_CONFIG_FILE "${SOURCE_ROOT}/cmake_config_files/${CAB_MACHINE}.config.cmake") - -PROJECT(simpleMPI) - -#erst hier das config file einfügen, ansonsten werden manche settings durch (Project) überschrieben) -INCLUDE(${CMAKE_CONFIG_FILE}) - -SET(EXECUTABLE_NAME simpleMPI) - -################################################################ -## PACKAGES ### -################################################################ -INCLUDE(${SOURCE_ROOT}/basics/utilities/CMakePackage.txt) -INCLUDE(${SOURCE_ROOT}/basics/memory/CMakePackage.txt) -INCLUDE(${SOURCE_ROOT}/basics/parallel/CMakePackage.txt) - -################################################################# -### OWN DEFINES ### -################################################################# -SET(ALL_SOURCES ${ALL_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ) - -SOURCE_GROUP(main FILES ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ) - -ADD_CXX_FLAGS("/wd4996") #deprecated strcpy... - -################################################################# -### MPI ### -################################################################# -SET_MPI_STUFF(CAB_MACHINE) -SET(EXECUTABLE_NAME ${EXECUTABLE_NAME}_mpi) - -################################################################# -### EXCECUTABLE ### -################################################################# -ADD_EXECUTABLE(${EXECUTABLE_NAME} ${ALL_SOURCES} ) - -################################################################# -### ADDITIONAL LINK LIBRARIES ### -################################################################# -IF(ADDITIONAL_LINK_LIBRARIES) - TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} ${ADDITIONAL_LINK_LIBRARIES}) -ENDIF(ADDITIONAL_LINK_LIBRARIES) - -################################################################# -### ADDITIONAL LINK PROPERTIES ### -################################################################# -IF(ADDITIONAL_LINK_PROPS) - SET_TARGET_PROPERTIES(${EXECUTABLE_NAME} PROPERTIES LINK_FLAGS ${ADDITIONAL_LINK_PROPS}) -ENDIF(ADDITIONAL_LINK_PROPS) -IF(ADDITIONAL_LINK_PROPS_DEBUG) - SET_TARGET_PROPERTIES(${EXECUTABLE_NAME} PROPERTIES LINK_FLAGS_DEBUG ${ADDITIONAL_LINK_PROPS_DEBUG}) -ENDIF(ADDITIONAL_LINK_PROPS_DEBUG) -IF(ADDITIONAL_LINK_PROPS_RELEASE) - SET_TARGET_PROPERTIES(${EXECUTABLE_NAME} PROPERTIES LINK_FLAGS_RELEASE ${ADDITIONAL_LINK_PROPS_RELEASE}) -ENDIF(ADDITIONAL_LINK_PROPS_RELEASE) - - - diff --git a/src/basics/basics/parallel/examples/simpleMPI/functions.h b/src/basics/basics/parallel/examples/simpleMPI/functions.h deleted file mode 100644 index 38005eca5..000000000 --- a/src/basics/basics/parallel/examples/simpleMPI/functions.h +++ /dev/null @@ -1,193 +0,0 @@ -#include <iostream> -#include <stdlib.h> -#include <stdio.h> -#include <string> -#include <fstream> - -#include <basics/utilities/UbTuple.h> - -#include <basics/utilities/UbException.h> -#include <basics/utilities/UbSystem.h> -#include <basics/utilities/UbFileOutputASCII.h> -#include <basics/utilities/UbTiming.h> - -#include <basics/memory/MbSmartPtr.h> - -#include <basics/container/CbVector.h> -#include <basics/container/CbVectorPool.h> - -using std::cout; -using std::cerr; -using std::endl; -using std::vector; - -typedef long double value_type; -typedef MbSmartPtr<CbVector< value_type > > CbVectorPtr; -typedef MbSmartPtr<vector< value_type > > StlVectorPtr; - -/*==========================================================*/ -template<typename T> -inline void setValues(vector<T>& stlvec, CbVector<T>& cbvec, CbVector<T>& cbpoolvec) -{ - if(stlvec.size() != cbvec.size() || stlvec.size() != cbpoolvec.size() ) - { - cerr<<"sizes:"<<endl; - cerr<<"stlvec... = "<<(int)stlvec.size()<<endl; - cerr<<"cbvec.... = "<<(int)cbvec.size()<<endl; - cerr<<"cbpoolvec = "<<(int)cbpoolvec.size()<<endl; - throw UB_THROW( UbException("setValues - sizeCheck failed") ); - } - static value_type stlVal = 1; - static value_type cbVal = 1; - static value_type cbPoolVal = 1; - - for(size_t i=0; i<cbvec.size(); i++) stlvec[i] = stlVal ++; - for(size_t i=0; i<cbvec.size(); i++) cbvec[i] = cbVal ++; - for(size_t i=0; i<cbvec.size(); i++) cbpoolvec[i] = cbPoolVal++; -} -/*==========================================================*/ -template<typename T> -inline void setValues(vector< StlVectorPtr >& stlvecs, vector< CbVectorPtr >& cbvecs, vector< CbVectorPtr >& cbpoolvecs) -{ - if(stlvecs.size() != cbvecs.size() || stlvecs.size() != cbpoolvecs.size() ) - { - cerr<<"sizes:"<<endl; - cerr<<"stlvec... = "<<(int)stlvecs.size()<<endl; - cerr<<"cbvec.... = "<<(int)cbvecs.size()<<endl; - cerr<<"cbpoolvec = "<<(int)cbpoolvecs.size()<<endl; - UB_THROW( UbException("setValues glob - sizeCheck failed") ); - } - - for(size_t i=0; i<cbvecs.size(); i++) - setValues(*stlvecs[i],*cbvecs[i],*cbpoolvecs[i]); -} -/*==========================================================*/ -template<typename T> -inline void resize(vector<T>& stlvec, CbVector<T>& cbvec, CbVector<T>& cbpoolvec, std::size_t size, const T& val) -{ - stlvec.resize(size,val); - cbvec.resize(size,val); - cbpoolvec.resize(size,val); -} -/*==========================================================*/ -template<typename T> -inline void resize(vector< StlVectorPtr >& stlvecs, vector< CbVectorPtr >& cbvecs, vector< CbVectorPtr >& cbpoolvecs, std::size_t size, const value_type& val, bool timed=false) -{ - if(stlvecs.size() != cbvecs.size() || stlvecs.size() != cbpoolvecs.size() ) - { - cerr<<"sizes:"<<endl; - cerr<<"stlvec... = "<<(int)stlvecs.size()<<endl; - cerr<<"cbvec.... = "<<(int)cbvecs.size()<<endl; - cerr<<"cbpoolvec = "<<(int)cbpoolvecs.size()<<endl; - UB_THROW( UbException("resize glob - sizeCheck failed") ); - } - - if(timed) - { - UbTimer timer; - timer.start(); for(size_t i=0; i<cbvecs.size(); i++) stlvecs[i]->resize(size,val); if(timed) cout<<"stl-resize in "<<timer.stop()<<"s"<<endl; - timer.start(); for(size_t i=0; i<cbvecs.size(); i++) cbvecs[i]->resize(size,val); if(timed) cout<<"cbStd-resize in "<<timer.stop()<<"s"<<endl; - timer.start(); for(size_t i=0; i<cbvecs.size(); i++) cbpoolvecs[i]->resize(size,val); if(timed) cout<<"cbPool-resize in "<<timer.stop()<<"s"<<endl; - } - else - { - for(size_t i=0; i<cbvecs.size(); i++) - resize(*stlvecs[i],*cbvecs[i],*cbpoolvecs[i],size,val); - } -} -/*==========================================================*/ -template<typename T> -inline void createVecs(size_t number, int size,vector< StlVectorPtr >& stlvecs, vector< CbVectorPtr >& cbvecs, vector< CbVectorPtr >& cbpoolvecs, CbVectorPool<value_type>*& pool, bool timed=false) -{ - UbTimer timer; - timer.start(); for(size_t i=0; i<number; i++) stlvecs.push_back(StlVectorPtr(new vector<value_type>(size))); if(timed) cout<<"stl-createVecs in "<<timer.stop()<<"s"<<endl; - timer.start(); for(size_t i=0; i<number; i++) cbvecs.push_back(CbVectorPtr(new CbVector<value_type>(size))); if(timed) cout<<"cbStd-createVecs in "<<timer.stop()<<"s"<<endl; - timer.start(); for(size_t i=0; i<number; i++) cbpoolvecs.push_back(CbVectorPtr(new CbVector<value_type>(size,new CbVectorAllocatorPool<value_type>(pool)))); if(timed) cout<<"cbPool-createVecs in "<<timer.stop()<<"s"<<endl; - - for(size_t i=0; i<cbvecs.size(); i++) setValues(*stlvecs.back(),*cbvecs.back(),*cbpoolvecs.back()); -} -/*==========================================================*/ -template<typename T> -inline void createVecs(size_t number, size_t size, const value_type& val,vector< StlVectorPtr >& stlvecs, vector< CbVectorPtr >& cbvecs, vector< CbVectorPtr >& cbpoolvecs, CbVectorPool<value_type>*& pool, bool timed=false) -{ - UbTimer timer; - timer.start(); for(size_t i=0; i<number; i++) stlvecs.push_back(StlVectorPtr(new vector<value_type>(size,val))); if(timed) cout<<"stl-createVecs in "<<timer.stop()<<"s"<<endl; - timer.start(); for(size_t i=0; i<number; i++) cbvecs.push_back(CbVectorPtr(new CbVector<value_type>(size,new CbVectorAllocatorStd<value_type>(),val))); if(timed) cout<<"cbStd-createVecs in "<<timer.stop()<<"s"<<endl; - timer.start(); for(size_t i=0; i<number; i++) cbpoolvecs.push_back(CbVectorPtr(new CbVector<value_type>(size,new CbVectorAllocatorPool<value_type>(pool),val))); if(timed) cout<<"cbPool-createVecs in "<<timer.stop()<<"s"<<endl; -} -/*==========================================================*/ -template<typename T> -inline void equalCheck(vector<T>& stlvec, CbVector<T>& cbvec, CbVector<T>& cbpoolvec) -{ - if(stlvec.size() != cbvec.size() || stlvec.size() != cbpoolvec.size() ) - { - cerr<<"sizes:"<<endl; - cerr<<"stlvec... = "<<(int)stlvec.size()<<endl; - cerr<<"cbvec.... = "<<(int)cbvec.size()<<endl; - cerr<<"cbpoolvec = "<<(int)cbpoolvec.size()<<endl; - throw UB_THROW( UbException("equalCheck - sizeCheck failed") ); - } - - bool check=true; - for(size_t i=0; i<cbvec.size(); i++) - if(stlvec[i] != cbvec[i] || stlvec[i] != cbpoolvec[i] ) - check=false; - - if(!check) - { - cerr<<"\nstl - "; for(size_t i=0; i<cbvec.size(); i++) cout<<stlvec[i]<<" "; cout<<endl; - cerr<< "cbv - "; for(size_t i=0; i<cbvec.size(); i++) cout<<cbvec[i]<<" "; cout<<endl; - cerr<< "cbp - "; for(size_t i=0; i<cbvec.size(); i++) cout<<cbpoolvec[i]<<" "; cout<<endl; - throw UB_THROW( UbException("equalCheck - equalCheck failed") ); - } -} -/*==========================================================*/ -template<typename T> -void equalCheck(vector< StlVectorPtr >& stlvecs, vector< CbVectorPtr >& cbvecs, vector< CbVectorPtr >& cbpoolvecs) -{ - if(stlvecs.size() != cbvecs.size() || stlvecs.size() != cbpoolvecs.size() ) - { - cerr<<"sizes:"<<endl; - cerr<<"stlvec... = "<<(int)stlvecs.size()<<endl; - cerr<<"cbvec.... = "<<(int)cbvecs.size()<<endl; - cerr<<"cbpoolvec = "<<(int)cbpoolvecs.size()<<endl; - UB_THROW( UbException("equalCheck - sizeCheck failed") ); - } - - for(size_t i=0; i<cbvecs.size(); i++) - { - //cout<<"equalCheck i="<<i<<"/"<<cbvecs.size()-1; - equalCheck(*stlvecs[i],*cbvecs[i],*cbpoolvecs[i]); - //cout<<" passed"<<endl; - } -} -/*==========================================================*/ -template<typename T> -void accessCheck(int times,vector< StlVectorPtr >& stlvecs, vector< CbVectorPtr >& cbvecs, vector< CbVectorPtr >& cbpoolvecs) -{ - UbTimer timer; - timer.start(); - for(size_t i=0; i<stlvecs.size(); i++) - { - vector<value_type>& vec = *stlvecs[i]; - for(int m=0; m<times; m++) - for(vector<value_type>::size_type k=0; k<vec.size(); k++) vec[k] = k; - } - cout<<"stl-accessCheck in "<<timer.stop()<<"s"<<endl; - timer.start(); - for(size_t i=0; i<cbvecs.size(); i++) - { - CbVector<value_type>& vec = *cbvecs[i]; - for(int m=0; m<times; m++) - for(vector<value_type>::size_type k=0; k<vec.size(); k++) vec[k] = k; - } - cout<<"cbStd-accessCheck in "<<timer.stop()<<"s"<<endl; - timer.start(); - for(size_t i=0; i<cbpoolvecs.size(); i++) - { - CbVector<value_type>& vec = *cbpoolvecs[i]; - for(int m=0; m<times; m++) - for(vector<value_type>::size_type k=0; k<vec.size(); k++) vec[k] = k; - } - cout<<"cbPool-accessCheck in "<<timer.stop()<<"s"<<endl; -} diff --git a/src/basics/basics/parallel/examples/simpleMPI/main.cpp b/src/basics/basics/parallel/examples/simpleMPI/main.cpp deleted file mode 100644 index 18c2769e0..000000000 --- a/src/basics/basics/parallel/examples/simpleMPI/main.cpp +++ /dev/null @@ -1,101 +0,0 @@ -#include <iostream> -#include <vector> -#include <algorithm> -#include <mpi.h> - -#include <basics/utilities/UbSystem.h> -#include <basics/utilities/UbException.h> -#include <basics/utilities/UbLogger.h> - -using namespace std; - -int randomNumber () { return (rand()%100); } - -struct RankSetter{ - RankSetter(int rank) : rank(rank) {} - - int operator()() - { - return rank; - } - - int rank; -} /*rankSetter*/; - - -////////////////////////////////////////////////////////////////////////// -int main(int argc, char** argv) -{ - MPI::Init(argc, argv); - MPI::COMM_WORLD.Set_errhandler(MPI::ERRORS_THROW_EXCEPTIONS); - - try - { - MPI::Intracomm comm = MPI::COMM_WORLD; - - int rank = comm.Get_rank(); - - vector<int> sendData(1000,0); - generate(sendData.begin(), sendData.end(), RankSetter(rank+1) ); - - vector<int> recvData(1000,0); - - if(rank==0) - { - UBLOG(logINFO,"rank="<<rank<<" - recv request"); - MPI::Request request = comm.Irecv(&recvData[0], (int)recvData.size(), MPI::INT, 1, 100); - UBLOG(logINFO,"rank="<<rank<<" - sendData"); - comm.Ssend(&sendData[0],(int)sendData.size(), MPI::INT, 1, 100); - sendData.back() = 999; - - UBLOG(logINFO,"rank="<<rank<<" - Wait"); - request.Wait(); - UBLOG(logINFO,"rank="<<rank<<" - all data received, last = "<<recvData.back()); - } - else if(rank == 1) - { - UbSystem::sleepS(5); - UBLOG(logINFO,"rank="<<rank<<" - recv request"); - MPI::Request request = comm.Irecv(&recvData[0],(int)recvData.size(), MPI::INT, 0, 100); - - request.Wait(); - UBLOG(logINFO,"rank="<<rank<<" - all data received, last = "<<recvData.back()); - - UbSystem::sleepS(5); - UBLOG(logINFO,"rank="<<rank<<" - sendData"); - comm.Ssend(&sendData[0],(int)sendData.size(), MPI::INT, 0, 100); - sendData.back() = 999; - UBLOG(logINFO,"rank="<<rank<<" - data sent"); - } - else - { - throw UB_THROW( UbException(UB_EXARGS,"only two ranks allwoed") ); - } - - UBLOG(logINFO,"rank="<<rank<<" barrier start"); - MPI::COMM_WORLD.Barrier(); - UBLOG(logINFO,"rank="<<rank<<" barrier done "); - - } - catch(const std::exception& e) - { - UBLOG2( logERROR,std::cerr, "caught exception:" ); - UBLOG2( logERROR,std::cerr, "type: " << typeid(e).name() ); - UBLOG2ML(logERROR,std::cerr, "what: " << e.what() ); - } - catch(MPI::Exception e) - { - UBLOG2ML(logERROR,std::cerr, "caught exception:" << e.Get_error_string()); - - MPI::COMM_WORLD.Abort(99); - } - catch(...) - { - UBLOG2(logERROR,std::cerr,"Verdammte Scheisse - mal wieder Mist gebaut!"); - } - - MPI::Finalize(); - - return 0; -} - diff --git a/src/basics/basics/relation/RbAggregation.h b/src/basics/basics/relation/RbAggregation.h deleted file mode 100644 index c86c07fdd..000000000 --- a/src/basics/basics/relation/RbAggregation.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef RBAGGREGATION_H -#define RBAGGREGATION_H - -#include <sstream> -#include <iostream> -#include <map> - -using namespace std; - -template <class T1, class T2> -class RbAggregation -{ -private: - string name; - std::multimap<T1,T2> obj1Map; - std::multimap<T2,T1> obj2Map; - -public: - RbAggregation(string name) - { - this->name = name; - } - /*=========================================================================*/ - void insertPair(T1& to1, T2& to2) - { - obj1Map.insert(pair<T1,T2>(to1,to2)); - obj2Map.insert(pair<T2,T1>(to2,to1)); - } - /*=========================================================================*/ - int countObj2forObj1(T1& to1) - { - return((int)obj1Map.count(to1)); - } - - /*=========================================================================*/ - int countObj1forObj2(T2& to2) - { - return((int)obj2Map.count(to2)); - } - /*=========================================================================*/ - vector<T2> getObj2vectorForObj1(T1& to1) - { - vector<T2> obj2vector; - unsigned number = (unsigned)obj1Map.count(to1); - typedef std::multimap<T1, T2>::iterator obj1MapIterator = obj1Map.find(to1); - for(unsigned u =0; u<number; u++) - { - obj2vector.push_back(obj1MapIterator->second); - obj1MapIterator++; - } - return obj2vector; - } - ///*=========================================================================*/ - vector<T1> getObj1vectorForObj2(T2& to2) - { - vector<T1> obj1vector; - unsigned number = (unsigned)obj2Map.count(to2); - typedef std::multimap<T2, T1>::iterator obj2MapIterator = obj2Map.find(to2); - for(unsigned u =0; u<number; u++) - { - obj1vector.push_back(obj2MapIterator->second); - obj2MapIterator++; - } - return obj1vector; - } -}; -/*=========================================================================*/ -#endif - - diff --git a/src/basics/basics/utilities/UbAutoRun.hpp b/src/basics/basics/utilities/UbAutoRun.hpp deleted file mode 100644 index 50fcf37b6..000000000 --- a/src/basics/basics/utilities/UbAutoRun.hpp +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef UB_AUTORUN_HPP -#define UB_AUTORUN_HPP - -#define UB_AUTO_RUN(func) UB_AUTO_RUN_(func, __LINE__) -#define UB_AUTO_RUN_(func, nID) UB_AUTO_RUN__(func, nID) -#define UB_AUTO_RUN__(func, nID) UB_AUTO_RUN___(func, nID) -#define UB_AUTO_RUN___(func, ID) \ - namespace { \ - struct UbAutoRun##ID { \ - UbAutoRun##ID() { \ - func; \ - } \ - } UbAutoRunInst##ID; \ - } - - // More concise to implement UB_AUTO_RUN using the following, but BCB emits an ICE on it. - //static bool UB_AutoRun##ID = ( func , false); - - -#define UB_AUTO_RUN_1(func) UB_AUTO_RUN_NAMED(func, 1) -#define UB_AUTO_RUN_2(func) UB_AUTO_RUN_NAMED(func, 2) -#define UB_AUTO_RUN_3(func) UB_AUTO_RUN_NAMED(func, 3) -#define UB_AUTO_RUN_4(func) UB_AUTO_RUN_NAMED(func, 4) -#define UB_AUTO_RUN_5(func) UB_AUTO_RUN_NAMED(func, 5) - -#define UB_AUTO_RUN_NAMED(func, name) UB_AUTO_RUN_NAMED_(func, name, __LINE__) -#define UB_AUTO_RUN_NAMED_(func, name, nID) UB_AUTO_RUN_NAMED__(func, name, nID) -#define UB_AUTO_RUN_NAMED__(func, name, nID) UB_AUTO_RUN___(func, _##name##_##nID) - -#define UB_AUTO_RUN_ONCE(func) UB_AUTO_RUN_ONCE_(func, __LINE__) -#define UB_AUTO_RUN_ONCE_(func, nID) UB_AUTO_RUN_ONCE__(func, nID) -#define UB_AUTO_RUN_ONCE__(func, nID) UB_AUTO_RUN_ONCE___(func, nID) -#define UB_AUTO_RUN_ONCE___(func, ID) \ - struct UbAutoRunOnce##ID { \ - UbAutoRunOnce##ID() { \ - if (!init()) { \ - init() = true; \ - func; \ - } \ - } \ - static bool &init() { \ - static bool bInit = false; \ - return bInit; \ - } \ - }; \ - static UbAutoRunOnce##ID AutoRunOnceInst##ID; - -#define UB_AUTO_RUN_ONCE_1(func) UB_AUTO_RUN_ONCE_NAMED(func, 1) -#define UB_AUTO_RUN_ONCE_2(func) UB_AUTO_RUN_ONCE_NAMED(func, 2) -#define UB_AUTO_RUN_ONCE_3(func) UB_AUTO_RUN_ONCE_NAMED(func, 3) -#define UB_AUTO_RUN_ONCE_4(func) UB_AUTO_RUN_ONCE_NAMED(func, 4) -#define UB_AUTO_RUN_ONCE_5(func) UB_AUTO_RUN_ONCE_NAMED(func, 5) - -#define UB_AUTO_RUN_ONCE_NAMED(func, name) UB_AUTO_RUN_ONCE_NAMED_(func, name, __LINE__) -#define UB_AUTO_RUN_ONCE_NAMED_(func, name, nID) UB_AUTO_RUN_ONCE_NAMED__(func, name, nID) -#define UB_AUTO_RUN_ONCE_NAMED__(func, name, nID) UB_AUTO_RUN_ONCE___(func, _##name##_##nID) - -#endif // ! UB_AUTORUN_HPP diff --git a/src/basics/basics/utilities/UbConverter.cpp b/src/basics/basics/utilities/UbConverter.cpp deleted file mode 100644 index dcdf17f5d..000000000 --- a/src/basics/basics/utilities/UbConverter.cpp +++ /dev/null @@ -1,96 +0,0 @@ -#include <basics/utilities/UbConverter.h> - -const std::string UbConverter::base64_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789+/"; - - -std::string UbConverter::base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len) -{ - std::string ret; - int i = 0; - int j = 0; - unsigned char char_array_3[3]; - unsigned char char_array_4[4]; - - while (in_len--) - { - char_array_3[i++] = *(bytes_to_encode++); - if( i==3) - { - char_array_4[0] = ( char_array_3[0] & 0xfc) >> 2; - char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4); - char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6); - char_array_4[3] = char_array_3[2] & 0x3f; - - for( i=0; i<4 ; i++) - ret += base64_chars[char_array_4[i]]; - i=0; - } - } - - if( i ) - { - for( j=i; j<3; j++) - char_array_3[j] = '\0'; - - char_array_4[0] = ( char_array_3[0] & 0xfc) >> 2; - char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4); - char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6); - char_array_4[3] = char_array_3[2] & 0x3f; - - for ( j=0; j<i+1; j++) - ret += base64_chars[char_array_4[j]]; - - while( i++<3 ) - ret += '='; - } - - return ret; -} -/*=======================================================*/ -std::string UbConverter::base64_decode(std::string const& encoded_string) -{ - int in_len = (int)encoded_string.size(); - int i = 0; - int j = 0; - int in_ = 0; - unsigned char char_array_4[4], char_array_3[3]; - std::string ret; - - while (in_len-- && ( encoded_string[in_] != '=') && is_base64(encoded_string[in_])) - { - char_array_4[i++] = encoded_string[in_]; in_++; - if(i ==4) - { - for (i = 0; i <4; i++) - char_array_4[i] = (unsigned char)base64_chars.find(char_array_4[i]); - - char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); - char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); - char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; - - for (i = 0; (i < 3); i++) - ret += char_array_3[i]; - i = 0; - } - } - - if( i ) - { - for(j = i; j <4; j++) - char_array_4[j] = 0; - - for(j = 0; j <4; j++) - char_array_4[j] = (unsigned char)base64_chars.find(char_array_4[j]); - - char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); - char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); - char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; - - for(j = 0; (j < i - 1); j++) - ret += char_array_3[j]; - } - - return ret; -} diff --git a/src/basics/basics/utilities/UbConverter.h b/src/basics/basics/utilities/UbConverter.h deleted file mode 100644 index 7fd99c689..000000000 --- a/src/basics/basics/utilities/UbConverter.h +++ /dev/null @@ -1,49 +0,0 @@ -// _ ___ __ __________ _ __ -// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ -// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) -// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ -// -#ifndef UBCONVERTER_H -#define UBCONVERTER_H - -#include <cstdlib> -#include <ctime> -#include <cassert> -#include <string> - -/*=========================================================================*/ -/* UBConverter */ -/* */ -// -// encodes vals to e.g. base64 -// dencodes vals from e.g. base64 -// author <A HREF="mailto:muffmolch@gmx.de">S. Freudiger</A> -// version 1.0 - 22.10.2007 - - -class UbConverter -{ -public: - static std::string base64_encode(unsigned char const* , unsigned int len); - static std::string base64_decode(std::string const& s); - - static inline bool is_base64(const unsigned char& c) - { - return (isalnum(c) || (c == '+') || (c == '/')); - } - -protected: - UbConverter() {} - ~UbConverter() {} - -private: - UbConverter(const UbConverter&); // not implemented. - void operator=(const UbConverter&); //not implemented. - - static const std::string base64_chars; -}; - - - -#endif //UBCONVERTER_H diff --git a/src/basics/basics/utilities/UbPointerWrapper.h b/src/basics/basics/utilities/UbPointerWrapper.h deleted file mode 100644 index dbb65d39f..000000000 --- a/src/basics/basics/utilities/UbPointerWrapper.h +++ /dev/null @@ -1,36 +0,0 @@ -// _ ___ __ __________ _ __ -// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ -// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) -// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ -// -#ifndef UBPOINTERWRAPPER_H -#define UBPOINTERWRAPPER_H - -//kappselt dynamische Objekte zur remote uebetragung -//bei RCF werden z.B. aufgrund GC alle lokalen Objekte und -//"nackte" Pointer die automatisch als shared_ptr initialisert -//werde nach Methoden-Aufruf zerstoert -//hierfuer kann man dann den UbPointerWrapper verwenden - -template<typename T> -class UbPointerWrapper -{ -public: - UbPointerWrapper() : pointer(NULL) {} - - UbPointerWrapper(T* pointer) : pointer(pointer) {} - - T* get() { return pointer; } - - template<class Archive> - void serialize(Archive& ar, const unsigned int version) - { - ar & pointer; - } - -private: - T* pointer; -}; - -#endif //UBPOINTERWRAPPER_H diff --git a/src/basics/basics/utilities/UbStaticPathMap.cpp b/src/basics/basics/utilities/UbStaticPathMap.cpp deleted file mode 100644 index b68cc5ba1..000000000 --- a/src/basics/basics/utilities/UbStaticPathMap.cpp +++ /dev/null @@ -1,4 +0,0 @@ -#include <basics/utilities/UbStaticPathMap.h> - -UbStaticPathMap::PathMap UbStaticPathMap::pathMap; -const std::string UbStaticPathMap::GLOBAL = "UbStaticPathMap::GLOBAL"; diff --git a/src/basics/basics/utilities/UbStaticPathMap.h b/src/basics/basics/utilities/UbStaticPathMap.h deleted file mode 100644 index a188843c3..000000000 --- a/src/basics/basics/utilities/UbStaticPathMap.h +++ /dev/null @@ -1,71 +0,0 @@ -// _ ___ __ __________ _ __ -// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ -// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) -// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ -// -#ifndef UBSTATICPATHMAP_H -#define UBSTATICPATHMAP_H - -#include <iostream> -#include <string> -#include <map> - -#include <basics/utilities/UbSystem.h> - -/*=========================================================================*/ -/* UbStaticPathMap */ -/* */ -/** -... -<BR><BR> -@author <A HREF="mailto:muffmolch@gmx.de">S. Freudiger</A> -@version 1.0 - 12.10.2007 -*/ - -/* -stores pathnames for pathIDs (e.g. on different processes different paths with same pathID) -adding an path autom. changes "\" to "/" and removed last "/" if exists - -*/ - -class UbStaticPathMap -{ - typedef std::map< std::string, std::string > PathMap; -public: - static const std::string GLOBAL; -public: - - static std::string addAndMakePath(const std::string& id, const std::string& path) - { - std::string tmpPath = UbStaticPathMap::addPath(id,path); - if( !tmpPath.empty() ) UbSystem::makeDirectory(tmpPath,20); - return tmpPath; - } - static std::string addPath(const std::string& id, const std::string& path) - { - std::string tmpPath = UbSystem::replaceInString(path,"\\","/"); - if(tmpPath.rfind("/") == tmpPath.size()-1) tmpPath.resize(tmpPath.size()-1); - pathMap[id] = tmpPath; - return tmpPath; - } - static std::string getPath(const std::string& id) - { - PathMap::iterator it = pathMap.find(id); - if(it == pathMap.end()) return ""; - return it->second; - } - static void removePath(const std::string& id) - { - pathMap.erase(id); - } - -protected: - static PathMap pathMap; - -private: - UbStaticPathMap() {} - UbStaticPathMap(const UbStaticPathMap&) {} -}; - -#endif //UBSTATICPATHMAP_H diff --git a/src/basics/basics/utilities/UbString.h b/src/basics/basics/utilities/UbString.h deleted file mode 100644 index f93fe7ae6..000000000 --- a/src/basics/basics/utilities/UbString.h +++ /dev/null @@ -1,24 +0,0 @@ -//unnoetig: UbSystem::toString() verwenden,... andere Richtung: stringTo... oder am besten boost::lexical_cast - - -//#ifndef UBSTRING_H -//#define UBSTRING_H -//#include <string> -//#include <sstream> -// -//using namespace std; -// -//class UbString -//{ -//public: -// static void IntToString(int i, string& res) -// { -// ostringstream temp; -// temp << i; -// res = temp.str(); -// } -//protected: -//private: -//}; -// -//#endif //end UBSTRING_H diff --git a/src/basics/basics/utilities/UbTableModel.cpp b/src/basics/basics/utilities/UbTableModel.cpp deleted file mode 100644 index 12e69b068..000000000 --- a/src/basics/basics/utilities/UbTableModel.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include <basics/utilities/UbTableModel.h> - -UbTableModel::UbTableModel() -{ -} - -UbTableModel::~UbTableModel() -{ - //this->notifyObserversObjectWillBeDeleted(); -} - -//void UbTableModel::objectChanged(UbObservable* changedObject) -//{ -// this->notifyObserversObjectChanged(); -//} -// -//void UbTableModel::objectWillBeDeleted(UbObservable* objectForDeletion) -//{ -// objectForDeletion->removeObserver(this); -//} diff --git a/src/basics/basics/utilities/UbTableModel.h b/src/basics/basics/utilities/UbTableModel.h deleted file mode 100644 index 957201a51..000000000 --- a/src/basics/basics/utilities/UbTableModel.h +++ /dev/null @@ -1,37 +0,0 @@ -// _ ___ __ __________ _ __ -// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ -// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) -// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ -// -#ifndef UBTABLEMODEL_H -#define UBTABLEMODEL_H - -#include <iostream> - -class UbTableModel -{ -public: - const static int COL_TYPE_STRING = 1; - const static int COL_TYPE_BOOL = 2; - const static int COL_TYPE_INTEGER = 3; - const static int COL_TYPE_DOUBLE = 4; - - UbTableModel(); - virtual ~UbTableModel(); - - ////////////////////////////////////////////////////////////////////////// - //void objectChanged(UbObservable*); - //void objectWillBeDeleted(UbObservable*); - - virtual int getColumnNumber() = 0; - virtual int getRowNumber() = 0; - virtual std::string getColumnLabel(int column) = 0; - virtual int getColumnType(int column) = 0; - virtual std::string getStringValue(int row, int col) = 0; - virtual void setStringValue(int row, int col, std::string str) = 0; - virtual int getSelectedRowIndex() = 0; - //virtual bool GetBoolValue(int row, int col) = 0; -}; - -#endif //UBTABLEMODEL_H diff --git a/src/basics/basics/utilities/UbTuple.cpp b/src/basics/basics/utilities/UbTuple.cpp deleted file mode 100644 index f778fc71a..000000000 --- a/src/basics/basics/utilities/UbTuple.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "UbTuple.h" - diff --git a/src/basics/geometry3d/GbTriFaceMesh3D.h b/src/basics/geometry3d/GbTriFaceMesh3D.h index 61eac36e1..146c8c220 100644 --- a/src/basics/geometry3d/GbTriFaceMesh3D.h +++ b/src/basics/geometry3d/GbTriFaceMesh3D.h @@ -10,14 +10,12 @@ #include <sstream> #include <iostream> #include <vector> - +#include <map> #include <basics/utilities/UbException.h> #include <basics/utilities/UbMath.h> #include <basics/utilities/Vector3D.h> -#include <basics/memory/MbSmartPtr.h> - #include <geometry3d/GbPoint3D.h> #include <PointerDefinitions.h> diff --git a/src/basics/geometry3d/KdTree/KdTree.h b/src/basics/geometry3d/KdTree/KdTree.h index cbdfa88a4..03e461216 100644 --- a/src/basics/geometry3d/KdTree/KdTree.h +++ b/src/basics/geometry3d/KdTree/KdTree.h @@ -1,7 +1,6 @@ #ifndef KDTREE_H #define KDTREE_H -#include <basics/memory/MbSmartPtr.h> #include <basics/writer/WbWriterVtkXmlBinary.h> #include <geometry3d/GbTriFaceMesh3D.h> #include <basics/utilities/UbKeys.h> diff --git a/src/basics/geometry3d/KdTree/examples/AdvancedPIOTests/CMakeLists.txt b/src/basics/geometry3d/KdTree/examples/AdvancedPIOTests/CMakeLists.txt deleted file mode 100644 index 97745da33..000000000 --- a/src/basics/geometry3d/KdTree/examples/AdvancedPIOTests/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -cmake_minimum_required(VERSION 2.6) - -PROJECT(kdtree_pioTest) - -################################################################# -# MACHINE_SPECIFIC CMAKE_CONFIG_FILE -################################################################# -INCLUDE("../../../../../CMake/CMakeCABMacros.txt") - -################################################################# -### PACKAGES ### -################################################################# -INCLUDE(${SOURCE_ROOT}/basics/utilities/CMakePackage.txt) -INCLUDE(${SOURCE_ROOT}/3rdParty/dirstream/CMakePackage.txt) - -INCLUDE(${SOURCE_ROOT}/basics/utilities/CMakePackage.txt) -INCLUDE(${SOURCE_ROOT}/basics/container/CMakePackage.txt) -INCLUDE(${SOURCE_ROOT}/basics/memory/CMakePackage.txt) -INCLUDE(${SOURCE_ROOT}/basics/objects/CMakePackage.txt) -INCLUDE(${SOURCE_ROOT}/basics/writer/CMakePackage.txt) - -INCLUDE(${SOURCE_ROOT}/geometry3d/CMakePackage.txt) -INCLUDE(${SOURCE_ROOT}/geometry3d/KdTree/CMakePackage.txt) -INCLUDE(${SOURCE_ROOT}/geometry3d/fem/CMakePackage.txt) -INCLUDE(${SOURCE_ROOT}/geometry3d/creator/CMakePackage.txt) - -################################################################# -### OWN DEFINES ### -################################################################# -FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h - ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp ) - -SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES}) -SOURCE_GROUP(z_main FILES ${SPECIFIC_FILES}) - -################################################################# -### PROJECT ERSTELLEN ### -################################################################# -CREATE_CAB_PROJECT(${PROJECT_NAME} BINARY) diff --git a/src/basics/geometry3d/KdTree/examples/AdvancedPIOTests/main.cpp b/src/basics/geometry3d/KdTree/examples/AdvancedPIOTests/main.cpp deleted file mode 100644 index 25a443cf1..000000000 --- a/src/basics/geometry3d/KdTree/examples/AdvancedPIOTests/main.cpp +++ /dev/null @@ -1,542 +0,0 @@ -#include <basics/utilities/UbTiming.h> -#include <basics/utilities/UbRandom.h> -#include <basics/utilities/UbTuple.h> - -#include <basics/writer/WbWriterAvsASCII.h> -#include <basics/writer/WbWriterAvsBinary.h> -#include <basics/writer/WbWriterVtkXmlBinary.h> -#include <basics/writer/WbWriterVtkXmlASCII.h> - -#include <basics/container/CbUniformMatrix3D.h> - -#include <geometry3d/GbTriFaceMesh3D.h> -#include <geometry3d/creator/GbTriFaceMesh3DCreator.h> -#include <geometry3d/GbHalfSpace3D.h> - -#include <geometry3d/KdTree/KdTree.h> -#include <geometry3d/KdTree/splitalgorithms/KdSpatiallMedianSplit.h> -#include <geometry3d/KdTree/splitalgorithms/KdSAHSplit.h> -#include <geometry3d/KdTree/intersectionhandler/KdCountLineIntersectionHandler.h> -#include <geometry3d/KdTree/intersectionhandler/KdCountRayIntersectionHandler.h> - -#include <stack> -#include <list> - -using namespace std; - -void createGrid(std::string meshfile, int maxNofPointsPerDir, Kd::SplitAlgorithm<float>& splitAlg, bool writeFiles = true, std::string outpath = "g:/temp"); -void recursiveGridFill(CbUniformMatrix3D<short>& grid, const short& xs, const short& ys, const short& zs, const short& type); -void iterativeGridFill(CbUniformMatrix3D<short>& grid, const short& xs, const short& ys, const short& zs, const short& type); - -#include <3rdParty/dirstream/dirstream.h> -#include <3rdParty/dirstream/filter_utils.h> // enth�lt die Definiton der bool'schen Ops f�r Filter - - -using namespace std; - -int main() -{ - try - { -// ////////////////////////////////////////////////////////////////////////// -// //STL File auswaehlen -// ////////////////////////////////////////////////////////////////////////// -// string pathname = "c:/temp"; -// string stlPath = "c:/temp"; -// dirstr::dirstream str(stlPath.c_str(), dirstr::op(dirstr::pattern_f("*.stl")) -// || dirstr::op(dirstr::pattern_f("*.ply")) || dirstr::op(dirstr::pattern_f("*.inp")) -// || dirstr::op(dirstr::pattern_f("*.mesh"))); -// -// // UbLog::setReportingLevel(logDEBUG5); -// UbLog::setReportingLevel(logINFO); -// -// vector<string> filenames; -// for(string entry; str >> entry;) -// { -// GbTriFaceMesh3D* mesh = GbTriFaceMesh3DCreator::getInstance()->readMeshFromFile(entry,"mesh"); -// -// string fn = UbSystem::getFilenameFromString(entry); -// mesh->writeMeshPly(pathname+"/"+fn+".ply"); -// -// delete mesh; -// } -// -// exit(0); - - //createGrid("c:/temp/clumps.stl", 200, Kd::SAHSplit<float>() , true, "g:/temp"); - //createGrid("c:/temp/50spheres.inp", 200, Kd::SAHSplit<float>() , true, "g:/temp"); - //createGrid("c:/temp/Sphere5040.inp", 200, Kd::SAHSplit<float>() , true, "g:/temp"); - //createGrid("c:/temp/cooling_2.inp", 400, Kd::SAHSplit<float>() , true, "g:/temp"); - //createGrid("c:/temp/NDR-Konzertsaal.inp", 100, Kd::SAHSplit<float>() , true, "g:/temp"); - - //createGrid("c:/temp/Campus-Details-W3.inp", 200, Kd::SAHSplit<float>() , true, "g:/temp"); - //createGrid("c:/temp/Boein707.mesh", 100, Kd::SAHSplit<float>() , true, "g:/temp"); - - //createGrid("c:/temp/dolphin.mesh", 400, Kd::SAHSplit<float>() , true, "g:/temp"); - //createGrid("c:/temp/box.ply", 10, Kd::SAHSplit<float>() , true, "g:/temp"); - //createGrid("c:/temp/bodyRight.stl", 200, Kd::SAHSplit<float>() , true, "g:/temp"); - //createGrid("c:/temp/flamingo.mesh", 200, Kd::SAHSplit<float>() , true, "g:/temp"); - - //createGrid("c:/temp/torus.inp", 256, Kd::SAHSplit<float>() , true, "g:/temp"); - createGrid("c:/temp/xzx_dragon.stl", 512, Kd::SAHSplit<float>() , true, "g:/temp"); -// createGrid("c:/temp/bunny_ascii.ply", 256, Kd::SAHSplit<float>() , true, "g:/temp"); -// createGrid("c:/temp/dragon_ascii.ply", 256, Kd::SAHSplit<float>() , true, "g:/temp"); -// createGrid("c:/temp/budda_ascii.ply", 256, Kd::SAHSplit<float>() , true, "g:/temp"); - //createGridWithLines("c:/temp/box.ply", 10, Kd::SAHSplit<float>() , true, "g:/temp"); - -// createGrid("c:/temp/beatle.mesh",200, Kd::SAHSplit<float>(), true, "g:/temp"); -// createGrid("c:/temp/atrium-30000tri.inp",200, Kd::SAHSplit<float>(), true, "g:/temp"); -// createGrid("c:/temp/Buero.inp",200, Kd::SAHSplit<float>(), true, "g:/temp"); -// createGrid("c:/temp/office_space.inp",200, Kd::SAHSplit<float>(), true, "g:/temp"); - - //createGrid("d:/meshes/50spheres.inp",200, Kd::SAHSplit<float>(), true, "d:/temp"); - - //createGrid("c:/temp/torus.inp",200, Kd::SAHSplit<float>(), true, "g:/temp"); - //createGrid("c:/temp/bodyRight.stl", 200, Kd::SAHSplit<float>() , true, "g:/temp"); - - //createGrid("c:/temp/jetta.stl", 200, GbTriFaceMesh3D::KDTREE_SPATIALSPLIT , true, "g:/temp"); - //createGrid("c:/temp/jetta.stl", 200, Kd::SAHSplit<float>(), true, "g:/temp"); - //createGrid("c:/temp/VW_body.ply", 200, Kd::SAHSplit<float>() , true, "g:/temp"); - //createGrid("c:/temp/kugel.stl", 50, Kd::SAHSplit<float>() , true, "g:/temp"); - //createGrid("c:/temp/ship-2.mesh", 100, Kd::SAHSplit<float>() , true, "g:/temp/schiff2"); - } - catch(const std::exception& e) - { - UBLOG2( logERROR, std::cerr, "Caught exception:"); - UBLOG2( logERROR, std::cerr, "Type: " << typeid(e).name() ); - UBLOG2ML(logERROR, std::cerr, "What: " << e.what() ); - } - catch(...) - { - UBLOG2(logERROR, std::cerr, "unknown exception occurs in "<< UB_FUNCTION) - } -} - -namespace Flag -{ - const short UNDEF = 2; - const short SOLID = 1; - const short FLUID = 0; -} - -////////////////////////////////////////////////////////////////////// -void createGrid(std::string meshfile, int maxNofPointsPerDir, Kd::SplitAlgorithm<float>& splitAlg, bool writeFiles, std::string outpath) -{ - UbLog::setReportingLevel(logDEBUG5); - std::string filename = UbSystem::getFilenameFromString(meshfile); - - std::list< UbTuple<string, double> > timerVals; - UbTimer timer; - timer.start(); - GbTriFaceMesh3D* mesh = GbTriFaceMesh3DCreator::getInstance()->readMeshFromFile(meshfile,"mesh",GbTriFaceMesh3D::KDTREE_SAHPLIT); - timerVals.push_back( UbTuple<string, double>("mesh", timer.stop() ) ); - UBLOG( logINFO, "read mesh in "<<val<2>(timerVals.back())<<"s" ); - - timer.start(); - Kd::Tree<float> kdTree( *mesh, splitAlg ); - timerVals.push_back( UbTuple<string, double>("kdTree", timer.stop() ) ); - UBLOG( logINFO, "build tree in "<<val<2>(timerVals.back())<<"s" ); - - UBLOG(logINFO, "############################################################"); - UBLOG(logINFO, "nodes of TriFaceMesh....... "<<mesh->getNodes()->size() ); - UBLOG(logINFO, "triFaces of TriFaceMesh.... "<<mesh->getTriangles()->size() ); - UBLOG(logINFO, "triFace copies in KdTree... "<<kdTree.getNumOfTriFaces() ); - UBLOG(logINFO, "nodes of kdNodes of KdTree. "<<kdTree.getNumOfNodes() ); - UBLOG(logINFO, ""); - - ////////////////////////////////////////////////////////////////////////// - // Ausgangs 3-D_Feld erstellen - ////////////////////////////////////////////////////////////////////////// - const float percentOverLap = 0.05f; //=5% - const float maxLength = (1.0f+percentOverLap)*(float)UbMath::max( mesh->getLengthX1(), mesh->getLengthX2(), mesh->getLengthX3() ); - const float dx1 = maxLength/(maxNofPointsPerDir-1); - const float dx2 = dx1; - const float dx3 = dx1; - - const int nx1 = 1 + int( std::ceil(mesh->getLengthX1()*(1.0f+percentOverLap)/dx1)+0.5 ); - const int nx2 = 1 + int( std::ceil(mesh->getLengthX2()*(1.0f+percentOverLap)/dx2)+0.5 ); - const int nx3 = 1 + int( std::ceil(mesh->getLengthX3()*(1.0f+percentOverLap)/dx3)+0.5 ); - - CbUniformMatrix3D<short> solids(nx1,nx2,nx3,Flag::UNDEF); - - ////////////////////////////////////////////////////////////////////////// - // Knoten typisieren - ////////////////////////////////////////////////////////////////////////// - const float orgx1 = (float)( -0.5*percentOverLap*mesh->getLengthX1()+mesh->getX1Minimum() ); - const float orgx2 = (float)( -0.5*percentOverLap*mesh->getLengthX2()+mesh->getX2Minimum() ); - const float orgx3 = (float)( -0.5*percentOverLap*mesh->getLengthX3()+mesh->getX3Minimum() ); - - std::vector<GbTriFaceMesh3D::TriFace>& triFaces = *mesh->getTriangles(); - std::vector<GbTriFaceMesh3D::Vertex>& vertices = *mesh->getNodes(); - - float x1center = float( mesh->getX1Centroid() ); - float x2center = float( mesh->getX2Centroid() ); - float x3center = float( mesh->getX3Centroid() ); - - UBLOG( logINFO, "performing point-in-object(PIO)-tests"); - long counter1=0, counter2 = 0; - float x1w, x2w, x3w; - int x1Min, x2Min, x3Min, x1Max, x2Max, x3Max; - float einflussBereichKnoten_sq = dx1*dx1+dx2*dx2+dx3*dx3; - - timer.start(); - for(size_t t=0; t<triFaces.size(); t++) - { - GbTriFaceMesh3D::TriFace& triangle = triFaces[t]; - GbTriFaceMesh3D::Vertex& v1 = vertices[triangle.v1]; - GbTriFaceMesh3D::Vertex& v2 = vertices[triangle.v2]; - GbTriFaceMesh3D::Vertex& v3 = vertices[triangle.v3]; - - ////////////////////////////////////////////////////////////////////////// - // AABB riangle - ////////////////////////////////////////////////////////////////////////// - x1Min = /*UbMath::integerRounding*/( std::floor( ( UbMath::min( v1.x, v2.x, v3.x ) - orgx1) / dx1 ) ); - x2Min = /*UbMath::integerRounding*/( std::floor( ( UbMath::min( v1.y, v2.y, v3.y ) - orgx2) / dx2 ) ); - x3Min = /*UbMath::integerRounding*/( std::floor( ( UbMath::min( v1.z, v2.z, v3.z ) - orgx3) / dx3 ) ); - - x1Max = /*UbMath::integerRounding*/( std::ceil( ( UbMath::max( v1.x, v2.x, v3.x ) - orgx1) / dx1 ) ); - x2Max = /*UbMath::integerRounding*/( std::ceil( ( UbMath::max( v1.y, v2.y, v3.y ) - orgx2) / dx2 ) ); - x3Max = /*UbMath::integerRounding*/( std::ceil( ( UbMath::max( v1.z, v2.z, v3.z ) - orgx3) / dx3 ) ); - - GbHalfSpace3D halfSpace( v1.x, v1.y, v1.z, v2.x, v2.y, v2.z, v3.x, v3.y, v3.z ); - - for(int x3=x3Min; x3<=x3Max; x3++) - { - for(int x2=x2Min; x2<=x2Max; x2++) - { - for(int x1=x1Min; x1<=x1Max; x1++) - { - counter1++; - - short& solidVal = solids(x1,x2,x3); - - if( solidVal != Flag::UNDEF ) //doppeltes Testen vermeiden - { - continue; - } - - counter2++; - - //Weltkoords - x1w = orgx1+x1*dx1; - x2w = orgx2+x2*dx2; - x3w = orgx3+x3*dx3; - - float dist = (float)halfSpace.getDistance( x1w, x2w, x3w ); - if( UbMath::greater( dist, 0.0f) ) - { - continue; - } - if( UbMath::greater(dist*dist, einflussBereichKnoten_sq)) - { - continue; - } - - //eigentlicher PIO-Test - bool testFailed = true; - for(int i=0; i<100; i++ ) - { - Kd::Ray<float> ray( x1w, x2w, x3w //, 1, 0 ,0 ); - , ( x1w < x1center ? (float)UbRandom::rand(-1.0,-0.001, 10) : (float)UbRandom::rand(0.001, 1.0, 10) ) - , ( x2w < x2center ? (float)UbRandom::rand(-1.0,-0.001, 10) : (float)UbRandom::rand(0.001, 1.0, 10) ) - , ( x3w < x3center ? (float)UbRandom::rand(-1.0,-0.001, 10) : (float)UbRandom::rand(0.001, 1.0, 10) ) ); - - int iSec = kdTree.intersectRay( ray, Kd::CountRayIntersectionHandler<float>() ); - - if( iSec != Kd::Intersection::INTERSECT_EDGE ) //KEINE Kante getroffen - { - if(iSec == Kd::Intersection::ON_BOUNDARY ) - { - solidVal = Flag::SOLID; - } - else - { - solidVal = (iSec&1); //ungerade anzahl an schnitten --> drinnen - } - testFailed = false; - break; - } - else - { - UBLOG(logDEBUG3, "GbTriFaceMesh3D.isPointInGbObject3D.if - an edge was hit "); - } - } - if( testFailed ) throw UbException(UB_EXARGS, "ups, nach 100 Strahlen immer noch kein Ergebnis"); - } - } - } - } - timerVals.push_back( UbTuple<string, double>("PiO-Test", timer.stop() ) ); - UBLOG( logINFO,counter2 <<" point-in-object(PIO)-tests done in "<<val<2>(timerVals.back())<<"s" ); - UBLOG( logINFO,counter1-counter2 <<" point-in-object(PIO)-tests uebersprungen" ); - - ////////////////////////////////////////////////////////////////////////// - // FLOOD FILL - ////////////////////////////////////////////////////////////////////////// - - if( false) //using just one seed point - { - //FUELL - bool foundSeedPoint = false; - int seedPointSearchCounter = 0; - int seedX1 = Ub::inf; - int seedX2 = Ub::inf; - int seedX3 = Ub::inf; - - timer.start(); - for(size_t t=0; t<triFaces.size(); t++) - { - GbTriFaceMesh3D::TriFace& triangle = triFaces[t]; - - float& nx = triangle.nx; - float& ny = triangle.ny; - float& nz = triangle.nz; - - float cx1 = triangle.getX1Centroid(vertices); - float cx2 = triangle.getX2Centroid(vertices); - float cx3 = triangle.getX3Centroid(vertices); - - for(int k=0; k<5; k++) - { - seedPointSearchCounter++; - - cx1 -= nx * dx1; - cx2 -= ny * dx2; - cx3 -= nz * dx3; - - int ix1 = UbMath::integerRounding( (cx1-orgx1)/dx1 ); - int ix2 = UbMath::integerRounding( (cx2-orgx2)/dx2 ); - int ix3 = UbMath::integerRounding( (cx3-orgx3)/dx3 ); - - if( solids.indicesInRange(ix1,ix2,ix3) - && solids(ix1, ix2, ix3 ) == Flag::UNDEF ) - { - x1w = orgx1+ix1*dx1; - x2w = orgx2+ix2*dx2; - x3w = orgx3+ix3*dx3; - - Kd::Ray<float> ray( x1w, x2w, x3w //, 1, 0 ,0 ); - , ( x1w < x1center ? (float)UbRandom::rand(-1.0,-0.001, 10) : (float)UbRandom::rand(0.001, 1.0, 10) ) - , ( x2w < x2center ? (float)UbRandom::rand(-1.0,-0.001, 10) : (float)UbRandom::rand(0.001, 1.0, 10) ) - , ( x3w < x3center ? (float)UbRandom::rand(-1.0,-0.001, 10) : (float)UbRandom::rand(0.001, 1.0, 10) ) ); - - int iSec = kdTree.intersectRay( ray, Kd::CountRayIntersectionHandler<float>() ); - - if( iSec>0 && (iSec&1) ) - { - seedX1 = ix1; - seedX2 = ix2; - seedX3 = ix3; - foundSeedPoint = true; - break; - } - } - } - if(foundSeedPoint) break; - } - if(!foundSeedPoint) - throw UbException(UB_EXARGS,"fuck no seed point found"); - timerVals.push_back( UbTuple<string, double>("Seed found in", timer.stop() ) ); - UBLOG( logINFO,"found seed Point in "<<val<2>(timerVals.back())<<"s with "<<seedPointSearchCounter << " tested points" ); - - cout<<nx1<<","<<nx2<<","<<nx3<<endl; - bool recursiveFloodFill = ( nx1*nx2*nx3 < 100*100*30 ); - if(recursiveFloodFill) - { - timer.start(); - recursiveGridFill(solids, seedX1, seedX2, seedX3, Flag::SOLID); - timerVals.push_back( UbTuple<string, double>("flood fill (r)", timer.stop() ) ); - UBLOG( logINFO,"recursive flood fill in "<<val<2>(timerVals.back())<<"s with "<<seedPointSearchCounter << " tested points" ); - - CbUniformMatrix3D<short> solidsCpy(solids); - timer.start(); - iterativeGridFill(solidsCpy, seedX1, seedX2, seedX3, Flag::SOLID); - timerVals.push_back( UbTuple<string, double>("flood fill (i)", timer.stop() ) ); - UBLOG( logINFO,"iterative flood fill in "<<val<2>(timerVals.back())<<"s with "<<seedPointSearchCounter << " tested points" ); - } - else - { - timer.start(); - iterativeGridFill(solids, seedX1, seedX2, seedX3, Flag::SOLID); - timerVals.push_back( UbTuple<string, double>("flood fill (r)", timer.stop() ) ); - UBLOG( logINFO,"recursive flood fill in "<<val<2>(timerVals.back())<<"s with "<<seedPointSearchCounter << " tested points" ); - } - - UBLOG(logINFO, "############################################################"); - - } - else //verifying complete arry - { - bool recursiveFloodFill = ( nx1*nx2*nx3 < 100*100*30 ); - int solidCounter = 0; - - timer.start(); - for(int x3=0; x3<solids.getNX3(); x3++) - for(int x2=0; x2<solids.getNX2(); x2++) - for(int x1=0; x1<solids.getNX1(); x1++) - { - if( solids(x1 ,x2 ,x3 ) == Flag::UNDEF ) - { - x1w = orgx1+x1*dx1; - x2w = orgx2+x2*dx2; - x3w = orgx3+x3*dx3; - - int iSec = -1; - do{ - Kd::Ray<float> ray( x1w, x2w, x3w //, 1, 0 ,0 ); - , ( x1w < x1center ? (float)UbRandom::rand(-1.0,-0.001, 10) : (float)UbRandom::rand(0.001, 1.0, 10) ) - , ( x2w < x2center ? (float)UbRandom::rand(-1.0,-0.001, 10) : (float)UbRandom::rand(0.001, 1.0, 10) ) - , ( x3w < x3center ? (float)UbRandom::rand(-1.0,-0.001, 10) : (float)UbRandom::rand(0.001, 1.0, 10) ) ); - - iSec = kdTree.intersectRay( ray, Kd::CountRayIntersectionHandler<float>() ); - }while(iSec<0); - - if( iSec&1 ) - { - if(recursiveFloodFill) recursiveGridFill(solids,x1,x2,x3,Flag::SOLID); - else iterativeGridFill(solids,x1,x2,x3,Flag::SOLID); - } - else - { - if(recursiveFloodFill) recursiveGridFill(solids,x1,x2,x3,Flag::FLUID); - else iterativeGridFill(solids,x1,x2,x3,Flag::FLUID); - } - } - } - if(recursiveFloodFill) timerVals.push_back( UbTuple<string, double>("flood fill (r)", timer.stop() ) ); - else timerVals.push_back( UbTuple<string, double>("flood fill (i)", timer.stop() ) ); - UBLOG( logINFO,"recursive flood fill in "<<val<2>(timerVals.back())<<"s " ); - } - - list< UbTuple< string, double > >::iterator iter; - for(iter = timerVals.begin(); iter!=timerVals.end(); ++iter) - { - UBLOG( logINFO, setw(16) << val<1>(*iter) << " in " << setw(8) << setprecision(8) << val<2>(*iter) << "s" ); - } - - int solidCounter = 0; - for(int x3=0; x3<solids.getNX3(); x3++) - for(int x2=0; x2<solids.getNX2(); x2++) - for(int x1=0; x1<solids.getNX1(); x1++) - { - if( solids(x1 ,x2 ,x3 ) == Flag::SOLID ) - { - solidCounter++; - } - } - - UBLOG( logINFO, "SOLIDS = " <<solidCounter); - UBLOG( logINFO, "SOLIDS = " <<solidCounter); - UBLOG( logINFO, "SOLIDS = " <<solidCounter); - UBLOG( logINFO, "SOLIDS = " <<solidCounter); - - /* ======================================================================================= */ - if(writeFiles) - { - UBLOG( logINFO, "writeFiles - start"); - string subfiledir = outpath+"/"+filename+"_solid_node_files"; - UbSystem::makeDirectory( subfiledir ); - - std::vector<UbTupleFloat3 > nodes; - std::vector<std::string > datanames(1,"data"); - datanames[0] = "solid"; - - std::vector< std::string > outFilenames; - - std::vector<std::vector<double > > nodedata( datanames.size() ); - - for(int x3=0; x3<solids.getNX3(); x3++) - for(int x2=0; x2<solids.getNX2(); x2++) - for(int x1=0; x1<solids.getNX1(); x1++) - { - if( solids(x1 ,x2 ,x3 ) == Flag::SOLID ) - { - nodes.push_back( makeUbTuple( orgx1+x1*dx1, orgx2+x2*dx2, orgx3+x3*dx3 ) ); - nodedata[0].push_back( solids(x1 ,x2 ,x3 ) ); - } - - if( nodes.size() > 2000000 - || ( x1==(solids.getNX1()-1) && x2==(solids.getNX2()-1) && x3==(solids.getNX3()-1) ) ) - { - outFilenames.push_back( WbWriterVtkXmlBinary::getInstance()->writeNodesWithNodeData(subfiledir+"/"+filename+"_solid_nodes_"+"_part"+UbSystem::toString(outFilenames.size()+1),nodes,datanames,nodedata) ); - nodes.clear(); - nodedata.clear(); - nodedata.resize( datanames.size() ); - } - } - - WbWriterVtkXmlBinary::getInstance()->writeCollection(outpath+"/"+filename+"_solids_nodes",outFilenames,0,false); - - - mesh->writeMesh(outpath+"/"+filename+"_mesh",WbWriterVtkXmlBinary::getInstance()); - kdTree.writeTree(outpath+"/"+filename+"_kdTree",WbWriterVtkXmlBinary::getInstance()); - - UBLOG( logINFO, "writeFiles - end") - } - - delete mesh; -} - -namespace Dirs -{ - const int X1[] = { 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 0, 0, 0, 0, 0 }; - const int X2[] = { 0, 0, 1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 0 }; - const int X3[] = { 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 0 }; - - const int START = 0; - const int END6 = 5; - const int END18 = 17; -} -/*==================================================================*/ -bool floodFillCheck(CbUniformMatrix3D<short>& grid, const short& x, const short& y, const short& z) -{ - return grid.indicesInRange( x, y, z ) && grid(x,y,z)==Flag::UNDEF; -} -int g_counter = 0; -void recursiveGridFill(CbUniformMatrix3D<short>& grid, const short& xs, const short& ys, const short& zs, const short& type) -{ - // Algorithmus zum F�llen eines Polyeders, ausgehend vom Saatpunkt xs,ys,zs - - //Saatknoten einf�rben - short& val = grid(xs,ys,zs); - if( val==Flag::UNDEF ) - { - val = type; - } - if( floodFillCheck( grid, xs+1, ys , zs ) ) recursiveGridFill( grid, xs+1, ys , zs , type ); - if( floodFillCheck( grid, xs , ys+1, zs ) ) recursiveGridFill( grid, xs , ys+1, zs , type ); - if( floodFillCheck( grid, xs , ys , zs+1 ) ) recursiveGridFill( grid, xs , ys , zs+1, type ); - if( floodFillCheck( grid, xs-1, ys , zs ) ) recursiveGridFill( grid, xs-1, ys , zs , type ); - if( floodFillCheck( grid, xs , ys-1, zs ) ) recursiveGridFill( grid, xs , ys-1, zs , type ); - if( floodFillCheck( grid, xs , ys , zs-1 ) ) recursiveGridFill( grid, xs , ys , zs-1, type ); -} -/*==================================================================*/ -void iterativeGridFill(CbUniformMatrix3D<short>& grid, const short& xs, const short& ys, const short& zs, const short& type) -{ - std::stack< UbTupleInt3 > stck; - stck.push( UbTupleInt3(xs,ys,zs) ); - - int x,y,z; - - while( !stck.empty() ) - { - x = val<1>( stck.top() ); - y = val<2>( stck.top() ); - z = val<3>( stck.top() ); - stck.pop(); - - short& flagType = grid( x, y, z ); - - if( flagType == Flag::UNDEF ) - { - flagType = type; - - if ( grid.indicesInRange( x+1, y , z ) ) stck.push( UbTupleInt3( x+1, y , z ) ); - if ( grid.indicesInRange( x , y+1, z ) ) stck.push( UbTupleInt3( x , y+1, z ) ); - if ( grid.indicesInRange( x , y , z+1 ) ) stck.push( UbTupleInt3( x , y , z+1 ) ); - if ( grid.indicesInRange( x-1, y , z ) ) stck.push( UbTupleInt3( x-1, y , z ) ); - if ( grid.indicesInRange( x , y-1, z ) ) stck.push( UbTupleInt3( x , y-1, z ) ); - if ( grid.indicesInRange( x , y , z-1 ) ) stck.push( UbTupleInt3( x , y , z-1 ) ); - } - } -} diff --git a/src/basics/geometry3d/KdTree/examples/PIOTests/CMakeLists.txt b/src/basics/geometry3d/KdTree/examples/PIOTests/CMakeLists.txt deleted file mode 100644 index 2b748ae13..000000000 --- a/src/basics/geometry3d/KdTree/examples/PIOTests/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -cmake_minimum_required(VERSION 2.6) - -PROJECT(kdtree_pioTest) - -################################################################# -# MACHINE_SPECIFIC CMAKE_CONFIG_FILE -################################################################# -INCLUDE("../../../../../CMake/CMakeCABMacros.txt") - -################################################################# -### PACKAGES ### -################################################################# -INCLUDE(${SOURCE_ROOT}/basics/utilities/CMakePackage.txt) -INCLUDE(${SOURCE_ROOT}/basics/container/CMakePackage.txt) -INCLUDE(${SOURCE_ROOT}/basics/memory/CMakePackage.txt) -INCLUDE(${SOURCE_ROOT}/basics/objects/CMakePackage.txt) -INCLUDE(${SOURCE_ROOT}/basics/writer/CMakePackage.txt) - -INCLUDE(${SOURCE_ROOT}/geometry3d/CMakePackage.txt) -INCLUDE(${SOURCE_ROOT}/geometry3d/KdTree/CMakePackage.txt) -INCLUDE(${SOURCE_ROOT}/geometry3d/fem/CMakePackage.txt) -INCLUDE(${SOURCE_ROOT}/geometry3d/creator/CMakePackage.txt) - -################################################################# -### OWN DEFINES ### -################################################################# -FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h - ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp ) - -SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES}) -SOURCE_GROUP(z_main FILES ${SPECIFIC_FILES}) - -################################################################# -### PROJECT ERSTELLEN ### -################################################################# -CREATE_CAB_PROJECT(${PROJECT_NAME} BINARY) diff --git a/src/basics/geometry3d/KdTree/examples/PIOTests/main.cpp b/src/basics/geometry3d/KdTree/examples/PIOTests/main.cpp deleted file mode 100644 index 15ad8489a..000000000 --- a/src/basics/geometry3d/KdTree/examples/PIOTests/main.cpp +++ /dev/null @@ -1,342 +0,0 @@ -#include <basics/utilities/UbTiming.h> -#include <basics/utilities/UbRandom.h> - -#include <basics/writer/WbWriterAvsASCII.h> -#include <basics/writer/WbWriterAvsBinary.h> -#include <basics/writer/WbWriterVtkXmlBinary.h> -#include <basics/writer/WbWriterVtkXmlASCII.h> - -#include <basics/container/CbUniformMatrix4D.h> - -#include <geometry3d/GbTriFaceMesh3D.h> -#include <geometry3d/creator/GbTriFaceMesh3DCreator.h> - -#include <geometry3d/KdTree/KdTree.h> -#include <geometry3d/KdTree/splitalgorithms/KdSpatiallMedianSplit.h> -#include <geometry3d/KdTree/splitalgorithms/KdSAHSplit.h> -#include <geometry3d/KdTree/intersectionhandler/KdCountLineIntersectionHandler.h> -#include <geometry3d/KdTree/intersectionhandler/KdCountRayIntersectionHandler.h> - -using namespace std; - -void KdTreeTest (std::string meshfile, int maxNofPointsPerDir, GbTriFaceMesh3D::KDTREE_SPLITAGORITHM pio, bool writeFiles = true, std::string outpath = "g:/temp"); -void KdTreeTestWithLines(std::string meshfile, int maxNofPointsPerDir, GbTriFaceMesh3D::KDTREE_SPLITAGORITHM pio, bool writeFiles = true, std::string outpath = "g:/temp"); - -int main() -{ - try - { - //KdTreeTest("c:/temp/clumps.stl", 200, GbTriFaceMesh3D::KDTREE_SAHPLIT , true, "g:/temp"); - //KdTreeTest("c:/temp/50spheres.inp", 200, GbTriFaceMesh3D::KDTREE_SAHPLIT , true, "g:/temp"); - //KdTreeTest("c:/temp/Sphere5040.inp", 200, GbTriFaceMesh3D::KDTREE_SAHPLIT , true, "g:/temp"); - //KdTreeTest("c:/temp/cooling_2.inp", 400, GbTriFaceMesh3D::KDTREE_SAHPLIT , true, "g:/temp"); - //KdTreeTest("c:/temp/NDR-Konzertsaal.inp", 100, GbTriFaceMesh3D::KDTREE_SAHPLIT , true, "g:/temp"); - - //KdTreeTest("c:/temp/Campus-Details-W3.inp", 200, GbTriFaceMesh3D::KDTREE_SAHPLIT , true, "g:/temp"); - //KdTreeTest("c:/temp/Boein707.mesh", 100, GbTriFaceMesh3D::KDTREE_SAHPLIT , true, "g:/temp"); - - //KdTreeTest("c:/temp/dolphin.mesh", 400, GbTriFaceMesh3D::KDTREE_SAHPLIT , true, "g:/temp"); - //KdTreeTest("c:/temp/box.ply", 10, GbTriFaceMesh3D::KDTREE_SAHPLIT , true, "g:/temp"); - //KdTreeTest("c:/temp/bodyRight.stl", 200, GbTriFaceMesh3D::KDTREE_SAHPLIT , true, "g:/temp"); - //KdTreeTest("c:/temp/flamingo.mesh", 200, GbTriFaceMesh3D::KDTREE_SAHPLIT , true, "g:/temp"); - - //KdTreeTest("c:/temp/torus.inp", 200, GbTriFaceMesh3D::KDTREE_SAHPLIT , true, "g:/temp"); - //KdTreeTestWithLines("c:/temp/box.ply", 10, GbTriFaceMesh3D::KDTREE_SAHPLIT , true, "g:/temp"); - - KdTreeTest("c:/temp/doppelwandbox.ply", 100, GbTriFaceMesh3D::KDTREE_SPATIALSPLIT, true, "g:/temp"); - - //KdTreeTestWithLines("c:/temp/torus.inp", 200, GbTriFaceMesh3D::KDTREE_SAHPLIT, true, "g:/temp"); - - //KdTreeTestWithLines("c:/temp/bodyRight.stl", 200, GbTriFaceMesh3D::KDTREE_SAHPLIT , true, "g:/temp"); - - //KdTreeTest("c:/temp/jetta.stl", 200, GbTriFaceMesh3D::KDTREE_SPATIALSPLIT , true, "g:/temp"); - //KdTreeTest("c:/temp/jetta.stl", 200, GbTriFaceMesh3D::KDTREE_SAHPLIT, true, "g:/temp"); - //KdTreeTest("c:/temp/VW_body.ply", 200, GbTriFaceMesh3D::KDTREE_SAHPLIT , true, "g:/temp"); - //KdTreeTest("c:/temp/kugel.stl", 50, GbTriFaceMesh3D::KDTREE_SAHPLIT , true, "g:/temp"); - //KdTreeTest("c:/temp/ship-2.mesh", 100, GbTriFaceMesh3D::KDTREE_SAHPLIT , true, "g:/temp/schiff2"); - } - catch(const std::exception& e) - { - UBLOG2( logERROR, std::cerr, "Caught exception:"); - UBLOG2( logERROR, std::cerr, "Type: " << typeid(e).name() ); - UBLOG2ML(logERROR, std::cerr, "What: " << e.what() ); - } - catch(...) - { - UBLOG2(logERROR, std::cerr, "unknown exception occurs in "<< UB_FUNCTION) - } - - - - -} - -////////////////////////////////////////////////////////////////////// -void KdTreeTest(std::string meshfile, int maxNofPointsPerDir, GbTriFaceMesh3D::KDTREE_SPLITAGORITHM pio, bool writeFiles, std::string outpath) -{ - UbLog::setReportingLevel(logDEBUG5); - std::string filename = UbSystem::getFilenameFromString(meshfile); - - GbTriFaceMesh3D* mesh = GbTriFaceMesh3DCreator::getInstance()->readMeshFromFile(meshfile,"mesh",pio); - mesh->scale(10000,10000,10000); - //dummy test, damit der baum erstellt wird - mesh->isPointInGbObject3D(0,0,0); - - UBLOG(logINFO, "############################################################"); - UBLOG(logINFO, "nodes of TriFaceMesh....... "<<mesh->getNodes()->size() ); - UBLOG(logINFO, "triFaces of TriFaceMesh.... "<<mesh->getTriangles()->size() ); - UBLOG(logINFO, "triFace copies in KdTree... "<<mesh->getKdTree()->getNumOfTriFaces() ); - UBLOG(logINFO, "nodes of kdNodes of KdTree. "<<mesh->getKdTree()->getNumOfNodes() ); - UBLOG(logINFO, ""); - - - const float percentOverLap = 0.05f; //=5% - const float maxLength = (1.0f+percentOverLap)*UbMath::max( mesh->getLengthX1(), mesh->getLengthX2(), mesh->getLengthX3() ); - const float dx1 = maxLength/(maxNofPointsPerDir-1); - const float dx2 = dx1; - const float dx3 = dx1; - - const int nx1 = 1 + int( std::ceil(mesh->getLengthX1()*(1.0f+percentOverLap)/dx1)+0.5 ); - const int nx2 = 1 + int( std::ceil(mesh->getLengthX2()*(1.0f+percentOverLap)/dx2)+0.5 ); - const int nx3 = 1 + int( std::ceil(mesh->getLengthX3()*(1.0f+percentOverLap)/dx3)+0.5 ); - - CbUniformMatrix4D<int> solids(nx1,nx2,nx3,1,0); - - const float orgx1 = -0.5*percentOverLap*mesh->getLengthX1()+mesh->getX1Minimum(); - const float orgx2 = -0.5*percentOverLap*mesh->getLengthX2()+mesh->getX2Minimum(); - const float orgx3 = -0.5*percentOverLap*mesh->getLengthX3()+mesh->getX3Minimum(); - - const float outX1 = 2*mesh->getX1Maximum(); - const float outX2 = 0;//2*mesh->getX2Maximum(); - const float outX3 = 0;//2*mesh->getX3Maximum(); - - UBLOG( logINFO, "performing " << nx1*nx2*nx3 <<" point-in-object(PIO)-tests"); - UbTimer ff; - ff.start(); - for(int x3=0; x3<solids.getNX3(); x3++) - for(int x2=0; x2<solids.getNX2(); x2++) - for(int x1=0; x1<solids.getNX1(); x1++) - { - solids(x1,x2,x3,0) = mesh->isPointInGbObject3D(orgx1+x1*dx1, orgx2+x2*dx2, orgx3+x3*dx3); - } - UBLOG( logINFO, nx1*nx2*nx3 <<" point-in-object(PIO)-tests done in "<<ff.stop()<<"s" ); - UBLOG(logINFO, "############################################################"); - - - /* ======================================================================================= */ - if(writeFiles) - { - UBLOG( logINFO, "writeFiles - start"); - string subfiledir = outpath+"/"+filename+"_solid_node_files"; - UbSystem::makeDirectory( subfiledir ); - - std::vector<UbTupleFloat3 > nodes; - std::vector<std::string > datanames(solids.getNX4(),"data"); - datanames[0] = "solid"; - //datanames[1] = "solid"; - - std::vector< std::string > outFilenames; - - std::vector<std::vector<double > > nodedata( datanames.size() ); - for(int x3=0; x3<solids.getNX3(); x3++) - for(int x2=0; x2<solids.getNX2(); x2++) - for(int x1=0; x1<solids.getNX1(); x1++) - { - if( solids(x1 ,x2 ,x3 , 0) ) - { - nodes.push_back( makeUbTuple( orgx1+x1*dx1, orgx2+x2*dx2, orgx3+x3*dx3 ) ); - - for(int i=0; i<solids.getNX4(); i++) - { - nodedata[i].push_back( solids(x1 ,x2 ,x3 ,i) ); - } - } - - if( nodes.size() > 2000000 - || ( x1==(solids.getNX1()-1) && x2==(solids.getNX2()-1) && x3==(solids.getNX3()-1) ) ) - { - outFilenames.push_back( WbWriterVtkXmlBinary::getInstance()->writeNodesWithNodeData(subfiledir+"/"+filename+"_solid_nodes_"+"_part"+UbSystem::toString(outFilenames.size()+1),nodes,datanames,nodedata) ); - nodes.clear(); - nodedata.clear(); - nodedata.resize( datanames.size() ); - } - } - - WbWriterVtkXmlBinary::getInstance()->writeCollection(outpath+"/"+filename+"_solids_nodes",outFilenames,0,false); - - - mesh->writeMesh(outpath+"/"+filename+"_mesh",WbWriterVtkXmlBinary::getInstance(),true); - mesh->writeMesh(outpath+"/"+filename+"_mesh",WbWriterAvsASCII::getInstance(),true); - mesh->getKdTree()->writeTree(outpath+"/"+filename+"_kdTree",WbWriterVtkXmlBinary::getInstance()); - - UBLOG( logINFO, "writeFiles - end") - } -} - -////////////////////////////////////////////////////////////////////// -void KdTreeTestWithLines(std::string meshfile, int maxNofPointsPerDir, GbTriFaceMesh3D::KDTREE_SPLITAGORITHM pio, bool writeFiles, std::string outpath) -{ - UbLog::setReportingLevel(logDEBUG5); - std::string filename = UbSystem::getFilenameFromString(meshfile); - - GbTriFaceMesh3D* mesh = GbTriFaceMesh3DCreator::getInstance()->readMeshFromFile(meshfile,"mesh",pio); - - //dummy test, damit der baum erstellt wird - mesh->isPointInGbObject3D(0,0,0); - - UBLOG(logINFO, "############################################################"); - UBLOG(logINFO, "nodes of TriFaceMesh....... "<<mesh->getNodes()->size() ); - UBLOG(logINFO, "triFaces of TriFaceMesh.... "<<mesh->getTriangles()->size() ); - UBLOG(logINFO, "triFace copies in KdTree... "<<mesh->getKdTree()->getNumOfTriFaces() ); - UBLOG(logINFO, "nodes of kdNodes of KdTree. "<<mesh->getKdTree()->getNumOfNodes() ); - UBLOG(logINFO, ""); - - - const float percentOverLap = 0.05f; //=5% - const float maxLength = (1.0f+percentOverLap)*UbMath::max( mesh->getLengthX1(), mesh->getLengthX2(), mesh->getLengthX3() ); - const float dx1 = maxLength/(maxNofPointsPerDir-1); - const float dx2 = dx1; - const float dx3 = dx1; - - const int nx1 = 1 + /*UbMath::integerRounding*/( std::ceil(mesh->getLengthX1()*(1.0f+percentOverLap)/dx1) ); - const int nx2 = 1 + /*UbMath::integerRounding*/( std::ceil(mesh->getLengthX2()*(1.0f+percentOverLap)/dx2) ); - const int nx3 = 1 + /*UbMath::integerRounding*/( std::ceil(mesh->getLengthX3()*(1.0f+percentOverLap)/dx3) ); - - CbUniformMatrix4D<int> solids(nx1,nx2,nx3,2,0); - - const float orgx1 = -0.5*percentOverLap*mesh->getLengthX1()+mesh->getX1Minimum(); - const float orgx2 = -0.5*percentOverLap*mesh->getLengthX2()+mesh->getX2Minimum(); - const float orgx3 = -0.5*percentOverLap*mesh->getLengthX3()+mesh->getX3Minimum(); - -// const float outX1 = 2*mesh->getX1Maximum(); -// const float outX2 = 2*mesh->getX2Maximum(); -// const float outX3 = 2*mesh->getX3Maximum(); - - - Kd::Tree<double>* kdTree = mesh->getKdTree(); - - std::vector<GbTriFaceMesh3D::TriFace>& triFaces = *mesh->getTriangles(); - std::vector<GbTriFaceMesh3D::Vertex>& vertices = *mesh->getNodes(); - - float x1center = float( mesh->getX1Centroid() ); - float x2center = float( mesh->getX2Centroid() ); - float x3center = float( mesh->getX3Centroid() ); - - UBLOG( logINFO, "performing point-in-object(PIO)-tests"); - UbTimer ff; - ff.start(); - long counter1=0, counter2 = 0; - for(size_t t=0; t<triFaces.size(); t++) - { - int x1Min = /*UbMath::integerRounding*/( std::floor( (triFaces[t].getMinX(vertices)-orgx1) / dx1 ) ); - int x2Min = /*UbMath::integerRounding*/( std::floor( (triFaces[t].getMinY(vertices)-orgx2) / dx2 ) ); - int x3Min = /*UbMath::integerRounding*/( std::floor( (triFaces[t].getMinZ(vertices)-orgx3) / dx3 ) ); - - int x1Max = /*UbMath::integerRounding*/( std::ceil( (triFaces[t].getMaxX(vertices)-orgx1) / dx1 ) ); - int x2Max = /*UbMath::integerRounding*/( std::ceil( (triFaces[t].getMaxY(vertices)-orgx2) / dx2 ) ); - int x3Max = /*UbMath::integerRounding*/( std::ceil( (triFaces[t].getMaxZ(vertices)-orgx3) / dx3 ) ); - - for(int x3=x3Min; x3<=x3Max; x3++) - for(int x2=x2Min; x2<=x2Max; x2++) - for(int x1=x1Min; x1<=x1Max; x1++) - { - counter1++; - - if( !solids.indicesInRange(x1,x2,x3,0) - || solids(x1,x2,x3,1) == 1 ) //doppeltes Testeb vermeiden - { - continue; - } - - counter2++; - - double x1w = orgx1+x1*dx1; - double x2w = orgx2+x2*dx2; - double x3w = orgx3+x3*dx3; - - //eigentlicher PIO-Test - bool testFailed = true; - for(int i=0; i<100; i++) - { - UbTupleDouble3 n1(x1w, x2w, x3w); - UbTupleDouble3 n2( double( x1w < x1center ? mesh->getX1Minimum()-UbRandom::rand(0.5, 1.0, 10)*mesh->getLengthX1() : mesh->getX1Maximum()+UbRandom::rand(0.5, 1.0, 10)*mesh->getLengthX1() ) - , double( x2w < x2center ? mesh->getX2Minimum()-UbRandom::rand(0.5, 1.0, 10)*mesh->getLengthX2() : mesh->getX2Maximum()+UbRandom::rand(0.5, 1.0, 10)*mesh->getLengthX2() ) - , double( x3w < x3center ? mesh->getX3Minimum()-UbRandom::rand(0.5, 1.0, 10)*mesh->getLengthX3() : mesh->getX3Maximum()+UbRandom::rand(0.5, 1.0, 10)*mesh->getLengthX3() ) ); - - int iSec = kdTree->intersectLine( n1, n2, Kd::CountLineIntersectionHandler<double>() ); - - if( iSec != Kd::Intersection::INTERSECT_EDGE ) //KEINE Kante getroffen - { - if(iSec == Kd::Intersection::ON_BOUNDARY ) - { - solids(x1,x2,x3,0) = true; - } - else - { - solids(x1,x2,x3,0) = (iSec&1); //ungerade anzahl an schnitten --> drinnen - } - testFailed = false; - break; - } - else - { - UBLOG(logDEBUG3, "GbTriFaceMesh3D.isPointInGbObject3D.if - an edge was hit "); - } - } - if( testFailed ) throw UbException(UB_EXARGS, "ups, nach 100 Strahlen immer noch kein Ergebnis"); - solids(x1,x2,x3,1) = 1; - } - } - UBLOG( logINFO,counter2 <<" point-in-object(PIO)-tests done in "<<ff.stop()<<"s" ); - UBLOG( logINFO,counter1-counter2 <<" point-in-object(PIO)-tests uebersprungen" ); - UBLOG(logINFO, "############################################################"); - - /* ======================================================================================= */ - if(writeFiles) - { - UBLOG( logINFO, "writeFiles - start"); - string subfiledir = outpath+"/"+filename+"_solid_node_files"; - UbSystem::makeDirectory( subfiledir ); - - std::vector<UbTupleFloat3 > nodes; - std::vector<std::string > datanames(solids.getNX4(),"data"); - datanames[0] = "solid"; - //datanames[1] = "solid"; - - std::vector< std::string > outFilenames; - - std::vector<std::vector<double > > nodedata( datanames.size() ); - for(int x3=0; x3<solids.getNX3(); x3++) - for(int x2=0; x2<solids.getNX2(); x2++) - for(int x1=0; x1<solids.getNX1(); x1++) - { - if( solids(x1 ,x2 ,x3 , 0) ) - { - nodes.push_back( makeUbTuple( orgx1+x1*dx1, orgx2+x2*dx2, orgx3+x3*dx3 ) ); - - for(int i=0; i<solids.getNX4(); i++) - { - nodedata[i].push_back( solids(x1 ,x2 ,x3 ,i) ); - } - } - - if( nodes.size() > 2000000 - || ( x1==(solids.getNX1()-1) && x2==(solids.getNX2()-1) && x3==(solids.getNX3()-1) ) ) - { - outFilenames.push_back( WbWriterVtkXmlBinary::getInstance()->writeNodesWithNodeData(subfiledir+"/"+filename+"_solid_nodes_"+"_part"+UbSystem::toString(outFilenames.size()+1),nodes,datanames,nodedata) ); - nodes.clear(); - nodedata.clear(); - nodedata.resize( datanames.size() ); - } - } - - WbWriterVtkXmlBinary::getInstance()->writeCollection(outpath+"/"+filename+"_solids_nodes",outFilenames,0,false); - - - mesh->writeMesh(outpath+"/"+filename+"_mesh",WbWriterVtkXmlBinary::getInstance()); - mesh->writeMesh(outpath+"/"+filename+"_mesh",WbWriterAvsASCII::getInstance()); - mesh->getKdTree()->writeTree(outpath+"/"+filename+"_kdTree",WbWriterVtkXmlBinary::getInstance()); - - UBLOG( logINFO, "writeFiles - end") - } -} diff --git a/src/basics/geometry3d/examples/insideOutsideTests/CMakeLists.txt b/src/basics/geometry3d/examples/insideOutsideTests/CMakeLists.txt deleted file mode 100644 index 989760098..000000000 --- a/src/basics/geometry3d/examples/insideOutsideTests/CMakeLists.txt +++ /dev/null @@ -1,61 +0,0 @@ -cmake_minimum_required(VERSION 2.4) - -INCLUDE("../../../../CMakeCABMacros.txt") -INCLUDE("../../../../CMakeSetCompilerFlags.txt") - -CHECK_FOR_VARIABLE(CAB_MACHINE "machine name, e.g. ALTIX, ARWEN") -SET(CMAKE_CONFIG_FILE "${SOURCE_ROOT}/cmake_config_files/${CAB_MACHINE}.config.cmake") - -IF(CAB_MACHINE AND EXISTS ${CMAKE_CONFIG_FILE} ) - - PROJECT(geo3dCellCutTests) - - SET(EXECUTABLE_NAME geo3dCellCutTests) - - #erst hier das config file einf�gen, ansonsten werden manche settings durch (Project) �berschrieben) - INCLUDE(${CMAKE_CONFIG_FILE}) - - ################################################################# - ### PACKAGES ### - ################################################################# - INCLUDE(${SOURCE_ROOT}/basics/utilities/CMakePackage.txt) - INCLUDE(${SOURCE_ROOT}/basics/objects/CMakePackage.txt) - INCLUDE(${SOURCE_ROOT}/geometry3d/CMakePackage.txt) - INCLUDE(${SOURCE_ROOT}/geometry3d/creator/CMakePackage.txt) - INCLUDE(${SOURCE_ROOT}/geometry3d/fem/CMakePackage.txt) - - ################################################################# - ### OWN DEFINES ### - ################################################################# - FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h - ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp ) - - - SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES}) - SOURCE_GROUP(example FILES ${SPECIFIC_FILES}) - - SET_COMPILER_SPECIFIC_FLAGS(${CAB_COMPILER} BINARY) - - ################################################################# - ### ADDITIONAL_MAKE_CLEAN_FILES ### - ################################################################# - SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${GENERATED_FILES}") - - ################################################################# - ### EXCECUTABLE ### - ################################################################# - ADD_EXECUTABLE(${EXECUTABLE_NAME} ${ALL_SOURCES} ) - - ################################################################# - ### ADDITIONAL LINK PROPERTIES ### - ################################################################# - IF(CAB_ADDITIONAL_LINK_FLAGS) - SET_TARGET_PROPERTIES(${EXECUTABLE_NAME} PROPERTIES LINK_FLAGS ${CAB_ADDITIONAL_LINK_FLAGS}) - ENDIF(CAB_ADDITIONAL_LINK_FLAGS) -ELSE() - IF(CAB_MACHINE) - MESSAGE("CAB_MACHINE error - following file is missing: \n ${CMAKE_CONFIG_FILE}") - ELSE() - MESSAGE("check CAB_MACHINE!!!") - ENDIF() -ENDIF() \ No newline at end of file diff --git a/src/basics/geometry3d/examples/insideOutsideTests/main.cpp b/src/basics/geometry3d/examples/insideOutsideTests/main.cpp deleted file mode 100644 index fff172a00..000000000 --- a/src/basics/geometry3d/examples/insideOutsideTests/main.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include <geometry3d/GbCuboid3D.h> -#include <geometry3d/GbSphere3D.h> -#include <geometry3d/GbCylinder3D.h> - -int main(int argc, char** argv) -{ - GbSphere3D test(10,10,10,8); - - bool cutSp1 /*false*/= test.isCellCuttingGbObject3D(9,9,9,11,11,11); //cell komplett IN sphere - bool cutSp2 /*true */= test.isCellCuttingGbObject3D(0,0,0,20,20,20); //cell umhuellt sphere - bool cutSp3 /*true */= test.isCellCuttingGbObject3D(0,0,0,10,10,10); //cell cutted sphere - bool cutSp4 /*false*/= test.isCellCuttingGbObject3D(100,100,100,101,101,101); //cell nix sphere - - - bool cutInsSp1 /*true */= test.isCellInsideOrCuttingGbObject3D(9,9,9,11,11,11); //cell komplett IN sphere - bool cutInsSp2 /*true */= test.isCellInsideOrCuttingGbObject3D(0,0,0,20,20,20); //cell umhuellt sphere - bool cutInsSp3 /*true */= test.isCellInsideOrCuttingGbObject3D(0,0,0,10,10,10); //cell cutted sphere - bool cutInsSp4 /*false*/= test.isCellInsideOrCuttingGbObject3D(100,100,100,101,101,101); //cell nix sphere - - GbCuboid3D test1(0,0,0,10,10,10); - - bool cutCu1 /*false*/= test1.isCellCuttingGbObject3D(4,4,4,6,6,6); //cell komplett IN cube - bool cutCu2 /*true */= test1.isCellCuttingGbObject3D(-1,-1,-1,11,11,11); //cell umhuellt cube - bool cutCu3 /*true */= test1.isCellCuttingGbObject3D(5,5,5,15,15,15); //cell cutted cube - bool cutCu4 /*false*/= test1.isCellCuttingGbObject3D(12,12,12,15,15,15); //cell nix cube - - bool cutInsCu1 /*true */= test1.isCellInsideOrCuttingGbObject3D(4,4,4,6,6,6); //cell komplett IN cube - bool cutInsCu2 /*true */= test1.isCellInsideOrCuttingGbObject3D(-1,-1,-1,11,11,11); //cell umhuellt cube - bool cutInsCu3 /*true */= test1.isCellInsideOrCuttingGbObject3D(5,5,5,15,15,15); //cell cutted cube - bool cutInsCu4 /*false*/= test1.isCellInsideOrCuttingGbObject3D(12,12,12,15,15,15); //cell nix cube - - GbCylinder3D test2( 0,0,0, 20, 0, 0, 10); - - bool cutCy1 /*false*/ = test2.isCellCuttingGbObject3D(1,-1,-1,4,1,1); //cell komplett IN cyl - bool cutCy2 /*true */ = test2.isCellCuttingGbObject3D(10,0,0,15,12,11); //cell umhuellt cyl - bool cutCy3a /*true */ = test2.isCellCuttingGbObject3D(5,5,5,15,15,15); //cell cutted cyl im kreisbreich - bool cutCy3b /*true */ = test2.isCellCuttingGbObject3D(-5,-1,-1,5,1,1); //cell cutted cyl am stirn - bool cutCy4 /*false*/= test2.isCellCuttingGbObject3D(-10,-10,-10,-5,-5,-5); //cell nix cyl - - - bool cutInsCy1 /*true */= test2.isCellInsideOrCuttingGbObject3D(4,4,4,6,6,6); //cell komplett IN cube - bool cutInsCy2 /*true */= test2.isCellInsideOrCuttingGbObject3D(10,0,0,15,12,11); //cell umhuellt cyl - bool cutInsCy3a /*true */= test2.isCellInsideOrCuttingGbObject3D(5,5,5,15,15,15); //cell cutted cyl im kreisbreich - bool cutInsCy3b /*true */= test2.isCellInsideOrCuttingGbObject3D(-5,-1,-1,5,1,1); //cell cutted cube - bool cutInsCy4 /*false*/= test2.isCellInsideOrCuttingGbObject3D(-10,-10,-10,-5,-5,-5); //cell nix cube -} \ No newline at end of file diff --git a/src/basics/geometry3d/examples/stl2inp/CMakeLists.txt b/src/basics/geometry3d/examples/stl2inp/CMakeLists.txt deleted file mode 100644 index 8205b5df5..000000000 --- a/src/basics/geometry3d/examples/stl2inp/CMakeLists.txt +++ /dev/null @@ -1,140 +0,0 @@ -SET(SOURCE_ROOT $ENV{CAB_DIR} CACHE PATH "(e.g. d:/temp/source)" ) -STRING(REGEX REPLACE "\\\\" "/" SOURCE_ROOT ${SOURCE_ROOT}) # "\" --> "/" - -IF(EXISTS ${SOURCE_ROOT}) - IF(EXISTS ${SOURCE_ROOT}/basics) - - INCLUDE(${SOURCE_ROOT}/CMakeCABMacros.txt) - - PROJECT (STL2INP) - SET(EXECUTABLE_NAME stl2inp) - - ################################################################# - ### PACKAGES ### - ################################################################# - - INCLUDE(${SOURCE_ROOT}/basics/objects/CMakeLists.txt) - INCLUDE(${SOURCE_ROOT}/basics/utilities/CMakeLists.txt) - INCLUDE(${SOURCE_ROOT}/basics/relation/CMakeLists.txt) - - - INCLUDE(${SOURCE_ROOT}/geometry2d/CMakeLists.txt) - INCLUDE(${SOURCE_ROOT}/geometry2d/creator/CMakeLists.txt) - - INCLUDE(${SOURCE_ROOT}/geometry3d/CMakeLists.txt) - INCLUDE(${SOURCE_ROOT}/geometry3d/creator/CMakeLists.txt) - - INCLUDE(${SOURCE_ROOT}/octree/CMakeLists.txt) - INCLUDE(${SOURCE_ROOT}/octree/facette/CMakeLists.txt) - - INCLUDE(${SOURCE_ROOT}/quadtree/CMakeLists.txt) - INCLUDE(${SOURCE_ROOT}/quadtree/nodeadaptation/CMakeLists.txt) - - - ################################################################# - ### OWN DEFINES ### - ################################################################# - # ADD_DEFINITIONS( -DCAB_QT ) - # ADD_DEFINITIONS( -DCAB_QTONLY ) - ADD_DEFINITIONS( -DMEMPOOL_A2PIIOCTNODEVD) - SET(SPECIFIC_FILES main.cpp stl2inp.h stl2inp.cpp QDefineUniformMesh.h QDefineUniformMesh.cpp) - SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES}) - SOURCE_GROUP(z_specific FILES ${SPECIFIC_FILES}) - - IF(WIN32) - ADD_CXX_FLAGS("/wd4996") - ELSE(WIN32) - ADD_CXX_FLAGS("-O3 -mcpu=athlon-4 -fomit-frame-pointer -finline-functions -funroll-all-loops") - ENDIF(WIN32) - - - - ################################################################# - ### QT SPECIFIC (only has effects if a QT source is included) ### - ################################################################# - #QT specific - SET(NEED_QT "YES") - INCLUDE(${SOURCE_ROOT}/CMakeQtMacros.txt) - - IF(QT_FOUND) - INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} - ${QT_INCLUDE_PATH} - ${QT_QTCORE_INCLUDE_DIR} - ${QT_QTGUI_INCLUDE_DIR} - ) - LINK_LIBRARIES ( ${QT_QTCORE_LIBRARY} - ${QT_QTGUI_LIBRARY} - ) - ADD_DEFINITIONS( ${QT_DEFINITIONS}) - ELSE(QT_FOUND) - IF(${NEED_QT} MATCHES "YES") - MESSAGE("Ups\nAt least one package needs Qt!\nPlease check Qt settings\n(e.g. librarys within Advanced Values)") - ENDIF(${NEED_QT} MATCHES "YES") - - - ENDIF(QT_FOUND) - - IF(QT_FOUND) - SET(SUBDIRPATH geometry3d/examples/stl2inp) - SET(CURRENT_DIR ${SOURCE_ROOT}/${SUBDIRPATH}) - - ################################################################ - ### Qt4 UI FILES ### - ################################################################ - FILE(GLOB UI_FILES ${CURRENT_DIR}/*.ui) #collect ui files - QT4_WRAP_UI(${CURRENT_DIR} OUTFILES ${UI_FILES}) #wrap ui files - REMOVE(TEMP_FILES ${OUTFILES} ) - SET(TEMP_FILES ${TEMP_FILES} ${OUTFILES} ) - - #make subfolders for VS with new files - SOURCE_GROUP(${SUBDIRPATH} FILES ${OUTFILES}) - - IF(WIN32) - SET(ALL_SOURCES ${ALL_SOURCES} ${UI_FILES}) - SOURCE_GROUP(${SUBDIRPATH} FILES ${UI_FILES}) - ENDIF(WIN32) - - ################################################################ - ### Qt4 HEADERS TO BE MOCED ### - ################################################################ - MAKE_DIRECTORY(${CURRENT_DIR}${QTGEN_MOC}) - SET(MOC_FILES ) #empty MOC_FILES - #SET(MOC_CLASSES ${CURRENT_DIR}/stl2inp.h QDefineUniformMesh.ui ) - - QT4_WRAP_CPP(${CURRENT_DIR}${QTGEN_MOC} MOC_FILES ${MOC_CLASSES}) - REMOVE(TEMP_FILES ${MOC_FILES}) - SET(TEMP_FILES ${TEMP_FILES} ${MOC_FILES}) - SOURCE_GROUP(${SUBDIRPATH}${QTGEN_MOC} FILES ${MOC_FILES}) - - SET(ALL_SOURCES ${ALL_SOURCES} ${TEMP_FILES}) - - ENDIF(QT_FOUND) - - - ################################################################# - ### ADDITIONAL_MAKE_CLEAN_FILES ### - ################################################################# - SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${GENERATED_FILES}") - - ################################################################# - ### EXCECUTABLE ### - ################################################################# - ADD_EXECUTABLE( ${EXECUTABLE_NAME} - ${ALL_SOURCES} - ) - - - ################################################################# - ### ADDITIONAL LINK PROPERTIES ### - ################################################################# - IF(CAB_ADDITIONAL_LINK_FLAGS) - SET_TARGET_PROPERTIES(${EXECUTABLE_NAME} PROPERTIES LINK_FLAGS ${CAB_ADDITIONAL_LINK_FLAGS}) - ENDIF(CAB_ADDITIONAL_LINK_FLAGS) - - ELSE(EXISTS ${SOURCE_ROOT}/basics) - MESSAGE("Set Path to \"source\" directory at\nSOURCE_ROOT\nis not correct") - ENDIF(EXISTS ${SOURCE_ROOT}/basics) -ELSE(EXISTS ${SOURCE_ROOT}) - SET(SOURCE_ROOT "CAB_DIR NOT FOUND" CACHE PATH "(e.g. d:/temp/source)" FORCE) - MESSAGE("Please Set Path to \"source\" directory at\nSOURCE_ROOT\n(e.g. D:/temp/source)") -ENDIF(EXISTS ${SOURCE_ROOT}) diff --git a/src/basics/geometry3d/examples/stl2inp/QDefineUniformMesh.cpp b/src/basics/geometry3d/examples/stl2inp/QDefineUniformMesh.cpp deleted file mode 100644 index 0676719cd..000000000 --- a/src/basics/geometry3d/examples/stl2inp/QDefineUniformMesh.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "./QDefineUniformMesh.h" -#include <QtGui/QFileDialog> -#include <QString> -#include <QFile> -#include <QMessageBox> -#include <cstdio> - - -QDefineUniformMesh::QDefineUniformMesh(QWidget *parent, Qt::WFlags flags) -{ - ui.setupUi(this); -} - -QDefineUniformMesh::~QDefineUniformMesh() -{ - -} diff --git a/src/basics/geometry3d/examples/stl2inp/QDefineUniformMesh.h b/src/basics/geometry3d/examples/stl2inp/QDefineUniformMesh.h deleted file mode 100644 index 0648b9ae2..000000000 --- a/src/basics/geometry3d/examples/stl2inp/QDefineUniformMesh.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef QDEFINEUNIFORMMESH_H -#define QDEFINEUNIFORMMESH_H - -#include <QtGui/QDialog> -#include "./QDefineUniformMeshUI.h" - -class QDefineUniformMesh : public QDialog -{ - Q_OBJECT - -public: - QDefineUniformMesh(QWidget *parent = 0, Qt::WFlags flags = 0); - ~QDefineUniformMesh(); - - void setStartLevel(int startLevel) { ui.spinBox_startLevel->setValue(startLevel); } - void setStopLevel(int stopLevel) { ui.spinBox_stopLevel->setValue(stopLevel); } - void setDelta(double delta) { ui.doubleSpinBox_delta->setValue(delta); } - void setNX1(int nx1) { ui.spinBox_nx1->setValue(nx1); } - void setNX2(int nx2) { ui.spinBox_nx2->setValue(nx2); } - void setNX3(int nx3) { ui.spinBox_nx3->setValue(nx3); } - - int getStartLevel() { return ui.spinBox_startLevel->value(); } - int getStopLevel() { return ui.spinBox_stopLevel->value(); } - double getDelta() { return ui.doubleSpinBox_delta->value(); } - int getNX1() { return ui.spinBox_nx1->value(); } - int getNX2() { return ui.spinBox_nx2->value(); } - int getNX3() { return ui.spinBox_nx3->value(); } - -private: - Ui::QDefineUniformMesh ui; - -//private slots: -}; - -#endif // QDEFINEUNIFORMMESH_H diff --git a/src/basics/geometry3d/examples/stl2inp/QDefineUniformMesh.ui b/src/basics/geometry3d/examples/stl2inp/QDefineUniformMesh.ui deleted file mode 100644 index c03b2513f..000000000 --- a/src/basics/geometry3d/examples/stl2inp/QDefineUniformMesh.ui +++ /dev/null @@ -1,258 +0,0 @@ -<ui version="4.0" > - <author></author> - <comment></comment> - <exportmacro></exportmacro> - <class>QDefineUniformMesh</class> - <widget class="QDialog" name="QDefineUniformMesh" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>180</width> - <height>220</height> - </rect> - </property> - <property name="windowTitle" > - <string>Define Mesh Parameters</string> - </property> - <layout class="QGridLayout" > - <property name="margin" > - <number>9</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="0" column="0" > - <layout class="QGridLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="1" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="label" > - <property name="toolTip" > - <string>Stop-Level der Verfeinerung</string> - </property> - <property name="text" > - <string>Stop-Level</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="spinBox_stopLevel" /> - </item> - </layout> - </item> - <item row="0" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="label_6" > - <property name="toolTip" > - <string>Start-Level der Verfeinerung</string> - </property> - <property name="text" > - <string>Start-Level</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="spinBox_startLevel" /> - </item> - </layout> - </item> - </layout> - </item> - <item row="1" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="label_2" > - <property name="toolTip" > - <string>Größe der Zellen</string> - </property> - <property name="text" > - <string>Delta</string> - </property> - </widget> - </item> - <item> - <widget class="QDoubleSpinBox" name="doubleSpinBox_delta" /> - </item> - </layout> - </item> - <item row="3" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" > - <size> - <width>131</width> - <height>31</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="okButton" > - <property name="text" > - <string>OK</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="cancelButton" > - <property name="text" > - <string>Cancel</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="2" column="0" > - <layout class="QVBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="label_3" > - <property name="toolTip" > - <string>Anzahl Zellen in X-Richtung</string> - </property> - <property name="text" > - <string>nx1</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="spinBox_nx1" /> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="label_4" > - <property name="toolTip" > - <string>Anzahl Zellen in Y-Richtung</string> - </property> - <property name="text" > - <string>nx2</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="spinBox_nx2" /> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="label_5" > - <property name="toolTip" > - <string>Anzahl Zellen in Z-Richtung</string> - </property> - <property name="text" > - <string>nx3</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="spinBox_nx3" /> - </item> - </layout> - </item> - </layout> - </item> - </layout> - </widget> - <pixmapfunction></pixmapfunction> - <resources/> - <connections> - <connection> - <sender>okButton</sender> - <signal>clicked()</signal> - <receiver>QDefineUniformMesh</receiver> - <slot>accept()</slot> - <hints> - <hint type="sourcelabel" > - <x>286</x> - <y>257</y> - </hint> - <hint type="destinationlabel" > - <x>96</x> - <y>254</y> - </hint> - </hints> - </connection> - <connection> - <sender>cancelButton</sender> - <signal>clicked()</signal> - <receiver>QDefineUniformMesh</receiver> - <slot>reject()</slot> - <hints> - <hint type="sourcelabel" > - <x>369</x> - <y>257</y> - </hint> - <hint type="destinationlabel" > - <x>179</x> - <y>282</y> - </hint> - </hints> - </connection> - </connections> -</ui> diff --git a/src/basics/geometry3d/examples/stl2inp/main.cpp b/src/basics/geometry3d/examples/stl2inp/main.cpp deleted file mode 100644 index 70f49c728..000000000 --- a/src/basics/geometry3d/examples/stl2inp/main.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include <iostream> -#include <cstdlib> - -#include <QtGui/QApplication> -#include "./stl2inp.h" - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - STL2INP w; - - w.show(); - a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); - return a.exec(); -} diff --git a/src/basics/geometry3d/examples/stl2inp/stl2inp.cpp b/src/basics/geometry3d/examples/stl2inp/stl2inp.cpp deleted file mode 100644 index d925c2b3c..000000000 --- a/src/basics/geometry3d/examples/stl2inp/stl2inp.cpp +++ /dev/null @@ -1,261 +0,0 @@ -#include "stl2inp.h" -#include <QtGui/QFileDialog> -#include <QString> -#include <QFile> -#include <QMessageBox> -#include <cstdio> - -#include "./QDefineUniformMesh.h" - -#include "./../../../../../source/basics/utilities/UbFileInputASCII.h" -#include "./../../../../../source/basics/utilities/UbFileOutputASCII.h" -#include "./../../../../../source/basics/utilities/UbFileOutputBinary.h" -#include "./../../../../../source/geometry3d/GbTriangularMesh3D.h" -#include "./../../../../../source/geometry3d/creator/GbTriangularMesh3DCreator.h" -#include "./../../../../../source/geometry3D/CoordinateTransformation3D.h" -#include "./../../../../../source/basics/utilities/UbTiming.h" -#include "./../../../../../source/octree/facette/OctFacettenGrid2.h" - -STL2INP::STL2INP(QWidget *parent, Qt::WFlags flags) -: QMainWindow(parent, flags) -{ - ui.setupUi(this); - startLevel = 0; - stopLevel = 3; - delta = 10.00; - nx1 = 30; - nx2 = 15; - nx3 = 5; - -} - -STL2INP::~STL2INP() -{ - -} - -void STL2INP::on_pBtn_Input_pressed() -{ - QString s = QFileDialog::getOpenFileName( - this, - "Choose a file", - "E:/", - "STL-Files (*.stl)"); - if(s != ""){ - ui.lineEdit_In->setText(s); - ui.statusBar->showMessage("Input-File: Filename defined", 3000); - } - else - ui.statusBar->showMessage("Input-File: No file found", 3000); - -} - -void STL2INP::on_lineEdit_In_returnPressed(){ - QString s = ui.lineEdit_In->text(); - if(s != ""){ - if(!s.endsWith(".stl",Qt::CaseSensitivity(false))) - { - s.append(".stl"); - ui.lineEdit_In->setText(s); - } - if(QFile::exists(s)) - ui.statusBar->showMessage("Inputput-File: File found", 3000); - else - ui.statusBar->showMessage("Input-File: File does not exist", 3000); - } - else - ui.statusBar->showMessage("Input-File: no Filename", 3000); -} - -void STL2INP::on_pBtn_Output_pressed(){ - QString s = QFileDialog::getSaveFileName( - this, - "Choose a filename to save under", - "E:/", - "AVS-File (*.inp)"); - if(s != ""){ - ui.lineEdit_Out->setText(s); - ui.statusBar->showMessage("Output-File: Filename defined", 3000); - } - else - ui.statusBar->showMessage("Output-File: No file defined", 3000); -} - -void STL2INP::on_lineEdit_Out_returnPressed(){ - QString s = ui.lineEdit_Out->text(); - if(s != ""){ - if(!s.endsWith(".inp",Qt::CaseSensitivity(false))) - { - s.append(".inp"); - ui.lineEdit_Out->setText(s); - } - if (QFile::exists(s)) - if(QMessageBox::question(this, - tr("Overwrite File? -- Application Name"), - tr("A file called %1 already exists." - "Do you want to overwrite it?") - .arg(s), - tr("&Yes"), tr("&No"), - QString(), 0, 1)) - ui.lineEdit_Out->setText(""); - else - ui.statusBar->showMessage("Output-File: overwrite existing File", 3000); - else - ui.statusBar->showMessage("Output-File: Filename defined", 3000); - } - else - ui.statusBar->showMessage("Output-File: No file defined", 3000); -} - -void STL2INP::on_pBtn_Output_2_pressed(){ - QString s = QFileDialog::getSaveFileName( - this, - "Choose a filename to save under", - "E:/", - "Data-File (*.dat)"); - if(s != ""){ - ui.pBtn_EditMesh->setEnabled(true); - ui.lineEdit_Out_2->setText(s); - ui.statusBar->showMessage("Output-File: Filename defined", 3000); - on_pBtn_EditMesh_pressed(); - } - else - ui.statusBar->showMessage("Output-File: No file defined", 3000); -} - -void STL2INP::on_lineEdit_Out_2_returnPressed(){ - QString s = ui.lineEdit_Out_2->text(); - if(s != ""){ - ui.pBtn_EditMesh->setEnabled(true); - if(!s.endsWith(".dat",Qt::CaseSensitivity(false))) - { - s.append(".dat"); - ui.lineEdit_Out_2->setText(s); - } - if (QFile::exists(s)) - if(QMessageBox::question(this, - tr("Overwrite File? -- Application Name"), - tr("A file called %1 already exists." - "Do you want to overwrite it?") - .arg(s), - tr("&Yes"), tr("&No"), - QString(), 0, 1)){ - ui.lineEdit_Out_2->setText(""); - ui.pBtn_EditMesh->setEnabled(false); - } - else{ - ui.statusBar->showMessage("Output-File: overwrite existing File", 3000); - ui.pBtn_EditMesh->setEnabled(true); - } - else{ - ui.statusBar->showMessage("Output-File: Filename defined", 3000); - on_pBtn_EditMesh_pressed(); - } - } - else - ui.statusBar->showMessage("Output-File: No file defined", 3000); -} - -void STL2INP::on_pBtn_Convert_pressed(){ - if(ui.lineEdit_In->text() == "") - QMessageBox::warning(this,"ERROR", "No Input-File defined!", - QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); - else if(ui.lineEdit_Out->text() == "" && ui.lineEdit_Out_2->text() == "") - QMessageBox::warning(this,"ERROR", "No Output-File defined!", - QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); - else - { - UbFileInputASCII *fileInput = new UbFileInputASCII(std::string(ui.lineEdit_In->text().toAscii())); - GbTriangularMesh3D *mesh = GbTriangularMesh3DCreator::readMeshFromSTLFile(fileInput, "Cube"); - ui.statusBar->showMessage("Input-File was read", 3000); - delete fileInput; - cout<<mesh->toString()<<endl; - if(ui.checkBox_writeAVS->isChecked()){ - if(ui.checkBox_Binary->isChecked()){ - UbFileOutputBinary *fileOutput_AVS = new UbFileOutputBinary(std::string(ui.lineEdit_Out->text().toAscii())); - mesh->writeAVSMesh(fileOutput_AVS); - delete fileOutput_AVS; - } - else{ - UbFileOutputASCII *fileOutput_AVS = new UbFileOutputASCII(std::string(ui.lineEdit_Out->text().toAscii())); - mesh->writeAVSMesh(fileOutput_AVS); - delete fileOutput_AVS; - } - ui.statusBar->showMessage("wrote AVS-Output-File"); - } - if(ui.checkBox_writeUM->isChecked()){ - cout<<"MinX:"<<mesh->getX1Minimum()<<endl; - cout<<"MaxX:"<<mesh->getX1Maximum()<<endl; - cout<<"MinY:"<<mesh->getX2Minimum()<<endl; - cout<<"MaxY:"<<mesh->getX2Maximum()<<endl; - cout<<"MinZ:"<<mesh->getX3Minimum()<<endl; - cout<<"MaxZ:"<<mesh->getX3Maximum()<<endl; - ui.statusBar->showMessage("start Writing Uniform-Mesh-File"); - double minX = 0.0; - double minY = 0.0; - double minZ = 0.0; - - CoordinateTransformation3D *trafo = new CoordinateTransformation3D(minX, minY, minZ, delta, delta, delta); - - UbTiming time; - time.initTiming(); - time.startTiming(); - - ui.statusBar->showMessage("start Building FacetteGrid", 3000); - OctFacettenGrid2 *facettegrid = new OctFacettenGrid2("FacettenGrid", nx1, nx2, nx3, startLevel, stopLevel, mesh, trafo); - ui.statusBar->showMessage("end Building FacetteGrid", 3000); - - UbFileOutputASCII out("E:/DATA/test.inp"); - facettegrid->writeCellsToAVS(&out); - - time.endTiming(); - cout<<"Dauer:"<<time.getDuration()<<endl; - cout<<"Number of cells:"<<facettegrid->getNumberOfCells()<<endl; - cout<<"after generation ..."<<endl<<endl; - double mydouble=0.0; - - time.initTiming(); - time.startTiming(); - ui.statusBar->showMessage("start writing", 3000); - UbFileOutputASCII *fileOutput_UM = new UbFileOutputASCII(std::string(ui.lineEdit_Out_2->text().toAscii())); - facettegrid->writeToUniformGridFile2(fileOutput_UM); - delete fileOutput_UM; - time.endTiming(); - cout<<"Dauer:"<<time.getDuration()<<endl; - int number = (int)facettegrid->getCells()->size(); - delete trafo; - delete mesh; - delete facettegrid; - cout<<"Ready!!!"<<endl; - ui.statusBar->showMessage("wrote Unstructured-Mesh Output-File", 3000); - } - } -} - -void STL2INP::on_checkBox_stateChanged(int) -{ - -} - -void STL2INP::on_pBtn_EditMesh_pressed() -{ - QDefineUniformMesh *meshdef = new QDefineUniformMesh(this); - meshdef->setStartLevel(startLevel); - meshdef->setStopLevel(stopLevel); - meshdef->setDelta(delta); - meshdef->setNX1(nx1); - meshdef->setNX2(nx2); - meshdef->setNX3(nx3); - meshdef->exec(); - - startLevel = meshdef->getStartLevel(); - stopLevel = meshdef->getStopLevel(); - //cout<<"Start-Level: "<<startLevel<<" Stop-Level: "<<stopLevel<<endl; - delta = meshdef->getDelta(); - //cout<<"Delta: "<<delta<<endl; - nx1 = meshdef->getNX1(); - nx2 = meshdef->getNX2(); - nx3 = meshdef->getNX3(); - //cout<<"nx1: "<<nx1<<" nx2: "<<nx2<<" nx3: "<<nx3<<endl; - delete meshdef; -} \ No newline at end of file diff --git a/src/basics/geometry3d/examples/stl2inp/stl2inp.h b/src/basics/geometry3d/examples/stl2inp/stl2inp.h deleted file mode 100644 index 353f2a2a7..000000000 --- a/src/basics/geometry3d/examples/stl2inp/stl2inp.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef STL2INP_H -#define STL2INP_H - -#include <QtGui/QMainWindow> -#include <QtGui/QProgressBar> -#include <QTimer> -#include "stl2inpUI.h" - -class STL2INP : public QMainWindow -{ - Q_OBJECT - -public: - STL2INP(QWidget *parent = 0, Qt::WFlags flags = 0); - ~STL2INP(); - - int startLevel, stopLevel; - double delta; - int nx1, nx2, nx3; - -private: - Ui::STL2INPClass ui; - - private slots: - void on_checkBox_stateChanged(int); - void on_pBtn_Input_pressed(); - void on_pBtn_Output_pressed(); - void on_pBtn_Output_2_pressed(); - void on_pBtn_Convert_pressed(); - void on_lineEdit_In_returnPressed(); - void on_lineEdit_Out_returnPressed(); - void on_lineEdit_Out_2_returnPressed(); - void on_pBtn_EditMesh_pressed(); -}; - -#endif // STL2INP_H diff --git a/src/basics/geometry3d/examples/stl2inp/stl2inp.ui b/src/basics/geometry3d/examples/stl2inp/stl2inp.ui deleted file mode 100644 index 28d3ab49c..000000000 --- a/src/basics/geometry3d/examples/stl2inp/stl2inp.ui +++ /dev/null @@ -1,452 +0,0 @@ -<ui version="4.0" > - <author></author> - <comment></comment> - <exportmacro></exportmacro> - <class>STL2INPClass</class> - <widget class="QMainWindow" name="STL2INPClass" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>400</width> - <height>350</height> - </rect> - </property> - <property name="windowTitle" > - <string>STL2INP</string> - </property> - <property name="statusTip" > - <string>...</string> - </property> - <widget class="QWidget" name="centralWidget" > - <layout class="QGridLayout" > - <property name="margin" > - <number>9</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="4" column="0" colspan="2" > - <widget class="QGroupBox" name="groupBox_2" > - <property name="title" > - <string>Output-Files</string> - </property> - <layout class="QGridLayout" > - <property name="margin" > - <number>9</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="0" column="0" > - <widget class="QCheckBox" name="checkBox_writeAVS" > - <property name="text" > - <string>write AVS-File</string> - </property> - </widget> - </item> - <item row="0" column="1" colspan="3" > - <widget class="QCheckBox" name="checkBox_Binary" > - <property name="text" > - <string>write *.inp to Binary</string> - </property> - </widget> - </item> - <item row="4" column="0" > - <widget class="QCheckBox" name="checkBox_writeUM" > - <property name="text" > - <string>write Uniform-Mesh-File</string> - </property> - </widget> - </item> - <item row="1" column="0" colspan="3" > - <widget class="QLineEdit" name="lineEdit_Out" > - <property name="enabled" > - <bool>false</bool> - </property> - <property name="minimumSize" > - <size> - <width>300</width> - <height>17</height> - </size> - </property> - </widget> - </item> - <item row="5" column="3" > - <widget class="QPushButton" name="pBtn_Output_2" > - <property name="enabled" > - <bool>false</bool> - </property> - <property name="maximumSize" > - <size> - <width>25</width> - <height>23</height> - </size> - </property> - <property name="text" > - <string>...</string> - </property> - </widget> - </item> - <item row="5" column="0" colspan="3" > - <widget class="QLineEdit" name="lineEdit_Out_2" > - <property name="enabled" > - <bool>false</bool> - </property> - <property name="minimumSize" > - <size> - <width>300</width> - <height>17</height> - </size> - </property> - </widget> - </item> - <item row="1" column="3" > - <widget class="QPushButton" name="pBtn_Output" > - <property name="enabled" > - <bool>false</bool> - </property> - <property name="maximumSize" > - <size> - <width>25</width> - <height>23</height> - </size> - </property> - <property name="text" > - <string>...</string> - </property> - </widget> - </item> - <item rowspan="2" row="2" column="0" colspan="4" > - <widget class="Line" name="line" > - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item rowspan="2" row="3" column="2" colspan="2" > - <widget class="QPushButton" name="pBtn_EditMesh" > - <property name="enabled" > - <bool>false</bool> - </property> - <property name="minimumSize" > - <size> - <width>51</width> - <height>20</height> - </size> - </property> - <property name="maximumSize" > - <size> - <width>51</width> - <height>20</height> - </size> - </property> - <property name="text" > - <string>Edit Mesh</string> - </property> - </widget> - </item> - <item row="4" column="1" > - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - </item> - <item row="0" column="0" > - <widget class="QLabel" name="label_3" > - <property name="font" > - <font> - <family>Tahoma</family> - <pointsize>14</pointsize> - <weight>75</weight> - <italic>false</italic> - <bold>true</bold> - <underline>false</underline> - <strikeout>false</strikeout> - </font> - </property> - <property name="text" > - <string>STL2INP</string> - </property> - </widget> - </item> - <item row="1" column="0" > - <spacer> - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" > - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="6" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QPushButton" name="pushButton_4" > - <property name="text" > - <string>EXIT</string> - </property> - </widget> - </item> - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="pBtn_Convert" > - <property name="text" > - <string>Convert</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="5" column="0" > - <spacer> - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" > - <size> - <width>20</width> - <height>21</height> - </size> - </property> - </spacer> - </item> - <item row="2" column="0" > - <widget class="QGroupBox" name="groupBox" > - <property name="title" > - <string>Input-File</string> - </property> - <layout class="QGridLayout" > - <property name="margin" > - <number>9</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="0" column="1" > - <widget class="QPushButton" name="pBtn_Input" > - <property name="maximumSize" > - <size> - <width>25</width> - <height>23</height> - </size> - </property> - <property name="text" > - <string>...</string> - </property> - </widget> - </item> - <item row="0" column="0" > - <widget class="QLineEdit" name="lineEdit_In" > - <property name="minimumSize" > - <size> - <width>300</width> - <height>17</height> - </size> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="3" column="0" > - <spacer> - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" > - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <widget class="QStatusBar" name="statusBar" > - <property name="geometry" > - <rect> - <x>0</x> - <y>331</y> - <width>400</width> - <height>19</height> - </rect> - </property> - </widget> - </widget> - <layoutdefault spacing="6" margin="11" /> - <pixmapfunction></pixmapfunction> - <tabstops> - <tabstop>lineEdit_In</tabstop> - <tabstop>pBtn_Input</tabstop> - <tabstop>lineEdit_Out</tabstop> - <tabstop>pBtn_Output</tabstop> - <tabstop>checkBox_Binary</tabstop> - <tabstop>pBtn_Convert</tabstop> - <tabstop>pushButton_4</tabstop> - </tabstops> - <resources/> - <connections> - <connection> - <sender>pushButton_4</sender> - <signal>clicked()</signal> - <receiver>STL2INPClass</receiver> - <slot>close()</slot> - <hints> - <hint type="sourcelabel" > - <x>82</x> - <y>320</y> - </hint> - <hint type="destinationlabel" > - <x>222</x> - <y>349</y> - </hint> - </hints> - </connection> - <connection> - <sender>checkBox_writeAVS</sender> - <signal>clicked(bool)</signal> - <receiver>lineEdit_Out</receiver> - <slot>setEnabled(bool)</slot> - <hints> - <hint type="sourcelabel" > - <x>43</x> - <y>189</y> - </hint> - <hint type="destinationlabel" > - <x>99</x> - <y>210</y> - </hint> - </hints> - </connection> - <connection> - <sender>checkBox_writeAVS</sender> - <signal>clicked(bool)</signal> - <receiver>pBtn_Output</receiver> - <slot>setEnabled(bool)</slot> - <hints> - <hint type="sourcelabel" > - <x>130</x> - <y>189</y> - </hint> - <hint type="destinationlabel" > - <x>380</x> - <y>209</y> - </hint> - </hints> - </connection> - <connection> - <sender>checkBox_writeUM</sender> - <signal>clicked(bool)</signal> - <receiver>lineEdit_Out_2</receiver> - <slot>setEnabled(bool)</slot> - <hints> - <hint type="sourcelabel" > - <x>74</x> - <y>237</y> - </hint> - <hint type="destinationlabel" > - <x>88</x> - <y>258</y> - </hint> - </hints> - </connection> - <connection> - <sender>checkBox_writeUM</sender> - <signal>clicked(bool)</signal> - <receiver>pBtn_Output_2</receiver> - <slot>setEnabled(bool)</slot> - <hints> - <hint type="sourcelabel" > - <x>152</x> - <y>237</y> - </hint> - <hint type="destinationlabel" > - <x>380</x> - <y>257</y> - </hint> - </hints> - </connection> - <connection> - <sender>lineEdit_In</sender> - <signal>selectionChanged()</signal> - <receiver>pBtn_Input</receiver> - <slot>animateClick()</slot> - <hints> - <hint type="sourcelabel" > - <x>236</x> - <y>105</y> - </hint> - <hint type="destinationlabel" > - <x>345</x> - <y>98</y> - </hint> - </hints> - </connection> - <connection> - <sender>lineEdit_Out</sender> - <signal>selectionChanged()</signal> - <receiver>pBtn_Output</receiver> - <slot>animateClick()</slot> - <hints> - <hint type="sourcelabel" > - <x>302</x> - <y>203</y> - </hint> - <hint type="destinationlabel" > - <x>362</x> - <y>202</y> - </hint> - </hints> - </connection> - <connection> - <sender>lineEdit_Out_2</sender> - <signal>selectionChanged()</signal> - <receiver>pBtn_Output_2</receiver> - <slot>animateClick()</slot> - <hints> - <hint type="sourcelabel" > - <x>256</x> - <y>249</y> - </hint> - <hint type="destinationlabel" > - <x>365</x> - <y>253</y> - </hint> - </hints> - </connection> - </connections> -</ui> diff --git a/src/basics/geometry3d/fem/FeAdhocTriFaceMesh3D.cpp b/src/basics/geometry3d/fem/FeAdhocTriFaceMesh3D.cpp deleted file mode 100644 index 86b7cc239..000000000 --- a/src/basics/geometry3d/fem/FeAdhocTriFaceMesh3D.cpp +++ /dev/null @@ -1,124 +0,0 @@ -#include "./FeAdhocTriFaceMesh3D.h" - -#include "./../GbPoint3D.h" -#include "./../GbTriangle3D.h" -#include "./../GbTriangularMesh3D.h" - -#include "./../../../basics/utilities/UbFileOutputASCII.h" -#include "./../../../basics/utilities/UbLogger.h" - -/*====================================================*/ -FeAdhocTriFaceMesh3D::FeAdhocTriFaceMesh3D():FeTriFaceMesh3D() -{ -} -/*====================================================*/ -FeAdhocTriFaceMesh3D::FeAdhocTriFaceMesh3D(std::string name, Mesh* mesh):FeTriFaceMesh3D() -{ - this->mesh = mesh; - this->setName(name); - - std::cout << "FeAdhocTriFaceMesh3D:Konstruktor !!!"<<std::endl; - std::cout << "num vertices: " << mesh->VL->nitem << ", num triangles: " << mesh->TL->nitem - << ", num quads: " << mesh->QL->nitem << std::endl; - - // this->writeAdhoCMeshForStefan("/scratch/geller/StudienMitAdhoC3D/mesh.inp"); - this->adhocVertices = new vector< ::Vertex*>; - - List *vertexlist = mesh->VL; - List *elementlist = mesh->TL; - - ListItem* LI; - ListItem* LI2; - Tri* triangle; - // double z1, z2, z3; - int id1, id2, id3; - ::Vertex *v1, *v2, *v3; - - //if (mesh->VL->status==open) close_Vertex_List(mesh->VL); - - FOR_ALL(vertexlist->first, LI, 0) - { - ::Vertex* V = get_Vertex(LI); - this->nodes->push_back(GbTriFaceMesh3D::Vertex((float)V->x, (float)V->y, (float)V->z)); - this->adhocVertices->push_back(V); - } - int countTris=0; - int fred=0; - FOR_ALL(elementlist->first, LI, 0) - { - triangle = get_Tri(LI); - if(triangle==NULL) UBLOG(logINFO, "hugo - dreieck ist NULL"); - v1 = triangle->V[0]; - v2 = triangle->V[1]; - v3 = triangle->V[2]; - int count=0; - id1=-1; id2=-1; id3=-1; - FOR_ALL(vertexlist->first, LI2, 0) - { - ::Vertex* V = get_Vertex(LI2); - if(v1==V) id1=count; - if(v2==V) id2=count; - if(v3==V) id3=count; - if((id1!=-1) && (id2!=-1) && (id3!=-1)) - { - break; - } - count++; - } - // this->triangles->push_back(GbTriFaceMesh3D::TriFace(v1->id, v2->id, v3->id)); - // das geht bei Winkelplatte und Bathe - this->triangles->push_back(GbTriFaceMesh3D::TriFace(id2, id1, id3)); - // this->triangles->push_back(GbTriFaceMesh3D::TriFace(id1, id2, id3)); - countTris++; - } - - std::cout<<"#################################"<<std::endl; - std::cout<<"countTris:"<<countTris<<std::endl; - std::cout<<"vecSize:"<<this->triangles->size()<<std::endl; - this->attributes->resize(nodes->size()); - - countTris=0; - for(int u=0;u<(int)this->triangles->size(); u++) - { - double area = (*this->triangles)[u].getArea(*this->nodes); - if(UbMath::zero(area)) countTris++; - } - std::cout<<"#################################"<<std::endl; - std::cout<<"Area 0 für:"<<countTris<<" Dreiecke"<<std::endl; - - this->calculateValues(); - - this->createVertexTriFaceMap(); -} -/*===============================================================================*/ -void FeAdhocTriFaceMesh3D::writeAdhoCMeshForStefan(string filename) -{ - std::cout << "FeAdhocTriFaceMesh3D::writeAdhoCMeshForStefan ...\n"; - List *elementlist = mesh->TL; - - ListItem* LI; - Tri* triangle; - - vector<GbPoint3D*>* tmnodes = new vector<GbPoint3D*>; - vector<GbTriangle3D*>* tmtriangles = new vector<GbTriangle3D*>; - - FOR_ALL(elementlist->first, LI, 0) - { - triangle = get_Tri(LI); - - GbPoint3D *node1 = new GbPoint3D(triangle->V[0]->x, triangle->V[0]->y, triangle->V[0]->z); - GbPoint3D *node2 = new GbPoint3D(triangle->V[1]->x, triangle->V[1]->y, triangle->V[1]->z); - GbPoint3D *node3 = new GbPoint3D(triangle->V[2]->x, triangle->V[2]->y, triangle->V[2]->z); - - tmnodes->push_back(node1); - tmnodes->push_back(node2); - tmnodes->push_back(node3); - tmtriangles->push_back(new GbTriangle3D(node1, node2, node3)); - - } - - GbTriangularMesh3D tmmesh("Name", tmnodes, tmtriangles); - UbFileOutputASCII out(filename); - tmmesh.writeAVSMesh(&out); -} - diff --git a/src/basics/geometry3d/fem/FeAdhocTriFaceMesh3D.h b/src/basics/geometry3d/fem/FeAdhocTriFaceMesh3D.h deleted file mode 100644 index 99a0a983f..000000000 --- a/src/basics/geometry3d/fem/FeAdhocTriFaceMesh3D.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef FEADHOCTRIFACEMESH3D_H -#define FEADHOCTRIFACEMESH3D_H - -#include <sstream> -#include <iostream> -#include <vector> -using namespace std; - -//extern "C" -//{ - //#include "mshpi.h" - #include "fsi_interface.h" - #include "fsi_user_interface.h" -//} - -#include "./FeTriFaceMesh3D.h" - -#ifdef CAB_RCF -#include <3rdParty/rcf/RcfSerializationIncludes.h> -#endif //CAB_RCF - - -/*=========================================================================*/ -/* FeAdhocTriFaceMesh3D */ -/* */ -/** - * This Class provides the triangular meshes. - * Note, that up to now no methods for checking consistency are included. - * in this context this class describes facettes from an 3D-object !!! -*/ -class FeAdhocTriFaceMesh3D : public FeTriFaceMesh3D -{ -public: - FeAdhocTriFaceMesh3D(); - FeAdhocTriFaceMesh3D(std::string name, Mesh *mesh); - - Mesh* getMesh() { return mesh; } - - void writeAdhoCMeshForStefan(string filename); - std::vector< ::Vertex*>* getAdhocVertices() { return this->adhocVertices; } - -#ifdef CAB_RCF - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - serializeParent<FeTriFaceMesh3D>(ar, *this); - } -#endif //CAB_RCF - -private: - Mesh* mesh; - std::vector< ::Vertex*>* adhocVertices; -}; - -#ifdef RCF_USE_SF_SERIALIZATION -UB_AUTO_RUN_NAMED( SF::registerType<FeAdhocTriFaceMesh3D >("FeAdhocTriFaceMesh3D ") , SF_FeAdhocTriFaceMesh3D ); -UB_AUTO_RUN_NAMED( ( SF::registerBaseAndDerived< FeTriFaceMesh3D, FeAdhocTriFaceMesh3D>() ), SF_FeAdhocTriFaceMesh3D_BD1 ); -UB_AUTO_RUN_NAMED( ( SF::registerBaseAndDerived< GbTriFaceMesh3D, FeAdhocTriFaceMesh3D>() ), SF_FeAdhocTriFaceMesh3D_BD2 ); -UB_AUTO_RUN_NAMED( ( SF::registerBaseAndDerived< GbObject3D, FeAdhocTriFaceMesh3D>() ), SF_FeAdhocTriFaceMesh3D_BD3 ); -#endif //RCF_USE_SF_SERIALIZATION - -#endif //FEADHOCTRIFACEMESH3D_H diff --git a/src/basics/geometry3d/fem/FeHalfDisc3D.cpp b/src/basics/geometry3d/fem/FeHalfDisc3D.cpp deleted file mode 100644 index 0ee0c1752..000000000 --- a/src/basics/geometry3d/fem/FeHalfDisc3D.cpp +++ /dev/null @@ -1,622 +0,0 @@ -#include <geometry3d/fem/FeHalfDisc3D.h> -#include <geometry3d/GbSystem3D.h> -#include <geometry3d/GbLine3D.h> -#include <geometry3d/GbTriangle3D.h> -#include <geometry3d/fem/FePoint3D.h> -#include <basics/utilities/UbInfinity.h> - -using namespace std; - -/*=======================================================*/ -ObObjectCreator* FeHalfDisc3D::getCreator() -{ - return NULL;//FeHalfDisc3DCreator::getInstance(); -} -// Konstruktor -/*==========================================================*/ -FeHalfDisc3D::FeHalfDisc3D() -{ - GbPoint3D* p1 = new GbPoint3D(); - GbPoint3D* p2 = new GbPoint3D(); - mLine = new GbLine3D(p1,p2); - this->mLine->addObserver(this); - mRad = 0.0; - cylinderType = FeHalfDisc3D::NOTPARALLELTOAXIS; -} -/*=======================================================*/ -FeHalfDisc3D::FeHalfDisc3D(FeHalfDisc3D* cylinder) -{ - mRad = cylinder->getRadius(); - cylinderType = cylinder->cylinderType; - mLine = cylinder->getLine()->clone(); - - this->mLine->addObserver(this); -} -/*==========================================================*/ -FeHalfDisc3D::FeHalfDisc3D(const double& x1a,const double& x2a, const double& x3a, const double& x1b,const double& x2b, const double& x3b, const double& rad) -{ - mLine = new GbLine3D; - mLine->setPoints( new GbPoint3D(min(x1a,x1b), min(x2a,x2b), min(x3a,x3b)) - ,new GbPoint3D(max(x1a,x1b), max(x2a,x2b), max(x3a,x3b))); - this->mLine->addObserver(this); - mRad = fabs(rad); - - this->initCylinderType(); - if((this->cylinderType & NOTPARALLELTOAXIS)==NOTPARALLELTOAXIS) - throw UbException(UB_EXARGS,"derzeit nur zu Achsen orthogonale Cylinder erlaubt... isPointInObject3D funzt sonst ned"); -} -/*==========================================================*/ -FeHalfDisc3D::FeHalfDisc3D(GbPoint3D* p1, GbPoint3D* p2, const double& rad) -{ - mRad = rad; - - mLine = new GbLine3D(p1,p2); - this->mLine->addObserver(this); - this->initCylinderType(); - if((this->cylinderType & NOTPARALLELTOAXIS)==NOTPARALLELTOAXIS) - throw UbException(UB_EXARGS,"derzeit nur zu Achsen orthogonale Cylinder erlaubt... isPointInObject3D funzt sonst ned"); -} -/*==========================================================*/ -FeHalfDisc3D::FeHalfDisc3D(GbLine3D* line, const double& rad) -{ - mRad = rad; - - this->mLine = line; - this->mLine->addObserver(this); - this->initCylinderType(); - if((this->cylinderType & NOTPARALLELTOAXIS)==NOTPARALLELTOAXIS) - throw UbException(UB_EXARGS,"derzeit nur zu Achsen orthogonale Cylinder erlaubt... isPointInObject3D funzt sonst ned"); -} -/*==========================================================*/ -// Destruktor -FeHalfDisc3D::~FeHalfDisc3D() -{ - if(mLine) this->mLine->removeObserver(this); - mLine = NULL; -} -/*=======================================================*/ -void FeHalfDisc3D::initCylinderType() -{ - double x1a = mLine->getPoint1()->x1; double x1b = mLine->getPoint2()->x1; - double x2a = mLine->getPoint1()->x2; double x2b = mLine->getPoint2()->x2; - double x3a = mLine->getPoint1()->x3; double x3b = mLine->getPoint2()->x3; - - if (x1a!=x1b && x2a==x2b && x3a==x3b) this->cylinderType = X1PARALLEL; - else if(x2a!=x2b && x1a==x1b && x3a==x3b) this->cylinderType = X2PARALLEL; - else if(x3a!=x3b && x1a==x1b && x2a==x2b) this->cylinderType = X3PARALLEL; - else this->cylinderType = NOTPARALLELTOAXIS; -} -/*=======================================================*/ -void FeHalfDisc3D::finalize() -{ - if(this->mLine) - { - mLine->finalize(); - delete mLine; - mLine=NULL; - } -} -/*=======================================================*/ -double FeHalfDisc3D::getHeight() -{ - if(mLine) return mLine->getLength(); return 0.0; -} -/*=======================================================*/ -GbPoint3D* FeHalfDisc3D::getPoint1() -{ - if(this->mLine) return this->mLine->getPoint1(); - return NULL; -} -/*=======================================================*/ -GbPoint3D* FeHalfDisc3D::getPoint2() -{ - if(this->mLine) return this->mLine->getPoint2(); - return NULL; -} -/*=======================================================*/ -void FeHalfDisc3D::setRadius(const double& radius) -{ - this->mRad = std::fabs(radius); - this->notifyObserversObjectChanged(); -} -/*=======================================================*/ -void FeHalfDisc3D::setLine(GbLine3D* line) -{ - if(this->mLine) this->mLine->removeObserver(this); - this->mLine = line; - this->mLine->addObserver(this); - this->initCylinderType(); - - this->notifyObserversObjectChanged(); -} -/*=======================================================*/ -void FeHalfDisc3D::setPoint1(const double& x1, const double& x2, const double& x3) -{ - if(!mLine->getPoint1()) throw UbException(UB_EXARGS,"line has no point1"); - mLine->getPoint1()->setCoordinates(x1,x2,x3); - this->initCylinderType(); - - //this->notifyObserversObjectChanged(); //wird automatisch aufgerufen, da der point (this) benachrichtigt... -} -/*=======================================================*/ -void FeHalfDisc3D::setPoint2(const double& x1, const double& x2, const double& x3) -{ - if(!mLine->getPoint2()) throw UbException(UB_EXARGS,"line has no point2"); - mLine->getPoint2()->setCoordinates(x1,x2,x3); - this->initCylinderType(); - - //this->notifyObserversObjectChanged(); //wird automatisch aufgerufen, da der point (this) benachrichtigt... -} -/*==========================================================*/ -double FeHalfDisc3D::getX1Centroid() -{ - return mLine->getX1Centroid(); -} -/*==========================================================*/ -double FeHalfDisc3D::getX1Minimum() -{ - if (this->isParallelToX1Axis()) return mLine->getX1Minimum(); - else if(this->isParallelToX2Axis()) return mLine->getX1Centroid()-mRad; - else if(this->isParallelToX3Axis()) return mLine->getX1Centroid()-mRad; - else throw UbException(UB_EXARGS,"derzeit nur zu Achsen orthogonale Cylinder erlaubt... isPointInObject3D funzt sonst ned"); -} -/*==========================================================*/ -double FeHalfDisc3D::getX1Maximum() -{ - if (this->isParallelToX1Axis()) return mLine->getX1Maximum(); - else if(this->isParallelToX2Axis()) return mLine->getX1Centroid()+mRad; - else if(this->isParallelToX3Axis()) return mLine->getX1Centroid()+mRad; - else throw UbException(UB_EXARGS,"derzeit nur zu Achsen orthogonale Cylinder erlaubt... isPointInObject3D funzt sonst ned"); -} -/*==========================================================*/ -double FeHalfDisc3D::getX2Centroid() -{ - return mLine->getX2Centroid(); -} -/*==========================================================*/ -double FeHalfDisc3D::getX2Minimum() -{ - if (this->isParallelToX1Axis()) return mLine->getX2Centroid()-mRad; - else if(this->isParallelToX2Axis()) return mLine->getX2Minimum(); - else if(this->isParallelToX3Axis()) return mLine->getX2Centroid()-mRad; - else throw UbException(UB_EXARGS,"derzeit nur zu Achsen orthogonale Cylinder erlaubt... isPointInObject3D funzt sonst ned"); -} -/*==========================================================*/ -double FeHalfDisc3D::getX2Maximum() -{ - if (this->isParallelToX1Axis()) return mLine->getX2Centroid()+mRad; - else if(this->isParallelToX2Axis()) return mLine->getX2Maximum(); - else if(this->isParallelToX3Axis()) return mLine->getX2Centroid()+mRad; - else throw UbException(UB_EXARGS,"derzeit nur zu Achsen orthogonale Cylinder erlaubt... isPointInObject3D funzt sonst ned"); -} -/*==========================================================*/ -double FeHalfDisc3D::getX3Centroid() -{ - return mLine->getX3Centroid(); -} -/*==========================================================*/ -double FeHalfDisc3D::getX3Minimum() -{ - if (this->isParallelToX1Axis()) return mLine->getX3Centroid()-mRad; - else if(this->isParallelToX2Axis()) return mLine->getX3Centroid()-mRad; - else if(this->isParallelToX3Axis()) return mLine->getX3Minimum(); - else throw UbException(UB_EXARGS,"derzeit nur zu Achsen orthogonale Cylinder erlaubt... isPointInObject3D funzt sonst ned"); -} -/*==========================================================*/ -double FeHalfDisc3D::getX3Maximum() -{ - if (this->isParallelToX1Axis()) return mLine->getX3Centroid()+mRad; - else if(this->isParallelToX2Axis()) return mLine->getX3Centroid()+mRad; - else if(this->isParallelToX3Axis()) return mLine->getX3Maximum(); - else throw UbException(UB_EXARGS,"derzeit nur zu Achsen orthogonale Cylinder erlaubt... isPointInObject3D funzt sonst ned"); -} -/*==========================================================*/ -bool FeHalfDisc3D::isPointInGbObject3D(const double& x1p, const double& x2p, const double& x3p) -{ - throw UbException(UB_EXARGS,"sollte mal einer machen ... "); -} -/*==========================================================*/ -bool FeHalfDisc3D::isPointInGbObject3D(const double& x1p, const double& x2p, const double& x3p, bool& pointIsOnBoundary) -{ - throw UbException(UB_EXARGS,"sollte mal einer machen ... "); -} -/*=======================================================*/ -bool FeHalfDisc3D::isCellInsideGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b) -{ - throw UbException(UB_EXARGS,"sollte mal einer machen ... "); -} - -/*==========================================================*/ -string FeHalfDisc3D::toString() -{ - stringstream ss; - ss<<"FeHalfDisc3D["; - ss<<"line="<<this->mLine->toString(); - ss<<", r="<<this->mRad; - ss<<"]"; - return(ss.str()); -} -/*==========================================================*/ -bool FeHalfDisc3D::isCellInsideOrCuttingGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b) -{ - throw UbException(UB_EXARGS,"sollte mal einer machen ... "); -} -/*==========================================================*/ -bool FeHalfDisc3D::isCellCuttingGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b) -{ - throw UbException(UB_EXARGS,"sollte mal einer machen ... "); -} -/*==========================================================*/ -GbLine3D* FeHalfDisc3D::createClippedLine3D(GbPoint3D& point1, GbPoint3D& point2) -{ - throw UbException(UB_EXARGS,"sollte mal einer machen ... "); -} -/*==========================================================*/ -vector<GbTriangle3D*> FeHalfDisc3D::getSurfaceTriangleSet() -{ - double x1ma,x1mb,x2m,x3m; - if( this->isParallelToX1Axis() ) - { - x1ma = this->getX1Minimum(); - x1mb = this->getX1Maximum(); - x2m = this->getX2Centroid(); - x3m = this->getX3Centroid(); - } - else if( this->isParallelToX2Axis() ) - { - x1ma = this->getX2Minimum(); - x1mb = this->getX2Maximum(); - x2m = this->getX1Centroid(); - x3m = this->getX3Centroid(); - } - else if( this->isParallelToX3Axis() ) - { - x1ma = this->getX3Minimum(); - x1mb = this->getX3Maximum(); - x2m = this->getX2Centroid(); - x3m = this->getX1Centroid(); - } - else throw UbException(UB_EXARGS,"cylinder is not axis prallel"); - - vector<GbTriangle3D*> triangles; - - int segmentsCircle = 14; - double deltaPhi = UbMath::PI/(double)segmentsCircle; - - double phiX1a,phiX1b; - double x1a,x2a,x3a,x1b,x2b,x3b,x1c,x2c,x3c,x1d,x2d,x3d; - - double dXCylinder = fabs((x1mb-x1ma)); ///(double)0.5; - int segmentsCylinder = (int)(fabs(x1mb-x1ma)/dXCylinder); - for(int segCyl = 0; segCyl<segmentsCylinder; segCyl++) - { - x1a = x1d = x1ma+segCyl*dXCylinder; - x1b = x1c = x1a+dXCylinder; - - for(phiX1a=UbMath::PI-deltaPhi; phiX1a>-deltaPhi; phiX1a-=deltaPhi) - { - phiX1b = phiX1a+deltaPhi; - - x2a = x2m+mRad*std::sin(phiX1a); - x3a = x3m+mRad*std::cos(phiX1a); - x2b = x2m+mRad*std::sin(phiX1b); - x3b = x3m+mRad*std::cos(phiX1b); - - if( this->isParallelToX1Axis() ) - { - triangles.push_back(new GbTriangle3D(new FePoint3D(x1b,x2a,x3a),new FePoint3D(x1b,x2b,x3b),new FePoint3D(x1a,x2a,x3a))); - triangles.push_back(new GbTriangle3D(new FePoint3D(x1a,x2b,x3b),new FePoint3D(x1a,x2a,x3a),new FePoint3D(x1b,x2b,x3b))); - } - else if( this->isParallelToX2Axis() ) - { - triangles.push_back(new GbTriangle3D(new FePoint3D(x2b,x1b,x3b),new FePoint3D(x2a,x1b,x3a),new FePoint3D(x2a,x1a,x3a))); - triangles.push_back(new GbTriangle3D(new FePoint3D(x2a,x1a,x3a),new FePoint3D(x2b,x1a,x3b),new FePoint3D(x2b,x1b,x3b))); - } - else if( this->isParallelToX3Axis() ) - { - triangles.push_back(new GbTriangle3D(new FePoint3D(x3b,x2b,x1b),new FePoint3D(x3a,x2a,x1b),new FePoint3D(x3a,x2a,x1a))); - triangles.push_back(new GbTriangle3D(new FePoint3D(x3a,x2a,x1a),new FePoint3D(x3b,x2b,x1a),new FePoint3D(x3b,x2b,x1b))); - } - - } - } - - x2a = x2m; - x3a = x3m; - x2d = x2m; - x3d = x3m+mRad; - x3b = x3m; - x3c = x3m-mRad; - - triangles.push_back(new GbTriangle3D(new FePoint3D(x1ma,x2a,x3a),new FePoint3D(x1mb,x2a,x3a),new FePoint3D(x1ma,x2a,x3d))); - triangles.push_back(new GbTriangle3D(new FePoint3D(x1ma,x2a,x3d),new FePoint3D(x1mb,x2a,x3a),new FePoint3D(x1mb,x2a,x3d))); - triangles.push_back(new GbTriangle3D(new FePoint3D(x1mb,x2a,x3b),new FePoint3D(x1ma,x2a,x3b),new FePoint3D(x1ma,x2a,x3c))); - triangles.push_back(new GbTriangle3D(new FePoint3D(x1mb,x2a,x3b),new FePoint3D(x1ma,x2a,x3c),new FePoint3D(x1mb,x2a,x3c))); - - for(phiX1a=UbMath::PI-deltaPhi; phiX1a>-deltaPhi; phiX1a-=deltaPhi) - { - phiX1b = phiX1a+deltaPhi; - - x2a = x2m; - x3a = x3m; - x2b = x2m; - x3b = x3m; - x2c = x2m+mRad*std::sin(phiX1b); - x3c = x3m+mRad*std::cos(phiX1b); - x2d = x2m+mRad*std::sin(phiX1a); - x3d = x3m+mRad*std::cos(phiX1a); - - if( this->isParallelToX1Axis() ) - { - triangles.push_back(new GbTriangle3D(new FePoint3D(x1ma,x2d,x3d),new FePoint3D(x1ma,x2c,x3c),new FePoint3D(x1ma,x2a,x3a))); - triangles.push_back(new GbTriangle3D(new FePoint3D(x1mb,x2d,x3d),new FePoint3D(x1mb,x2a,x3a),new FePoint3D(x1mb,x2c,x3c))); - } - else if( this->isParallelToX2Axis() ) - { - triangles.push_back(new GbTriangle3D(new FePoint3D(x2a,x1ma,x3a),new FePoint3D(x2b,x1ma,x3b),new FePoint3D(x2c,x1ma,x3c))); - triangles.push_back(new GbTriangle3D(new FePoint3D(x2c,x1ma,x3c),new FePoint3D(x2d,x1ma,x3d),new FePoint3D(x2a,x1ma,x3a))); - triangles.push_back(new GbTriangle3D(new FePoint3D(x2c,x1mb,x3c),new FePoint3D(x2b,x1mb,x3b),new FePoint3D(x2a,x1mb,x3a))); - triangles.push_back(new GbTriangle3D(new FePoint3D(x2a,x1mb,x3a),new FePoint3D(x2d,x1mb,x3d),new FePoint3D(x2c,x1mb,x3c))); - } - else if( this->isParallelToX3Axis() ) - { - triangles.push_back(new GbTriangle3D(new FePoint3D(x3a,x2a,x1ma),new FePoint3D(x3b,x2b,x1ma),new FePoint3D(x3c,x2c,x1ma))); - triangles.push_back(new GbTriangle3D(new FePoint3D(x3c,x2c,x1ma),new FePoint3D(x3d,x2d,x1ma),new FePoint3D(x3a,x2a,x1ma))); - triangles.push_back(new GbTriangle3D(new FePoint3D(x3c,x2c,x1mb),new FePoint3D(x3b,x2b,x1mb),new FePoint3D(x3a,x2a,x1mb))); - triangles.push_back(new GbTriangle3D(new FePoint3D(x3a,x2a,x1mb),new FePoint3D(x3d,x2d,x1mb),new FePoint3D(x3c,x2c,x1mb))); - } - } - - return triangles; -} -/*==========================================================*/ -void FeHalfDisc3D::objectChanged(UbObservable* changedObject) -{ - GbLine3D* line = dynamic_cast<GbLine3D*>(changedObject); - if(!line || this->mLine!=line) return; - - this->notifyObserversObjectChanged(); -} -/*==========================================================*/ -void FeHalfDisc3D::objectWillBeDeleted(UbObservable* objectForDeletion) -{ - if(this->mLine) - { - UbObservable* observedObj = dynamic_cast<UbObservable*>(this->mLine); - if(objectForDeletion == observedObj) { this->mLine = NULL; } - } -} -/*=======================================================*/ -void FeHalfDisc3D::scale(const double& sx1, const double& sx2, const double& sx3) -{ - if( this->isParallelToX1Axis() ) - { - if(!UbMath::equal(sx2,sx3)) throw UbException(UB_EXARGS,"|| to x1 -> different scaling sx2 and sx3 not possible"); - this->mRad*=sx2; - } - else if( this->isParallelToX2Axis() ) - { - if(!UbMath::equal(sx1,sx3)) throw UbException(UB_EXARGS,"|| to x2 -> different scaling sx1 and sx3 not possible"); - this->mRad*=sx1; - } - else if( this->isParallelToX3Axis() ) - { - if(!UbMath::equal(sx1,sx2)) throw UbException(UB_EXARGS,"|| to x3 -> different scaling sx1 and sx2 not possible"); - this->mRad*=sx1; - } - else throw UbException(UB_EXARGS,"unknown direction"); - - this->mLine->scale(sx1,sx2,sx3); - //notify observer wird automatisch aufgerufen -} -/*==========================================================*/ -void FeHalfDisc3D::write(UbFileOutput* out) -{ - out->writeString(this->getCreator()->getTypeID()); - mLine->write(out); - out->writeDouble(mRad); - out->writeInteger(cylinderType); -} -/*==========================================================*/ -void FeHalfDisc3D::read(UbFileInput* in) -{ - in->readString(); - mLine = new GbLine3D; - mLine->read(in); - mRad = in->readDouble(); - cylinderType = in->readInteger(); -} -/*==========================================================*/ -double FeHalfDisc3D::getIntersectionRaytraceFactor(const double& x1, const double& x2, const double& x3, const double& rx1, const double& rx2, const double& rx3) -{ - /* - Distance D of the intersection between a Ray((ox1,ox2,ox3),(dx1,dx2,dx3)) and a Plane P: ax+by+cz+d=0 - dc = a*dx1 + b*dx2 + c*dx3 - dw = a*ox1 + b*ox2 + c*ox3 + d - D = - dw / dc - */ - double px1, px2, px3; - double d = Ub::inf; // Distance to Min or Max Plane of the Cylinder - // final distance should be less that d - - if( this->isParallelToX1Axis() ) - { - double minX1 = this->getX1Minimum(); - double maxX1 = this->getX1Maximum(); - - if (UbMath::equal(x1 ,minX1) && UbMath::negative(rx1)) return -1.0; - else if(UbMath::equal(x1 ,maxX1) && UbMath::positive(rx1)) return -1.0; - - //falls die Linie nicht parallel zu den Seitenfl�chen ist - if( x1< minX1 || x1 > maxX1 ) //nur f�r punkte links und rechts des cylinders - { - px1 = (x1 < minX1 ? minX1 : maxX1); - //falls die Linie nicht parallel zu den Seitenfl�chen ist - if( !UbMath::zero(rx1) ) - { - // Plane a= 0, b= 1, c=0 d= -1*px2 - d = -1.0*(x1 - px1) / rx1; - px2 = x2 + d*rx2; - px3 = x3 + d*rx3; - - if(UbMath::greater(mLine->getDistance(px1,px2,px3) , mRad)) - { - if (x1 < minX1 && rx1>0.0 ) d = Ub::inf; //punkt liegt "links" vom cylinder und strahl hat evtl weiteren SP auf oberfl�che - else if(x1 > maxX1 && rx1<0.0 ) d = Ub::inf; - else return -1.0; - } - else return d; - } - else return -1.0; - } - else - { - if (UbMath::negative(rx1)) d = -1.0 * (x1 - minX1) / rx1; - else if(UbMath::positive(rx1)) d = -1.0 * (x1 - maxX1) / rx1; - } - } - else if( this->isParallelToX2Axis() ) - { - double minX2 = this->getX2Minimum(); - double maxX2 = this->getX2Maximum(); - - if (UbMath::equal(x2 ,minX2) && UbMath::negative(rx2)) return -1; - else if(UbMath::equal(x2 ,maxX2) && UbMath::positive(rx2)) return -1; - - if( minX2 > x2 || x2 > maxX2 ) - { - px2 = (x2 < minX2 ? minX2 : maxX2); - //falls die Linie nicht parallel zu den Seitenfl�chen ist - if( !UbMath::zero(rx2) ) - { - // Plane a= 0, b= 1, c=0 d= -1*px2 - d = -1*(x2 - px2) / rx2; - px1 = x1 + d*rx1; - px3 = x3 + d*rx3; - - if (UbMath::greater(mLine->getDistance(px1,px2,px3) , mRad)) - { - if (x2 < minX2 && rx2>0.0 ) d = Ub::inf; //punkt liegt "links oberhalb" vom cylinder und strahl mit pos x1 hat evtl weiteren SP auf oberfl�che - else if(x2 > maxX2 && rx2<0.0 ) d = Ub::inf; - else return -1.0; - } - else return d; - } - else return -1.0; - } - else - { - if (UbMath::negative(rx2)) d = -1.0 * (x2 - minX2) / rx2; - else if(UbMath::positive(rx2)) d = -1.0 * (x2 - maxX2) / rx2; - } - } - else if( this->isParallelToX3Axis() ) - { - double minX3 = this->getX3Minimum(); - double maxX3 = this->getX3Maximum(); - - if (UbMath::equal(x3, minX3) && UbMath::negative(rx3)) return -1.0; - else if(UbMath::equal(x3, maxX3) && UbMath::positive(rx3)) return -1.0; - - if(minX3 > x3 || x3 > maxX3 ) - { - px3 = (x3 < minX3 ? minX3 : maxX3); - //falls die Linie nicht parallel zu den Seitenfl�chen ist - if (!UbMath::zero(rx3)) - { - // Plane a= 0, b= 0, c=1 d= -1*px3 - d = -1.0*(x3 - px3) / rx3; - px2 = x2 + d*rx2; - px1 = x1 + d*rx1; - if( UbMath::greater(mLine->getDistance(px1,px2,px3) , mRad) ) - { - if (x3 < minX3 && rx3>0.0 ) d = Ub::inf; - else if(x3 > maxX3 && rx3<0.0 ) d = Ub::inf; - else return -1.0; - } - else return d; - } - else return -1.0; - } - else - { - if (UbMath::negative(rx3)) d = -1.0 * (x3 - minX3) / rx3; - else if(UbMath::positive(rx3)) d = -1.0 * (x3 - maxX3) / rx3; - } - } - else throw UbException(UB_EXARGS,"funzt nur bei achsen parallelem cylinder"); - ////////////////////////////////////////////////////////////////////////// - //Q berechnen f�r Infinity Cylinder - GbPoint3D* p1 = mLine->getPoint1(); - GbPoint3D* p2 = mLine->getPoint2(); - - double axisX1 = p2->x1 - p1->x1; /* Axis of the cylinder */ - double axisX2 = p2->x2 - p1->x2; /* mit p1 als base of cylinder */ - double axisX3 = p2->x3 - p1->x3; - - //double dirlen = mLine->getLength(); - //double abs, t, s; - - double RCx1 = x1 - p1->x1; - double RCx2 = x2 - p1->x2; - double RCx3 = x3 - p1->x3; - - //n = ray x axis - double nx1 = rx2*axisX3 - rx3*axisX2; - double nx2 = rx3*axisX1 - rx1*axisX3; - double nx3 = rx1*axisX2 - rx2*axisX1; - double nLength = nx1*nx1 + nx2*nx2 + nx3*nx3; - - double abs; - if( UbMath::zero( nLength ) ) - { /* ray parallel to cyl */ - //abs = RC dot axis - double abs = RCx1*axisX1 + RCx2*axisX2 + RCx3*axisX3; - double dx1 = RCx1 - abs*axisX1; - double dx2 = RCx2 - abs*axisX2; - double dx3 = RCx3 - abs*axisX3; - //abs = sqrt(dx1*dx1 + dx2*dx2 + dx3*dx3); - if( UbMath::greater( dx1*dx1 + dx2*dx2 + dx3*dx3 , mRad*mRad) ) - return -1.0; - } - - //normalize "n" - nLength = std::sqrt(nLength); - double invnLength = 1.0/nLength; - nx1*=invnLength; - nx2*=invnLength; - nx3*=invnLength; - - //shortest distance = fabs( RC dot n ) - abs = fabs( RCx1*nx1 + RCx2*nx2 + RCx3*nx3 ); - - if( UbMath::lessEqual(abs, mRad) ) - { /* if ray hits cylinder */ - //Ox1 = RC x axis - double Ox1 = RCx2*axisX3 - RCx3*axisX2; - double Ox2 = RCx3*axisX1 - RCx1*axisX3; - double Ox3 = RCx1*axisX2 - RCx2*axisX1; - //t = - O dot n / nLength; - double t = - (Ox1*nx1 + Ox2*nx2 + Ox3*nx3) / nLength; - - //O = n x axis; - Ox1 = nx2*axisX3 - nx3*axisX2; - Ox2 = nx3*axisX1 - nx1*axisX3; - Ox3 = nx1*axisX2 - nx2*axisX1; - - //normalize O - invnLength = 1.0/sqrt(Ox1*Ox1 + Ox2*Ox2 + Ox3*Ox3); - Ox1*=invnLength; - Ox2*=invnLength; - Ox3*=invnLength; - - double s = fabs( sqrt(mRad*mRad - abs*abs) / (rx1*Ox1 + rx2*Ox2 + rx3*Ox3) ); - - if( UbMath::greater(t-s,d) ) return -1.0; - - return t - s; - } - - return -1.0; -} -/*==========================================================*/ diff --git a/src/basics/geometry3d/fem/FeHalfDisc3D.h b/src/basics/geometry3d/fem/FeHalfDisc3D.h deleted file mode 100644 index 001ab8195..000000000 --- a/src/basics/geometry3d/fem/FeHalfDisc3D.h +++ /dev/null @@ -1,104 +0,0 @@ -// _ ___ __ __________ _ __ -// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ -// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) -// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ -// -#ifndef FEHALFDISC3D_H -#define FEHALFDISC3D_H - -#include <vector> -#include <cmath> - -#include <geometry3d/GbObject3D.h> -#include <basics/utilities/UbObserver.h> - -class GbPoint3D; -class GbLine3D; -class GbTriangle3D; - -class GbObject3DCreator; - -class FeHalfDisc3D : public GbObject3D , public UbObserver -{ -public: - FeHalfDisc3D(); - FeHalfDisc3D(const double& x1a,const double& x2a, const double& x3a, const double& x1b,const double& x2b, const double& x3b, const double& radius); - FeHalfDisc3D(GbPoint3D* p1, GbPoint3D* p2, const double& radius); - FeHalfDisc3D(GbLine3D* line, const double& rad); - FeHalfDisc3D(FeHalfDisc3D* cylinder); - ~FeHalfDisc3D(); - - FeHalfDisc3D* clone() { return new FeHalfDisc3D(this); } - void finalize(); - - double getRadius() { return this->mRad; }; - GbLine3D* getLine() {return mLine;} - GbPoint3D* getPoint1(); - GbPoint3D* getPoint2(); - - void setRadius(const double& radius); - void setLine(GbLine3D* line); - void setPoint1(const double& x1, const double& x2, const double& x3); - void setPoint2(const double& x1, const double& x2, const double& x3); - - bool isParallelToX1Axis() { return((this->cylinderType & X1PARALLEL ) == X1PARALLEL );} - bool isParallelToX2Axis() { return((this->cylinderType & X2PARALLEL ) == X2PARALLEL );} - bool isParallelToX3Axis() { return((this->cylinderType & X3PARALLEL ) == X3PARALLEL );} - bool isNotParallelToAxis(){ return((this->cylinderType & NOTPARALLELTOAXIS ) == NOTPARALLELTOAXIS );} - - double getHeight(); - - void scale(const double& sx1, const double& sx2, const double& sx3); - - double getX1Centroid(); - double getX1Minimum() ; - double getX1Maximum() ; - double getX2Centroid(); - double getX2Minimum() ; - double getX2Maximum() ; - double getX3Centroid(); - double getX3Minimum() ; - double getX3Maximum() ; - - bool isPointInGbObject3D(const double& x1p, const double& x2p, const double& x3p); - bool isPointInGbObject3D(const double& x1p, const double& x2p, const double& x3p, bool& pointIsOnBoundary); - bool isCellInsideGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b); - bool isCellCuttingGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b); - bool isCellInsideOrCuttingGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b); - - GbLine3D* createClippedLine3D(GbPoint3D& point1, GbPoint3D& point2); - - bool hasRaytracing() { return true; } - /*|r| must be 1! einheitsvector!!*/ - double getIntersectionRaytraceFactor(const double& x1, const double& x2, const double& x3, const double& rx1, const double& rx2, const double& rx3); - - std::vector<GbTriangle3D*> getSurfaceTriangleSet(); - - std::string toString(); - ObObjectCreator* getCreator(); - void write(UbFileOutput* out); - void read(UbFileInput* in); - - //virtuelle Methoden von UbObserver - void objectChanged(UbObservable* changedObject); - void objectWillBeDeleted(UbObservable* objectForDeletion); - - using GbObject3D::isPointInGbObject3D; //Grund: dadurch muss man hier isPointInGbObject3D(GbPoint3D*) nicht ausprogrammieren, welche sonst hier "ueberdeckt" waere - -protected: - void initCylinderType(); - - GbLine3D* mLine; - double mRad; - - int cylinderType; - - //void berechneQuerschnittsWerte(); - static const int NOTPARALLELTOAXIS = (1<<0); //1 - static const int X1PARALLEL = (1<<1); //2 - static const int X2PARALLEL = (1<<2); //4 - static const int X3PARALLEL = (1<<3); //8 -}; - -#endif diff --git a/src/basics/geometry3d/fem/FePlateTriangularMesh3D.cpp b/src/basics/geometry3d/fem/FePlateTriangularMesh3D.cpp deleted file mode 100644 index 37cb5b2e0..000000000 --- a/src/basics/geometry3d/fem/FePlateTriangularMesh3D.cpp +++ /dev/null @@ -1,223 +0,0 @@ -#include <geometry3d/fem/FePlateTriangularMesh3D.h> - -using namespace std; - -FePlateTriangularMesh3D::FePlateTriangularMesh3D() : GbTriangularMesh3D() -{ -} - -FePlateTriangularMesh3D::FePlateTriangularMesh3D(string name, vector<GbPoint3D*> *nodes, vector<GbTriangle3D*> *triangles) : GbTriangularMesh3D(name, nodes, triangles) -{ -} - -/*=============================================================================================*/ - -FePlateTriangularMesh3D::FePlateTriangularMesh3D(string name, vector<GbTriangle3D*> *triangles) : GbTriangularMesh3D(name, triangles) -{ -} - -/*=============================================================================================*/ -FePlateTriangularMesh3D::FePlateTriangularMesh3D(string name, vector<GbPoint3D*> *nodes, vector<GbLine3D*> *edges, vector<GbTriangle3D*> *triangles) : GbTriangularMesh3D(name, nodes, edges, triangles) -{ -} -/*=============================================================================================*/ -FePlateTriangularMesh3D::~FePlateTriangularMesh3D() -{ - -} -/*======================================================================*/ - -/*======================================================================*/ -bool FePlateTriangularMesh3D::isPointInGbObject3D(const double& x1, const double& x2, const double& x3) -{ - //cout<<"GbTriangularMesh3D::isPointInGbObject3D"<<endl; - //Sebastian - //double xmin=this->getX1Minimum(); double xmax=this->getX1Maximum(); - // double ymin=this->getX2Minimum(); double ymax=this->getX2Maximum(); - // double zmin=this->getX3Minimum(); double zmax=this->getX3Maximum(); - // double dX = (xmax-xmin)/100.; - // double dY = (ymax-ymin)/100.; - // double dZ = (zmax-zmin)/100.; - // GbCuboid3D boundingCube(xmin-dX, ymin-dY, zmin-dZ, xmax+dX, ymax+dY, zmax+dZ); - // - //if(this->isPointInObject3DHalfSpace(x1,x2,x3)) - //{ - // return true; - //} - //if(!boundingCube.isPointInGbObject3D(x1, x2, x3)) - //{ - // return false; - //} - - //return false; - //Marco - int inside = 0; - int nx1 = this->getNodesX1Dir()-1; - int nx2 = this->getNodesX2Dir()-1; - int maxTriangels = 2*nx1*nx2; - - //�berpr�ft, ob der Punkt innerhalb des Netzes liegt - double xmin=this->getX1Minimum(); double xmax=this->getX1Maximum(); - double ymin=this->getX2Minimum(); double ymax=this->getX2Maximum(); - double zmin=this->getX3Minimum(); double zmax=this->getX3Maximum(); - if( x1<=xmax && x1>=xmin - && x2<=ymax && x2>=ymin - && x3<=zmax && x3>=zmin) - { - //Achtung Sonderfall - //Es wird nur gegen die obere Lage Dreiecke getestet, da die untere Lage um den Abstand 'height' verschoben ist! - //Die Seiten m�ssen somit auch nicht ber�cksichtigt werden - for(int i=0; i<int(maxTriangels);i++) - { - if( (triangles->at(i))->enclosesPoint2D(x1, x2) - && x3<triangles->at(i)->getX3Centroid() - && x3>triangles->at(i)->getX3Centroid() - this->height ) - { - inside++; - } - } - } - - if(inside!=0) - { - return true; - } - else return false; -} -/*======================================================================*/ -FePlateTriangularMesh3D* FePlateTriangularMesh3D::createMeshByElements(int ElementsX1, int ElementsX2, double nulllevel, double deltaX1, double deltaX2, double height) -{ - FePlateTriangularMesh3D* triMesh = FePlateTriangularMesh3D::createMeshByNodes(ElementsX1+1, ElementsX2+1, nulllevel, deltaX1, deltaX2, height); - return triMesh; -} -/*======================================================================*/ -FePlateTriangularMesh3D* FePlateTriangularMesh3D::createMeshByNodes(int nodesX1, int nodesX2, double nulllevel, double deltaX1, double deltaX2, double height) -{ - cout<<"erstelle GbTriangularMesh3D -> "; - vector<GbTriangle3D*> *triangles = new vector<GbTriangle3D*>; - vector<GbPoint3D*> *points = new vector<GbPoint3D*>; - double h1=nulllevel+0.5*height; - double h2=nulllevel-0.5*height; - GbPoint3D* point1; - GbPoint3D* point2; - GbPoint3D* point3; - GbPoint3D* point4; - //Erstelle Knoten - //oben - for(int i=0; i<nodesX1; i++) - { - for(int j=0; j<nodesX2; j++) - { - GbPoint3D* point = new GbPoint3D(i*deltaX1,j*deltaX2,h1); - points->push_back(point); - } - } - //unten - for(int i=0; i<nodesX1; i++) - { - for(int j=0; j<nodesX2; j++) - { - GbPoint3D* point = new GbPoint3D(i*deltaX1,j*deltaX2,h2); - points->push_back(point); - } - } - int size=int(points->size()); - //Erstelle Dreiecke - //oben - for(int i=0; i<(size/2)-nodesX2; i+=nodesX2) - { - for(int j=0; j<nodesX2-1; j++) - { - point1 = points->at(i+j); - point2 = points->at(i+j+1); - point3 = points->at(i+j+nodesX2); - point4 = points->at(i+j+nodesX2+1); - GbTriangle3D* tri1 = new GbTriangle3D(point1,point3,point4); - GbTriangle3D* tri2 = new GbTriangle3D(point1,point4,point2); - triangles->push_back(tri1); - triangles->push_back(tri2); - } - } - //unten - for(int i=(size/2); i<size-nodesX2; i+=nodesX2) - { - for(int j=0; j<nodesX2-1; j++) - { - point1 = points->at(i+j); - point2 = points->at(i+j+1); - point3 = points->at(i+j+nodesX2); - point4 = points->at(i+j+nodesX2+1); - GbTriangle3D* tri1 = new GbTriangle3D(point4,point3,point1); - GbTriangle3D* tri2 = new GbTriangle3D(point2,point4,point1); - triangles->push_back(tri1); - triangles->push_back(tri2); - } - } - //Rand - //Nord - for(int i=0;i<nodesX1-1;i++) - { - int a = i*nodesX2+nodesX2-1; - int b = (i+1)*nodesX2+nodesX2-1; - point1 = points->at(a); - point2 = points->at(b); - point3 = points->at(a+size/2); - point4 = points->at(b+size/2); - GbTriangle3D* tri1 = new GbTriangle3D(point1,point2,point3); - GbTriangle3D* tri2 = new GbTriangle3D(point2,point4,point3); - triangles->push_back(tri1); - triangles->push_back(tri2); - } - //S�d - for(int i=0;i<nodesX1-1;i++) - { - int a = i*nodesX2; - int b = (i+1)*nodesX2; - point1 = points->at(a); - point2 = points->at(b); - point3 = points->at(a+size/2); - point4 = points->at(b+size/2); - GbTriangle3D* tri1 = new GbTriangle3D(point3,point2,point1); - GbTriangle3D* tri2 = new GbTriangle3D(point3,point4,point2); - triangles->push_back(tri1); - triangles->push_back(tri2); - } - //Ost - for(int j=0;j<nodesX2-1;j++) - { - int a = j; - int b = j+1; - point1 = points->at(a); - point2 = points->at(b); - point3 = points->at(a+size/2); - point4 = points->at(b+size/2); - GbTriangle3D* tri1 = new GbTriangle3D(point1,point2,point3); - GbTriangle3D* tri2 = new GbTriangle3D(point4,point3,point2); - triangles->push_back(tri1); - triangles->push_back(tri2); - } - //West - for(int j=0;j<nodesX2-1;j++) - { - int a = j+(nodesX1-1)*nodesX2; - int b = j+(nodesX1-1)*nodesX2+1; - point1 = points->at(a); - point2 = points->at(b); - point3 = points->at(a+size/2); - point4 = points->at(b+size/2); - GbTriangle3D* tri1 = new GbTriangle3D(point3,point2,point1); - GbTriangle3D* tri2 = new GbTriangle3D(point2,point3,point4); - triangles->push_back(tri1); - triangles->push_back(tri2); - } - string name = "TriMesh"; - FePlateTriangularMesh3D* triMesh = new FePlateTriangularMesh3D(name,points,triangles); - triMesh->setNullLevel((float)nulllevel); - triMesh->setHeight(height); - triMesh->setNodesX1Dir(nodesX1); - triMesh->setNodesX2Dir(nodesX2); - cout<<"done"<<endl; - return triMesh; -} - - diff --git a/src/basics/geometry3d/fem/FePlateTriangularMesh3D.h b/src/basics/geometry3d/fem/FePlateTriangularMesh3D.h deleted file mode 100644 index f76e9ec9c..000000000 --- a/src/basics/geometry3d/fem/FePlateTriangularMesh3D.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef FEPLATETRIANGULARMESH_H -#define FEPLATETRIANGULARMESH_H - -#include <sstream> -#include <iostream> - -#include <geometry3d/GbTriangularMesh3D.h> - - -/*=========================================================================*/ -/* GbTriangularMesh3D */ -/* */ -/** - * This Class provides the triangular meshes. - * Note, that up to now no methods for checking consistency are included. - * in this context this class describes facettes from an 3D-object !!! -*/ -class FePlateTriangularMesh3D : public GbTriangularMesh3D -{ -public: - FePlateTriangularMesh3D(); - FePlateTriangularMesh3D(std::string name, std::vector<GbPoint3D*> *nodes, std::vector<GbTriangle3D*> *triangles); - FePlateTriangularMesh3D(std::string name, std::vector<GbTriangle3D*> *triangles); - FePlateTriangularMesh3D(std::string name, std::vector<GbPoint3D*> *nodes, std::vector<GbLine3D*> *edges, std::vector<GbTriangle3D*> *triangles); - virtual ~FePlateTriangularMesh3D(); - - static FePlateTriangularMesh3D* createMeshByNodes(int nodesX1, int nodesX2, double nulllevel, double deltaX1, double deltaX2, double height); - static FePlateTriangularMesh3D* createMeshByElements(int ElementsX1, int ElementsX2, double nulllevel, double deltaX1, double deltaX2, double height); - - - float getNullLevel() { return this->nulllevel; } - void setNullLevel(float nulllevel) { this->nulllevel = nulllevel; } - double getHeight() { return this->height; } - void setHeight(double height) { this->height = height; } - int getNodesX1Dir() { return this->nodesX1Dir; } - void setNodesX1Dir(int nodesX1Dir) { this->nodesX1Dir = nodesX1Dir; } - int getNodesX2Dir() { return this->nodesX2Dir; } - void setNodesX2Dir(int nodesX2Dir) { this->nodesX2Dir = nodesX2Dir; } - - bool isPointInGbObject3D(const double& x1, const double& x2, const double& x3); - - /*======================================================================*/ -private: - float nulllevel; - double height; - int nodesX1Dir; - int nodesX2Dir; -}; -/*=========================================================================*/ -#endif diff --git a/src/basics/geometry3d/fem/FePoint3D.h b/src/basics/geometry3d/fem/FePoint3D.h deleted file mode 100644 index 23163b7ed..000000000 --- a/src/basics/geometry3d/fem/FePoint3D.h +++ /dev/null @@ -1,148 +0,0 @@ -#ifndef FEPOINT3D_H -#define FEPOINT3D_H - -#include <sstream> -#include <geometry3d/GbPoint3D.h> - - -/*=========================================================================*/ -/* GbPoint3D */ -/* */ -/** - * This Class provides basic 3D point objects. - * <BR><BR><HR> - * @author <A HREF="mailto:geller@bauinf.tu-cottbus.de">S. Geller</A> - * @version 1.0 - 10.02.07 - * - */ -class FePoint3D : public GbPoint3D -{ -private: - - double Fx; - double Fy; - double Fz; - //double oldFx; - //double oldFy; - double sumFx; - double sumFy; - double sumFz; - double velocityX; - double velocityY; - double velocityZ; - //double accelerationX; - //double accelerationY; - UbTupleDouble6 stresses; - - double area; -public: - FePoint3D():GbPoint3D() - { - this->init(); - } - FePoint3D(double x, double y, double z):GbPoint3D(x,y,z) - { - this->init(); - } - FePoint3D(GbPoint3D *point):GbPoint3D(point) - { - this->init(); - } - - FePoint3D(FePoint3D *point):GbPoint3D(point) - { - this->Fx = point->Fx; - this->Fy = point->Fy; - this->Fz = point->Fz; - throw UbException(__FILE__,__LINE__,"spaeter fertig machen..."); - } - - virtual ~FePoint3D() - { - } - - void init() - { - this->Fx = 0.0; - this->Fy = 0.0; - this->Fz = 0.0; - //this->oldFx = 0.0; - //this->oldFy = 0.0; - this->sumFx = 0.0; - this->sumFy = 0.0; - this->sumFz = 0.0; - val<1>(stresses) = 0.0; - val<2>(stresses) = 0.0; - val<3>(stresses) = 0.0; - val<4>(stresses) = 0.0; - val<5>(stresses) = 0.0; - val<6>(stresses) = 0.0; - this->area = 0.0; - this->velocityX = 0.0; - this->velocityY = 0.0; - this->velocityZ = 0.0; - } - /*======================================================================*/ - FePoint3D* clone() - { - return(new FePoint3D(this)); - } - - double getVelocityX() { return(this->velocityX); } - double getVelocityY() { return(this->velocityY); } - double getVelocityZ() { return(this->velocityZ); } - void setVelocityX(double x) { this->velocityX = x; } - void setVelocityY(double y) { this->velocityY = y; } - void setVelocityZ(double z) { this->velocityZ = z; } - - double getFX() { return(this->Fx); } - double getFY() { return(this->Fy); } - double getFZ() { return(this->Fz); } - void setFX(double FX) { this->Fx = FX; } - void setFY(double FY) { this->Fy = FY; } - void setFZ(double FZ) { this->Fz = FZ; } - void addFX(double FX) { this->Fx += FX; } - void addFY(double FY) { this->Fy += FY; } - void addFZ(double FZ) { this->Fz += FZ; } - - double getSumFX() { return(this->sumFx); } - double getSumFY() { return(this->sumFy); } - double getSumFZ() { return(this->sumFz); } - void setSumFX(double FX) { this->sumFx = FX; } - void setSumFY(double FY) { this->sumFy = FY; } - void setSumFZ(double FZ) { this->sumFz = FZ; } - void addSumFX(double FX) { this->sumFx += FX; } - void addSumFY(double FY) { this->sumFy += FY; } - void addSumFZ(double FZ) { this->sumFz += FZ; } - - UbTupleDouble6& getStresses() { return this->stresses; } -// void setS11(double S11) { this->S11 = S11; } -// void setS12(double S12) { this->S12 = S12; } -// void setS22(double S22) { this->S22 = S22; } - double getArea() { return this->area; } - void setArea(double area) { this->area = area; } - void addArea(double area) { this->area += area; } - - /** - * Returns a string representation of this 3D fe-point. - * @return a string representation of this 3D fe-point - */ - std::string toString() - { - std::stringstream ss; - ss<<"FePoint3D["; - ss<<"x1="<<this->x1; - ss<<", x2="<<this->x2; - ss<<", x3="<<this->x3; - ss<<", Fx="<<this->Fx; - ss<<", Fy="<<this->Fy; - ss<<", Fz="<<this->Fz<<"]"; - return((ss.str()).c_str()); - } - /*======================================================================*/ -}; -/*=========================================================================*/ -#endif - - - diff --git a/src/basics/geometry3d/fem/FeRing3D.cpp b/src/basics/geometry3d/fem/FeRing3D.cpp deleted file mode 100644 index 5ecdfd3bc..000000000 --- a/src/basics/geometry3d/fem/FeRing3D.cpp +++ /dev/null @@ -1,468 +0,0 @@ -#include <geometry3d/fem/FeRing3D.h> -#include <geometry3d/GbSystem3D.h> -#include <geometry3d/fem/FePoint3D.h> -#include <geometry3d/GbLine3D.h> -#include <geometry3d/GbTriangle3D.h> - -using namespace std; - -/*=======================================================*/ -ObObjectCreator* FeRing3D::getCreator() -{ - return NULL; //FeRing3DCreator::getInstance(); -} -// Konstruktor -/*==========================================================*/ -FeRing3D::FeRing3D() -{ - GbPoint3D* p1 = new GbPoint3D(); - GbPoint3D* p2 = new GbPoint3D(); - mLine = new GbLine3D(p1,p2); - this->mLine->addObserver(this); - inRadius = 0.0; - outRadius = 0.0; - ringType = FeRing3D::NOTPARALLELTOAXIS; -} -/*=======================================================*/ -FeRing3D::FeRing3D(FeRing3D* ring) -{ - inRadius = ring->getInRadius(); - outRadius = ring->getOutRadius(); - ringType = ring->ringType; - mLine = ring->getLine()->clone(); - - this->mLine->addObserver(this); -} -/*==========================================================*/ -FeRing3D::FeRing3D(const double& x1a,const double& x2a, const double& x3a, const double& x1b,const double& x2b, const double& x3b, const double& inradius, const double& outradius) -{ - mLine = new GbLine3D; - mLine->setPoints( new GbPoint3D(min(x1a,x1b), min(x2a,x2b), min(x3a,x3b)) - ,new GbPoint3D(max(x1a,x1b), max(x2a,x2b), max(x3a,x3b))); - this->mLine->addObserver(this); - this->inRadius = inradius; - this->outRadius = outradius; - - this->initRingType(); - if((this->ringType & NOTPARALLELTOAXIS)==NOTPARALLELTOAXIS) - throw UbException("FeRing3D::FeRing3D - derzeit nur zu Achsen orthogonale Cylinder erlaubt... isPointInObject3D funzt sonst ned"); -} -/*==========================================================*/ -FeRing3D::FeRing3D(GbPoint3D* p1, GbPoint3D* p2, const double& inradius, const double& outradius) -{ - this->inRadius = inradius; - this->outRadius = outradius; - - mLine = new GbLine3D(p1,p2); - this->mLine->addObserver(this); - this->initRingType(); - if((this->ringType & NOTPARALLELTOAXIS)==NOTPARALLELTOAXIS) - throw UbException("FeRing3D::FeRing3D - derzeit nur zu Achsen orthogonale Cylinder erlaubt... isPointInObject3D funzt sonst ned"); -} -/*==========================================================*/ -FeRing3D::FeRing3D(GbLine3D* line, const double& inradius, const double& outradius) -{ - this->inRadius = inradius; - this->outRadius = outradius; - - this->mLine = line; - this->mLine->addObserver(this); - this->initRingType(); - if((this->ringType & NOTPARALLELTOAXIS)==NOTPARALLELTOAXIS) - throw UbException("FeRing3D::FeRing3D - derzeit nur zu Achsen orthogonale Cylinder erlaubt... isPointInObject3D funzt sonst ned"); -} -/*==========================================================*/ -// Destruktor -FeRing3D::~FeRing3D() -{ - if(mLine) this->mLine->removeObserver(this); - mLine = NULL; -} -/*=======================================================*/ -void FeRing3D::initRingType() -{ - double x1a = mLine->getPoint1()->x1; double x1b = mLine->getPoint2()->x1; - double x2a = mLine->getPoint1()->x2; double x2b = mLine->getPoint2()->x2; - double x3a = mLine->getPoint1()->x3; double x3b = mLine->getPoint2()->x3; - - if (x1a!=x1b && x2a==x2b && x3a==x3b) this->ringType = X1PARALLEL; - else if(x2a!=x2b && x1a==x1b && x3a==x3b) this->ringType = X2PARALLEL; - else if(x3a!=x3b && x1a==x1b && x2a==x2b) this->ringType = X3PARALLEL; - else this->ringType = NOTPARALLELTOAXIS; -} -/*=======================================================*/ -void FeRing3D::finalize() -{ - if(this->mLine) - { - mLine->finalize(); - delete mLine; - mLine=NULL; - } -} -/*=======================================================*/ -double FeRing3D::getHeight() -{ - if(mLine) return mLine->getLength(); return 0.0; -} -/*=======================================================*/ -GbPoint3D* FeRing3D::getPoint1() -{ - if(this->mLine) return this->mLine->getPoint1(); - return NULL; -} -/*=======================================================*/ -GbPoint3D* FeRing3D::getPoint2() -{ - if(this->mLine) return this->mLine->getPoint2(); - return NULL; -} -/*=======================================================*/ -void FeRing3D::setInRadius(const double& radius) -{ - this->inRadius = std::fabs(radius); - this->notifyObserversObjectChanged(); -} -/*=======================================================*/ -void FeRing3D::setOutRadius(const double& radius) -{ - this->outRadius = std::fabs(radius); - this->notifyObserversObjectChanged(); -} -/*=======================================================*/ -void FeRing3D::setLine(GbLine3D* line) -{ - if(this->mLine) this->mLine->removeObserver(this); - this->mLine = line; - this->mLine->addObserver(this); - this->initRingType(); - - this->notifyObserversObjectChanged(); -} -/*=======================================================*/ -void FeRing3D::setPoint1(const double& x1, const double& x2, const double& x3) -{ - if(!mLine->getPoint1()) throw UbException("FeRing3D::setPoint1() - line has no point1"); - mLine->getPoint1()->setCoordinates(x1,x2,x3); - this->initRingType(); - - //this->notifyObserversObjectChanged(); //wird automatisch aufgerufen, da der point (this) benachrichtigt... -} -/*=======================================================*/ -void FeRing3D::setPoint2(const double& x1, const double& x2, const double& x3) -{ - if(!mLine->getPoint2()) throw UbException("FeRing3D::setPoint1() - line has no point2"); - mLine->getPoint2()->setCoordinates(x1,x2,x3); - this->initRingType(); - - //this->notifyObserversObjectChanged(); //wird automatisch aufgerufen, da der point (this) benachrichtigt... -} -/*==========================================================*/ -double FeRing3D::getX1Centroid() -{ - return mLine->getX1Centroid(); -} -/*==========================================================*/ -double FeRing3D::getX1Minimum() -{ - if (this->isParallelToX1Axis()) return mLine->getX1Minimum(); - else if(this->isParallelToX2Axis()) return mLine->getX1Centroid()-outRadius; - else if(this->isParallelToX3Axis()) return mLine->getX1Centroid()-outRadius; - else throw UbException(__FILE__, __LINE__, "FeRing3D::getX3Minimum - derzeit nur zu Achsen orthogonale Cylinder erlaubt... isPointInObject3D funzt sonst ned"); -} -/*==========================================================*/ -double FeRing3D::getX1Maximum() -{ - if (this->isParallelToX1Axis()) return mLine->getX1Maximum(); - else if(this->isParallelToX2Axis()) return mLine->getX1Centroid()+outRadius; - else if(this->isParallelToX3Axis()) return mLine->getX1Centroid()+outRadius; - else throw UbException(__FILE__, __LINE__, "FeRing3D::getX3Maximum - derzeit nur zu Achsen orthogonale Cylinder erlaubt... isPointInObject3D funzt sonst ned"); -} -/*==========================================================*/ -double FeRing3D::getX2Centroid() -{ - return mLine->getX2Centroid(); -} -/*==========================================================*/ -double FeRing3D::getX2Minimum() -{ - if (this->isParallelToX1Axis()) return mLine->getX2Centroid()-outRadius; - else if(this->isParallelToX2Axis()) return mLine->getX2Minimum(); - else if(this->isParallelToX3Axis()) return mLine->getX2Centroid()-outRadius; - else throw UbException(__FILE__, __LINE__, "FeRing3D::getX3Minimum - derzeit nur zu Achsen orthogonale Cylinder erlaubt... isPointInObject3D funzt sonst ned"); -} -/*==========================================================*/ -double FeRing3D::getX2Maximum() -{ - if (this->isParallelToX1Axis()) return mLine->getX2Centroid()+outRadius; - else if(this->isParallelToX2Axis()) return mLine->getX2Maximum(); - else if(this->isParallelToX3Axis()) return mLine->getX2Centroid()+outRadius; - else throw UbException(__FILE__, __LINE__, "FeRing3D::getX3Maximum - derzeit nur zu Achsen orthogonale Cylinder erlaubt... isPointInObject3D funzt sonst ned"); -} -/*==========================================================*/ -double FeRing3D::getX3Centroid() -{ - return mLine->getX3Centroid(); -} -/*==========================================================*/ -double FeRing3D::getX3Minimum() -{ - if (this->isParallelToX1Axis()) return mLine->getX3Centroid()-outRadius; - else if(this->isParallelToX2Axis()) return mLine->getX3Centroid()-outRadius; - else if(this->isParallelToX3Axis()) return mLine->getX3Minimum(); - else throw UbException(__FILE__, __LINE__, "FeRing3D::getX3Minimum - derzeit nur zu Achsen orthogonale Cylinder erlaubt... isPointInObject3D funzt sonst ned"); -} -/*==========================================================*/ -double FeRing3D::getX3Maximum() -{ - if (this->isParallelToX1Axis()) return mLine->getX3Centroid()+outRadius; - else if(this->isParallelToX2Axis()) return mLine->getX3Centroid()+outRadius; - else if(this->isParallelToX3Axis()) return mLine->getX3Maximum(); - else throw UbException(__FILE__, __LINE__, "FeRing3D::getX3Maximum - derzeit nur zu Achsen orthogonale Cylinder erlaubt... isPointInObject3D funzt sonst ned"); -} -/*==========================================================*/ -bool FeRing3D::isPointInGbObject3D(const double& x1p, const double& x2p, const double& x3p) -{ - throw UbException(__FILE__,__LINE__,"FeRing3D function not implemented"); - -} -/*==========================================================*/ -bool FeRing3D::isPointInGbObject3D(const double& x1p, const double& x2p, const double& x3p, bool& pointIsOnBoundary) -{ - throw UbException(__FILE__,__LINE__,"FeRing3D function not implemented"); -} -/*=======================================================*/ -bool FeRing3D::isCellInsideGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b) -{ - throw UbException(__FILE__,__LINE__,"FeRing3D function not implemented"); -} - -/*==========================================================*/ -string FeRing3D::toString() -{ - stringstream ss; - ss<<"FeRing3D["; - ss<<"line="<<this->mLine->toString(); - ss<<", inRadius="<<this->inRadius; - ss<<", outRadius="<<this->outRadius; - ss<<"]"; - return(ss.str()); -} -/*==========================================================*/ -bool FeRing3D::isCellInsideOrCuttingGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b) -{ - throw UbException(__FILE__,__LINE__,"FeRing3D function not implemented"); -} -/*==========================================================*/ -bool FeRing3D::isCellCuttingGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b) -{ - throw UbException(__FILE__,__LINE__,"FeRing3D function not implemented"); -} -/*==========================================================*/ -GbLine3D* FeRing3D::createClippedLine3D(GbPoint3D& point1, GbPoint3D& point2) -{ - throw UbException(__FILE__,__LINE__,"FeRing3D function not implemented"); -} -/*==========================================================*/ -vector<GbTriangle3D*> FeRing3D::getSurfaceTriangleSet() -{ - double x1ma,x1mb,x2m,x3m; - if( this->isParallelToX1Axis() ) - { - x1ma = this->getX1Minimum(); - x1mb = this->getX1Maximum(); - x2m = this->getX2Centroid(); - x3m = this->getX3Centroid(); - } - else if( this->isParallelToX2Axis() ) - { - x1ma = this->getX2Minimum(); - x1mb = this->getX2Maximum(); - x2m = this->getX1Centroid(); - x3m = this->getX3Centroid(); - } - else if( this->isParallelToX3Axis() ) - { - x1ma = this->getX3Minimum(); - x1mb = this->getX3Maximum(); - x2m = this->getX2Centroid(); - x3m = this->getX1Centroid(); - } - else throw UbException(__FILE__, __LINE__, "FeRing3D::getSurfaceTriangleSet() - ring not axis prallel"); - - vector<GbTriangle3D*> triangles; - - int segmentsCircle = 14; - double deltaPhi = UbMath::PI/(double)segmentsCircle; - - double phiX1a,phiX1b; - double x1a,x2a,x3a,x1b,x2b,x3b,x1c,x2c,x3c,x1d,x2d,x3d; - double x2aa,x3aa,x2bb,x3bb; - - double dXCylinder = fabs((x1mb-x1ma)); // /(double)segmentsCircle; - int segmentsCylinder = (int)(fabs(x1mb-x1ma)/dXCylinder); - for(int segCyl = 0; segCyl<segmentsCylinder; segCyl++) - { - x1a = x1d = x1ma+segCyl*dXCylinder; - x1b = x1c = x1a+dXCylinder; - - for(phiX1a=2.0*UbMath::PI; phiX1a>0; phiX1a-=deltaPhi) - { - phiX1b = phiX1a+deltaPhi; - - x2a = x2m+this->outRadius*std::sin(phiX1a); - x3a = x3m+this->outRadius*std::cos(phiX1a); - x2b = x2m+this->outRadius*std::sin(phiX1b); - x3b = x3m+this->outRadius*std::cos(phiX1b); - - x2aa = x2m+this->inRadius*std::sin(phiX1a); - x3aa = x3m+this->inRadius*std::cos(phiX1a); - x2bb = x2m+this->inRadius*std::sin(phiX1b); - x3bb = x3m+this->inRadius*std::cos(phiX1b); - - if( this->isParallelToX1Axis() ) - { - triangles.push_back(new GbTriangle3D(new FePoint3D(x1b,x2a,x3a),new FePoint3D(x1b,x2b,x3b),new FePoint3D(x1a,x2a,x3a))); - triangles.push_back(new GbTriangle3D(new FePoint3D(x1a,x2b,x3b),new FePoint3D(x1a,x2a,x3a),new FePoint3D(x1b,x2b,x3b))); - triangles.push_back(new GbTriangle3D(new FePoint3D(x1b,x2bb,x3bb),new FePoint3D(x1b,x2aa,x3aa),new FePoint3D(x1a,x2aa,x3aa))); - triangles.push_back(new GbTriangle3D(new FePoint3D(x1a,x2aa,x3aa),new FePoint3D(x1a,x2bb,x3bb),new FePoint3D(x1b,x2bb,x3bb))); - } - else if( this->isParallelToX2Axis() ) - { - throw UbException(__FILE__,__LINE__," sollte man mal machen"); - //triangles.push_back(new GbTriangle3D(new FePoint3D(x2b,x1b,x3b),new FePoint3D(x2a,x1b,x3a),new FePoint3D(x2a,x1a,x3a))); - //triangles.push_back(new GbTriangle3D(new FePoint3D(x2a,x1a,x3a),new FePoint3D(x2b,x1a,x3b),new FePoint3D(x2b,x1b,x3b))); - //triangles.push_back(new GbTriangle3D(new FePoint3D(x2bb,x1b,x3bb),new FePoint3D(x2aa,x1b,x3aa),new FePoint3D(x2aa,x1a,x3aa))); - //triangles.push_back(new GbTriangle3D(new FePoint3D(x2aa,x1a,x3aa),new FePoint3D(x2bb,x1a,x3bb),new FePoint3D(x2bb,x1b,x3bb))); - } - else if( this->isParallelToX3Axis() ) - { - throw UbException(__FILE__,__LINE__," sollte man mal machen"); - //triangles.push_back(new GbTriangle3D(new FePoint3D(x3b,x2b,x1b),new FePoint3D(x3a,x2a,x1b),new FePoint3D(x3a,x2a,x1a))); - //triangles.push_back(new GbTriangle3D(new FePoint3D(x3a,x2a,x1a),new FePoint3D(x3b,x2b,x1a),new FePoint3D(x3b,x2b,x1b))); - //triangles.push_back(new GbTriangle3D(new FePoint3D(x3bb,x2bb,x1b),new FePoint3D(x3aa,x2aa,x1b),new FePoint3D(x3aa,x2aa,x1a))); - //triangles.push_back(new GbTriangle3D(new FePoint3D(x3aa,x2aa,x1a),new FePoint3D(x3bb,x2bb,x1a),new FePoint3D(x3bb,x2bb,x1b))); - } - - } - } - - //int segmentsSide = (int)(this->outRadius/dXCylinder); - - double radius0, radius1; - //for(int segCyl = 10; segCyl<segmentsSide; segCyl++) - //{ - radius0 = inRadius;//segCyl*dXCylinder; - radius1 = outRadius;//radius0+dXCylinder; - //if(segCyl==segmentsSide-1) radius1=outRadius; - - for(phiX1a=2.0*UbMath::PI; phiX1a>0; phiX1a-=deltaPhi) - { - phiX1b = phiX1a+deltaPhi; - - x2a = x2m+radius0*std::sin(phiX1a); - x3a = x3m+radius0*std::cos(phiX1a); - x2b = x2m+radius0*std::sin(phiX1b); - x3b = x3m+radius0*std::cos(phiX1b); - x2c = x2m+radius1*std::sin(phiX1b); - x3c = x3m+radius1*std::cos(phiX1b); - x2d = x2m+radius1*std::sin(phiX1a); - x3d = x3m+radius1*std::cos(phiX1a); - - if( this->isParallelToX1Axis() ) - { - triangles.push_back(new GbTriangle3D(new FePoint3D(x1ma,x2b,x3b),new FePoint3D(x1ma,x2a,x3a),new FePoint3D(x1ma,x2c,x3c))); - triangles.push_back(new GbTriangle3D(new FePoint3D(x1ma,x2d,x3d),new FePoint3D(x1ma,x2c,x3c),new FePoint3D(x1ma,x2a,x3a))); - triangles.push_back(new GbTriangle3D(new FePoint3D(x1mb,x2b,x3b),new FePoint3D(x1mb,x2c,x3c),new FePoint3D(x1mb,x2a,x3a))); - triangles.push_back(new GbTriangle3D(new FePoint3D(x1mb,x2d,x3d),new FePoint3D(x1mb,x2a,x3a),new FePoint3D(x1mb,x2c,x3c))); - } - else if( this->isParallelToX2Axis() ) - { - throw UbException(__FILE__,__LINE__," sollte man mal machen"); - //triangles.push_back(new GbTriangle3D(new FePoint3D(x2a,x1ma,x3a),new FePoint3D(x2b,x1ma,x3b),new FePoint3D(x2c,x1ma,x3c))); - //triangles.push_back(new GbTriangle3D(new FePoint3D(x2c,x1ma,x3c),new FePoint3D(x2d,x1ma,x3d),new FePoint3D(x2a,x1ma,x3a))); - //triangles.push_back(new GbTriangle3D(new FePoint3D(x2c,x1mb,x3c),new FePoint3D(x2b,x1mb,x3b),new FePoint3D(x2a,x1mb,x3a))); - //triangles.push_back(new GbTriangle3D(new FePoint3D(x2a,x1mb,x3a),new FePoint3D(x2d,x1mb,x3d),new FePoint3D(x2c,x1mb,x3c))); - } - else if( this->isParallelToX3Axis() ) - { - throw UbException(__FILE__,__LINE__," sollte man mal machen"); - //triangles.push_back(new GbTriangle3D(new FePoint3D(x3a,x2a,x1ma),new FePoint3D(x3b,x2b,x1ma),new FePoint3D(x3c,x2c,x1ma))); - //triangles.push_back(new GbTriangle3D(new FePoint3D(x3c,x2c,x1ma),new FePoint3D(x3d,x2d,x1ma),new FePoint3D(x3a,x2a,x1ma))); - //triangles.push_back(new GbTriangle3D(new FePoint3D(x3c,x2c,x1mb),new FePoint3D(x3b,x2b,x1mb),new FePoint3D(x3a,x2a,x1mb))); - //triangles.push_back(new GbTriangle3D(new FePoint3D(x3a,x2a,x1mb),new FePoint3D(x3d,x2d,x1mb),new FePoint3D(x3c,x2c,x1mb))); - } - } - // } - - return triangles; -} -/*==========================================================*/ -void FeRing3D::objectChanged(UbObservable* changedObject) -{ - GbLine3D* line = dynamic_cast<GbLine3D*>(changedObject); - if(!line || this->mLine!=line) return; - - this->notifyObserversObjectChanged(); -} -/*==========================================================*/ -void FeRing3D::objectWillBeDeleted(UbObservable* objectForDeletion) -{ - if(this->mLine) - { - UbObservable* observedObj = dynamic_cast<UbObservable*>(this->mLine); - if(objectForDeletion == observedObj) { this->mLine = NULL; } - } -} -/*=======================================================*/ -void FeRing3D::scale(const double& sx1, const double& sx2, const double& sx3) -{ - if( this->isParallelToX1Axis() ) - { - if(!UbMath::equal(sx2,sx3)) throw UbException("FeRing3D::scale - || to x1 -> different scaling sx2 and sx3 not possible"); - this->inRadius*=sx2; - this->outRadius*=sx2; - } - else if( this->isParallelToX2Axis() ) - { - if(!UbMath::equal(sx1,sx3)) throw UbException("FeRing3D::scale - || to x2 -> different scaling sx1 and sx3 not possible"); - this->inRadius*=sx1; - this->outRadius*=sx1; - } - else if( this->isParallelToX3Axis() ) - { - if(!UbMath::equal(sx1,sx2)) throw UbException("FeRing3D::scale - || to x3 -> different scaling sx1 and sx2 not possible"); - this->inRadius*=sx1; - this->outRadius*=sx1; - } - else throw UbException("FeRing3D::scale - unknown direction"); - - this->mLine->scale(sx1,sx2,sx3); - //notify observer wird automatisch aufgerufen -} -/*==========================================================*/ -void FeRing3D::write(UbFileOutput* out) -{ - out->writeString(this->getCreator()->getTypeID()); - mLine->write(out); - out->writeDouble(inRadius); - out->writeDouble(outRadius); - out->writeInteger(ringType); -} -/*==========================================================*/ -void FeRing3D::read(UbFileInput* in) -{ - in->readString(); - mLine = new GbLine3D; - mLine->read(in); - inRadius = in->readDouble(); - outRadius = in->readDouble(); - ringType = in->readInteger(); -} -/*==========================================================*/ -double FeRing3D::getIntersectionRaytraceFactor(const double& x1, const double& x2, const double& x3, const double& rx1, const double& rx2, const double& rx3) -{ - throw UbException(__FILE__,__LINE__,"FeRing3D function not implemented"); -} -/*==========================================================*/ - diff --git a/src/basics/geometry3d/fem/FeRing3D.h b/src/basics/geometry3d/fem/FeRing3D.h deleted file mode 100644 index 12491ada9..000000000 --- a/src/basics/geometry3d/fem/FeRing3D.h +++ /dev/null @@ -1,107 +0,0 @@ -// _ ___ __ __________ _ __ -// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ -// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) -// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ -// -#ifndef FERING3D_H -#define FERING3D_H - -#include <vector> -#include <cmath> - -#include <geometry3d/GbObject3D.h> -#include <basics/utilities/UbObserver.h> - -class GbPoint3D; -class GbLine3D; -class GbTriangle3D; - -class GbObject3DCreator; - -class FeRing3D : public GbObject3D , public UbObserver -{ -public: - FeRing3D(); - FeRing3D(const double& x1a,const double& x2a, const double& x3a, const double& x1b,const double& x2b, const double& x3b, const double& inradius, const double& outradius); - FeRing3D(GbPoint3D* p1, GbPoint3D* p2, const double& inradius, const double& outradius); - FeRing3D(GbLine3D* line, const double& inradius, const double& outradius); - FeRing3D(FeRing3D* ring); - ~FeRing3D(); - - FeRing3D* clone() { return new FeRing3D(this); } - void finalize(); - - double getInRadius() { return this->inRadius; }; - double getOutRadius() { return this->outRadius; }; - GbLine3D* getLine() {return mLine;} - GbPoint3D* getPoint1(); - GbPoint3D* getPoint2(); - - void setInRadius(const double& radius); - void setOutRadius(const double& radius); - void setLine(GbLine3D* line); - void setPoint1(const double& x1, const double& x2, const double& x3); - void setPoint2(const double& x1, const double& x2, const double& x3); - - bool isParallelToX1Axis() { return((this->ringType & X1PARALLEL ) == X1PARALLEL );} - bool isParallelToX2Axis() { return((this->ringType & X2PARALLEL ) == X2PARALLEL );} - bool isParallelToX3Axis() { return((this->ringType & X3PARALLEL ) == X3PARALLEL );} - bool isNotParallelToAxis(){ return((this->ringType & NOTPARALLELTOAXIS ) == NOTPARALLELTOAXIS );} - - double getHeight(); - - void scale(const double& sx1, const double& sx2, const double& sx3); - - double getX1Centroid(); - double getX1Minimum() ; - double getX1Maximum() ; - double getX2Centroid(); - double getX2Minimum() ; - double getX2Maximum() ; - double getX3Centroid(); - double getX3Minimum() ; - double getX3Maximum() ; - - bool isPointInGbObject3D(const double& x1p, const double& x2p, const double& x3p); - bool isPointInGbObject3D(const double& x1p, const double& x2p, const double& x3p, bool& pointIsOnBoundary); - bool isCellInsideGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b); - bool isCellCuttingGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b); - bool isCellInsideOrCuttingGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b); - - GbLine3D* createClippedLine3D(GbPoint3D& point1, GbPoint3D& point2); - - bool hasRaytracing() { return true; } - /*|r| must be 1! einheitsvector!!*/ - double getIntersectionRaytraceFactor(const double& x1, const double& x2, const double& x3, const double& rx1, const double& rx2, const double& rx3); - - std::vector<GbTriangle3D*> getSurfaceTriangleSet(); - - std::string toString(); - ObObjectCreator* getCreator(); - void write(UbFileOutput* out); - void read(UbFileInput* in); - - //virtuelle Methoden von UbObserver - void objectChanged(UbObservable* changedObject); - void objectWillBeDeleted(UbObservable* objectForDeletion); - - using GbObject3D::isPointInGbObject3D; //Grund: dadurch muss man hier isPointInGbObject3D(GbPoint3D*) nicht ausprogrammieren, welche sonst hier "ueberdeckt" waere - -protected: - void initRingType(); - - GbLine3D* mLine; - double inRadius; - double outRadius; - - int ringType; - - //void berechneQuerschnittsWerte(); - static const int NOTPARALLELTOAXIS = (1<<0); //1 - static const int X1PARALLEL = (1<<1); //2 - static const int X2PARALLEL = (1<<2); //4 - static const int X3PARALLEL = (1<<3); //8 -}; - -#endif diff --git a/src/basics/geometry3d/fem/FeTriFaceMesh3D.cpp b/src/basics/geometry3d/fem/FeTriFaceMesh3D.cpp deleted file mode 100644 index 1df203b47..000000000 --- a/src/basics/geometry3d/fem/FeTriFaceMesh3D.cpp +++ /dev/null @@ -1,256 +0,0 @@ -#include <geometry3d/fem/FeTriFaceMesh3D.h> - -#include <geometry3d/fem/creator/FeTriFaceMesh3DCreator.h> -#include <geometry3d/GbTriangle3D.h> - -#include <basics/writer/WbWriterVtkXmlBinary.h> -#include <basics/writer/WbWriterVtkXmlASCII.h> - -using namespace std; - -FeTriFaceMesh3D::FeTriFaceMesh3D():GbTriFaceMesh3D() -{ - this->attributes = new vector<VertexAttributes>; -// this->createVertexTriFaceMap(); -} -/*====================================================*/ -FeTriFaceMesh3D::FeTriFaceMesh3D(std::string name, std::vector<Vertex>* nodes, std::vector<TriFace>* triangles):GbTriFaceMesh3D(name,nodes,triangles) -{ - this->attributes = new vector<VertexAttributes>; - this->attributes->resize(nodes->size()); -// this->createVertexTriFaceMap(); -} -/*======================================================================*/ -ObObjectCreator* FeTriFaceMesh3D::getCreator() -{ - return FeTriFaceMesh3DCreator::getInstance(); -} -/*====================================================*/ -void FeTriFaceMesh3D::resizeAttributes() -{ - this->attributes->resize(nodes->size()); -} -/*====================================================*/ -//void FeTriFaceMesh3D::createVertexTriFaceMap() -//{ -// vertexTriFaceMap.clear(); -// vector<TriFace>& tris = *this->triangles; -// vector<Vertex>& pts = *this->nodes; -// -// for(size_t t=0; t<tris.size(); t++) -// { -// TriFace& tri = tris[t]; -// Vertex& vert1 = pts[tri.v1]; -// Vertex& vert2 = pts[tri.v2]; -// Vertex& vert3 = pts[tri.v3]; -// vertexTriFaceMap.setVertexTriFaceRelation(&vert1,&tri); -// vertexTriFaceMap.setVertexTriFaceRelation(&vert2,&tri); -// vertexTriFaceMap.setVertexTriFaceRelation(&vert3,&tri); -// } -//} -/*====================================================*/ -FeTriFaceMesh3D* FeTriFaceMesh3D::createMeshByTriangles(std::string name, std::vector<GbTriangle3D*> *triangles) -{ - vector<GbTriFaceMesh3D::Vertex> *nodes = new vector<GbTriFaceMesh3D::Vertex>; - vector<GbTriFaceMesh3D::TriFace> *tris = new vector<GbTriFaceMesh3D::TriFace>; - int nr=0; - for(int u=0;u<(int)triangles->size();u++) - { - if(UbMath::zero((*triangles)[u]->getArea())) continue; - - GbPoint3D* p1 = (*triangles)[u]->getPoint1(); - GbPoint3D* p2 = (*triangles)[u]->getPoint2(); - GbPoint3D* p3 = (*triangles)[u]->getPoint3(); - nodes->push_back(GbTriFaceMesh3D::Vertex((float)p1->getX1Coordinate(),(float)p1->getX2Coordinate(),(float)p1->getX3Coordinate())); - nodes->push_back(GbTriFaceMesh3D::Vertex((float)p2->getX1Coordinate(),(float)p2->getX2Coordinate(),(float)p2->getX3Coordinate())); - nodes->push_back(GbTriFaceMesh3D::Vertex((float)p3->getX1Coordinate(),(float)p3->getX2Coordinate(),(float)p3->getX3Coordinate())); - tris->push_back(GbTriFaceMesh3D::TriFace(nr,nr+1,nr+2)); - nr+=3; - } - FeTriFaceMesh3D* triMesh = new FeTriFaceMesh3D(name, nodes, tris); - triMesh->deleteRedundantNodes(); - triMesh->resizeAttributes(); - return triMesh; -} - -/*======================================================================*/ -UbTuple<string,string> FeTriFaceMesh3D::writeMesh(string filename, WbWriter* writer, bool writeNormals, std::vector< std::string >* datanames, std::vector< std::vector < double > >* nodedata) -{ - if(datanames || nodedata) - { - UBLOG(logWARNING,"FeTriFaceMesh3D::writeMesh - no support for extra datanames || nodedata"); - } - - UBLOG2(logDEBUG1,std::cout,"FeTriFaceMesh3D::writeMesh - start"); - - UbTuple<string,string> filenames; - - if( dynamic_cast<WbWriterVtkXmlBinary*>(writer) || dynamic_cast<WbWriterVtkXmlASCII*>(writer)) - { - vector< UbTupleFloat3 > triNodes( nodes->size() ); - vector< UbTupleInt3 > tris( triangles->size() ); - - for(size_t i=0; i<nodes->size(); i++) - triNodes[i] = makeUbTuple( (*nodes)[i].x, (*nodes)[i].y, (*nodes)[i].z ); - - for(size_t i=0; i<triangles->size(); i++) - tris[i] = makeUbTuple( (*triangles)[i].v1, (*triangles)[i].v2, (*triangles)[i].v3 ) ; - - vector<string> localDataNames; - localDataNames.push_back("Fx" ); - localDataNames.push_back("Fy" ); - localDataNames.push_back("Fz" ); - localDataNames.push_back("sumFx" ); - localDataNames.push_back("sumFy" ); - localDataNames.push_back("sumFz" ); - localDataNames.push_back("vx" ); - localDataNames.push_back("vy" ); - localDataNames.push_back("vz" ); - localDataNames.push_back("S1" ); - localDataNames.push_back("S2" ); - localDataNames.push_back("S3" ); - localDataNames.push_back("S4" ); - localDataNames.push_back("S5" ); - localDataNames.push_back("S6" ); - localDataNames.push_back("Pressure"); - - std::vector< std::vector < double > > localNodedata( localDataNames.size(), std::vector<double>( nodes->size() ) ); - for(size_t n=0; n<nodes->size(); n++) - { - FeTriFaceMesh3D::VertexAttributes& attribut = (*this->attributes)[n]; - - localNodedata[ 0][n] = attribut.getFX(); - localNodedata[ 1][n] = attribut.getFY(); - localNodedata[ 2][n] = attribut.getFZ(); - localNodedata[ 3][n] = attribut.getSumFX(); - localNodedata[ 4][n] = attribut.getSumFY(); - localNodedata[ 5][n] = attribut.getSumFZ(); - localNodedata[ 6][n] = attribut.getVelocityX(); - localNodedata[ 7][n] = attribut.getVelocityY(); - localNodedata[ 8][n] = attribut.getVelocityZ(); - localNodedata[ 9][n] = val<1>(attribut.getStresses()); - localNodedata[10][n] = val<2>(attribut.getStresses()); - localNodedata[11][n] = val<3>(attribut.getStresses()); - localNodedata[12][n] = val<4>(attribut.getStresses()); - localNodedata[13][n] = val<5>(attribut.getStresses()); - localNodedata[14][n] = val<6>(attribut.getStresses()); - localNodedata[15][n] = attribut.getPressure(); - } - val<1>(filenames) = writer->writeTrianglesWithNodeData(filename,triNodes,tris,localDataNames,localNodedata); - } - else - { - string avsfilename = filename+writer->getFileExtension(); - val<1>(filenames)=avsfilename; - - ofstream out(avsfilename.c_str(),ios::out); - if(!out) - { - out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!outfile) weiterhin true!!! - string path = UbSystem::getPathFromString(filename); - if(path.size()>0){UbSystem::makeDirectory(path);out.open(filename.c_str(),ios::out);} - if(!out) throw UbException(UB_EXARGS,"file konnte nicht geschrieben werden"); - } - - //cout<<"AvsASCII - writeLines to "<<avsfilename<<" ..."; - - int nofNodes = (int)nodes->size(); - int nofTrian = (int)triangles->size(); - int dataSize = 16; - - out<<"# UCD-File created by WbWriterAvsASCII\n"; - out<<nofNodes<<" "<<nofTrian<<" "<<dataSize<<" 0 0 "<<endl; - - for(int i=0; i<nofNodes; i++) - out<<i+1<<" "<< (*nodes)[i].x<<" "<< (*nodes)[i].y<<" "<< (*nodes)[i].z<<" \n"; - - for(int i=0; i<nofTrian; i++) - out<<i+1<<" 2 tri "<<(*triangles)[i].v1+1<<" "<<(*triangles)[i].v2+1<<" "<<(*triangles)[i].v3+1<<" "<<endl; - - out<<dataSize; - for(int i=0;i<dataSize;i++) out<<" "<<1; - out<<endl; - - out<<"Fx, no_unit"<<endl; - out<<"Fy, no_unit"<<endl; - out<<"Fz, no_unit"<<endl; - out<<"sumFx, no_unit"<<endl; - out<<"sumFy, no_unit"<<endl; - out<<"sumFz, no_unit"<<endl; - out<<"vx, no_unit"<<endl; - out<<"vy, no_unit"<<endl; - out<<"vz, no_unit"<<endl; - out<<"S1, no_unit"<<endl; - out<<"S2, no_unit"<<endl; - out<<"S3, no_unit"<<endl; - out<<"S4, no_unit"<<endl; - out<<"S5, no_unit"<<endl; - out<<"S6, no_unit"<<endl; - out<<"Pressure, no_unit"<<endl; - - for(int n=0; n<nofNodes; n++) - { - FeTriFaceMesh3D::VertexAttributes& attribut = (*this->attributes)[n]; - - double Fx = attribut.getFX(); - double Fy = attribut.getFY(); - double Fz = attribut.getFZ(); - double sumFx = attribut.getSumFX(); - double sumFy = attribut.getSumFY(); - double sumFz = attribut.getSumFZ(); - double vx = attribut.getVelocityX(); - double vy = attribut.getVelocityY(); - double vz = attribut.getVelocityZ(); - double p = attribut.getPressure(); - UbTupleDouble6& stresses = attribut.getStresses(); - out<<n+1<<" "<<Fx<<" "<<Fy<<" "<<Fz; - out<<" "<<sumFx<<" "<<sumFy<<" "<<sumFz; - out<<" "<<vx<<" "<<vy<<" "<<vz; - out<<" "<<val<1>(stresses)<<" "<<val<2>(stresses)<<" "<<val<3>(stresses); - out<<" "<<val<4>(stresses)<<" "<<val<5>(stresses)<<" "<<val<6>(stresses); - out<<" "<<p<<endl; - } - out.close(); - } - - if(writeNormals) - { - vector<UbTupleFloat3 > lineNodes(triangles->size()*2); - vector<UbTupleInt2 > lines(triangles->size()); - for(size_t i=0; i<triangles->size(); i++) - { - TriFace& triangle = (*triangles)[i]; - lineNodes[i*2 ] = makeUbTuple( triangle.getX1Centroid(*nodes) - ,triangle.getX2Centroid(*nodes) - ,triangle.getX3Centroid(*nodes)); - lineNodes[i*2+1] = makeUbTuple( (float)(triangle.getX1Centroid(*nodes)+triangle.nx) - ,(float)(triangle.getX2Centroid(*nodes)+triangle.ny) - ,(float)(triangle.getX3Centroid(*nodes)+triangle.nz)); - - lines[i] = makeUbTuple((int)i*2,(int)i*2+1); - } - val<2>(filenames) = writer->writeLines(filename+"_normals",lineNodes,lines); - } - - - if(writeNormals) - { - vector<UbTupleFloat3 > lineNodes(nodes->size()*2); - vector<UbTupleInt2 > lines(nodes->size()); - for(size_t i=0; i<nodes->size(); i++) - { - FeTriFaceMesh3D::VertexAttributes& attribut = (*this->attributes)[i]; - lineNodes[i*2 ] = makeUbTuple((*nodes)[i].x, (*nodes)[i].y, (*nodes)[i].z ); - lineNodes[i*2+1] = makeUbTuple((*nodes)[i].x+(float)attribut.getNormalX() - ,(*nodes)[i].y+(float)attribut.getNormalY() - ,(*nodes)[i].z+(float)attribut.getNormalZ()); - - lines[i] = makeUbTuple((int)i*2,(int)i*2+1); - } - writer->writeLines(filename+"_PointNormals",lineNodes,lines); - } - - UBLOG2(logDEBUG1,std::cout,"FeTriFaceMesh3D::writeMesh - end"); - - return filenames; -} diff --git a/src/basics/geometry3d/fem/FeTriFaceMesh3D.h b/src/basics/geometry3d/fem/FeTriFaceMesh3D.h deleted file mode 100644 index 924941867..000000000 --- a/src/basics/geometry3d/fem/FeTriFaceMesh3D.h +++ /dev/null @@ -1,204 +0,0 @@ -#ifndef FETRIFACEMESH3D_H -#define FETRIFACEMESH3D_H - -#include <sstream> -#include <iostream> -#include <vector> -#include <map> - -#include "./../GbTriFaceMesh3D.h" - -#ifdef CAB_RCF -#include <3rdParty/rcf/RcfSerializationIncludes.h> -#endif //CAB_RCF - -/*=========================================================================*/ -/* FeTriFaceMesh3D */ -/* */ -/** - * This Class provides the triangular meshes. - * Note, that up to now no methods for checking consistency are included. - * in this context this class describes facettes from an 3D-object !!! -*/ -class FeTriFaceMesh3D : public GbTriFaceMesh3D -{ -public: - class VertexAttributes - { - private: - double Fx; - double Fy; - double Fz; - double sumFx; - double sumFy; - double sumFz; - double velocityX; - double velocityY; - double velocityZ; - double normalX; - double normalY; - double normalZ; - UbTupleDouble6 stresses; - double area; - double p; //pressure - public: - VertexAttributes() - { - this->init(); - } - ~VertexAttributes() {} - -#ifdef CAB_RCF - template<class Archive> - void SF_SERIALIZE(Archive & ar) - { - ar & Fx; ar & Fy; ar & Fz; - ar & velocityX; ar & velocityY; ar & velocityZ; - } -#endif //CAB_RCF - - void init() - { - this->Fx = 0.0; - this->Fy = 0.0; - this->Fz = 0.0; - this->sumFx = 0.0; - this->sumFy = 0.0; - this->sumFz = 0.0; - val<1>(stresses) = 0.0; - val<2>(stresses) = 0.0; - val<3>(stresses) = 0.0; - val<4>(stresses) = 0.0; - val<5>(stresses) = 0.0; - val<6>(stresses) = 0.0; - this->area = 0.0; - this->p = 0.0; - this->velocityX = 0.0; - this->velocityY = 0.0; - this->velocityZ = 0.0; - this->normalX = 0.0; - this->normalY = 0.0; - this->normalZ = 0.0; - } - double getVelocityX() { return this->velocityX; } - double getVelocityY() { return this->velocityY; } - double getVelocityZ() { return this->velocityZ; } - void setVelocityX(double x) { this->velocityX = x; } - void setVelocityY(double y) { this->velocityY = y; } - void setVelocityZ(double z) { this->velocityZ = z; } - - double getNormalX() { return this->normalX; } - double getNormalY() { return this->normalY; } - double getNormalZ() { return this->normalZ; } - void setNormalX(double x) { this->normalX = x; } - void setNormalY(double y) { this->normalY = y; } - void setNormalZ(double z) { this->normalZ = z; } - - double getFX() { return this->Fx; } - double getFY() { return this->Fy; } - double getFZ() { return this->Fz; } - void setFX(double FX) { this->Fx = FX; } - void setFY(double FY) { this->Fy = FY; } - void setFZ(double FZ) { this->Fz = FZ; } - void addFX(double FX) { this->Fx += FX; } - void addFY(double FY) { this->Fy += FY; } - void addFZ(double FZ) { this->Fz += FZ; } - - double getSumFX() { return this->sumFx; } - double getSumFY() { return this->sumFy; } - double getSumFZ() { return this->sumFz; } - void setSumFX(double FX) { this->sumFx = FX; } - void setSumFY(double FY) { this->sumFy = FY; } - void setSumFZ(double FZ) { this->sumFz = FZ; } - void addSumFX(double FX) { this->sumFx += FX; } - void addSumFY(double FY) { this->sumFy += FY; } - void addSumFZ(double FZ) { this->sumFz += FZ; } - - UbTupleDouble6& getStresses() { return this->stresses; } - - double getArea() { return this->area; } - void setArea(double area) { this->area = area; } - void addArea(double area) { this->area += area; } - - double getPressure() { return this->p; } - void setPressure(double p) { this->p = p; } - - }; -/*=========================================================================*/ -/*=========================================================================*/ -/*=========================================================================*/ - //class VertexTriFaceMap : public std::multimap<Vertex*, TriFace*> - //{ - //public: - // VertexTriFaceMap() {} - // /*=========================================================================*/ - // void setVertexTriFaceRelation(Vertex* v, TriFace* tri) - // { - // this->insert(std::pair<Vertex*,TriFace*>(v,tri)); - // } - // /*=========================================================================*/ - // int getNumberOfTriFaces(Vertex* v) - // { - // return((int)this->count(v)); - // } - // /*=========================================================================*/ - // std::vector<TriFace*> getTriFacesForVertex(Vertex* v) - // { - // std::vector<TriFace*> trivector; - // unsigned number = (unsigned)this->count(v); - // std::multimap<Vertex*,TriFace*>::iterator mapIterator = this->find(v); - // for(unsigned u =0; u<number; u++) - // { - // trivector.push_back(mapIterator->second); - // mapIterator ++; - // } - // return trivector; - // } - // //void deleteNeighbors(QtInteractor* interactor); - // ///*=========================================================================*/ - //}; -/*=========================================================================*/ -/*=========================================================================*/ -/*=========================================================================*/ -public: - //#ifndef SWIG - //VertexTriFaceMap vertexTriFaceMap; - //#endif - - FeTriFaceMesh3D(); - FeTriFaceMesh3D(std::string name, std::vector<Vertex>* nodes, std::vector<TriFace>* triangles); - - std::vector<VertexAttributes>* getAttributes() { return this->attributes; } - void resizeAttributes(); - //void createVertexTriFaceMap(); - - UbTuple<std::string,std::string> writeMesh(std::string filename, WbWriter* writer, bool writeNormals=false, std::vector< std::string >* datanames=NULL, std::vector< std::vector < double > >* nodedata=NULL); - - static FeTriFaceMesh3D* createMeshByTriangles(std::string name, std::vector<GbTriangle3D*>* triangles); - - virtual ObObjectCreator* getCreator(); - -#ifdef CAB_RCF - template<class Archive> - void SF_SERIALIZE(Archive & ar) - { - SF_SERIALIZE_PARENT<GbTriFaceMesh3D>(ar, *this); - ar & attributes; - //if( ArchiveTools::isReading(ar) ) this->createVertexTriFaceMap(); - } -#endif //CAB_RCF - - -protected: - std::vector<VertexAttributes>* attributes; - -}; - -#if defined(RCF_USE_SF_SERIALIZATION) && !defined(SWIG) - UB_AUTO_RUN_NAMED( SF::registerType<FeTriFaceMesh3D >("FeTriFaceMesh3D ") , SF_FeTriFaceMesh3D ); - UB_AUTO_RUN_NAMED( ( SF::registerBaseAndDerived< GbTriFaceMesh3D, FeTriFaceMesh3D >() ), SF_FeTriFaceMesh3D_BD1 ); - UB_AUTO_RUN_NAMED( ( SF::registerBaseAndDerived< GbObject3D, FeTriFaceMesh3D >() ), SF_FeTriFaceMesh3D_BD2 ); -#endif //RCF_USE_SF_SERIALIZATION - - -#endif //FETRIFACEMESH3D_H diff --git a/src/basics/geometry3d/fem/creator/FeTriFaceMesh3DCreator.cpp b/src/basics/geometry3d/fem/creator/FeTriFaceMesh3DCreator.cpp deleted file mode 100644 index 8d406423d..000000000 --- a/src/basics/geometry3d/fem/creator/FeTriFaceMesh3DCreator.cpp +++ /dev/null @@ -1,417 +0,0 @@ -#include <geometry3d/fem/creator/FeTriFaceMesh3DCreator.h> -#include <basics/utilities/UbLogger.h> -#include <basics/utilities/UbTiming.h> - -using namespace std; - -FeTriFaceMesh3D* FeTriFaceMesh3DCreator::readMeshFromFile(string filename, string meshName, bool removeRedundantNodes) -{ - if(meshName.empty()) - { - size_t pos=filename.rfind("/"); - if(pos!=string::npos) meshName = filename.substr(pos+1); - else meshName = filename; - } - - UbFileInputASCII stlfile(filename); - if(!stlfile) throw UbException(UB_EXARGS,"cannot open file "+filename); - string ext=stlfile.getFileExtension(); - - //in "kleinbuchstaben" umwandeln - transform(ext.begin(), ext.end(), ext.begin(), (int(*)(int))tolower); //(int(*)(int)) ist irgendso ein fieser cast, weil tolower ne alte c-methode ist - - if ( !ext.compare("ply") ) return FeTriFaceMesh3DCreator::readMeshFromPLYFile(filename, meshName, removeRedundantNodes); - else if( !ext.compare("stl") ) return FeTriFaceMesh3DCreator::readMeshFromSTLFile(filename, meshName, removeRedundantNodes); - else if( !ext.compare("inp") ) return FeTriFaceMesh3DCreator::readMeshFromAVSFile(filename, meshName, removeRedundantNodes); - //else if( !ext.compare("gts") ) return FeTriFaceMesh3DCreator::readMeshFromGTSFile(filename, meshName); - //else if( !ext.compare("raw") ) return FeTriFaceMesh3DCreator::readMeshFromRAWFile(filename, meshName); - else throw UbException(UB_EXARGS,"fileformat "+ext); - - return NULL; -} -/*======================================================================*/ -FeTriFaceMesh3D* FeTriFaceMesh3DCreator::readMeshFromPLYFile(string filename, string meshName, bool removeRedundantNodes) -{ - UbFileInputASCII plyfile(filename); - if(!plyfile) throw UbException(UB_EXARGS,"cannot open file "+filename); - return FeTriFaceMesh3DCreator::readMeshFromPLYFile(&plyfile,meshName); -} -/*======================================================================*/ -FeTriFaceMesh3D* FeTriFaceMesh3DCreator::readMeshFromPLYFile(UbFileInput* in, string meshName, bool removeRedundantNodes) -{ - //cout<<"GbTriangularMesh3DFile.readMeshFromPLYFile !!! Dieses Format hat leider redundante Knoten ..."<<endl; - vector<GbTriFaceMesh3D::Vertex> *nodes = new vector<GbTriFaceMesh3D::Vertex>; - vector<GbTriFaceMesh3D::TriFace> *triangles = new vector<GbTriFaceMesh3D::TriFace>; - - float x, y, z; - string dummy; - - int numVertices = in->readIntegerAfterString("element vertex"); - int numFaces = in->readIntegerAfterString("element face"); - in->setPosAfterLineWithString("end_header"); - - UBLOG(logDEBUG1,"Number of vertices "<<numVertices); - UBLOG(logDEBUG1,"Number of faces "<<numFaces); - - nodes->resize(numVertices); - triangles->reserve(numFaces); - - int onePercent = (int)UbMath::max(1,UbMath::integerRounding(numVertices*0.01)); - for (int i=0; i<numVertices; i++) - { - if( i%onePercent==0 ) - cout<<" - read vertices (#"<<numVertices<<") "<<UbMath::integerRounding(i/(double)numVertices*100.0)<<"% "<<"\r"<<flush; - x = in->readFloat(); - y = in->readFloat(); - z = in->readFloat(); - in->readLine(); - (*nodes)[i] = GbTriFaceMesh3D::Vertex(x,y,z); - } - UBLOG(logDEBUG1," - read vertices (#"<<numVertices<<") done"); - - int p,j,k,l,n; - onePercent = (int)UbMath::max(1,UbMath::integerRounding(numFaces*0.01)); - for(int i=0; i<numFaces; i++) - { - if( i%onePercent==0 ) cout<<" - read faces (#"<<numFaces<<") "<<UbMath::integerRounding(i/(double)numFaces*100.0)<<"% "<<"\r"<<flush; - - p = in->readInteger(); - if(p==3) //Dreieck, alles andere wird stumpf ingnoriert - { - j = in->readInteger(); - k = in->readInteger(); - l = in->readInteger(); - - if( !UbMath::inClosedInterval(j,0,numVertices-1) - || !UbMath::inClosedInterval(k,0,numVertices-1) - || !UbMath::inClosedInterval(l,0,numVertices-1) ) - { - throw UbException(UB_EXARGS,"dreiecksindex ist groesser als max Knotenindex oder kleiner 0"); - } - triangles->push_back(GbTriFaceMesh3D::TriFace(j,k,l)); - } - else if(p==4) //Viereck --> wird zu zwei Dreiecken! - { - j = in->readInteger(); - k = in->readInteger(); - l = in->readInteger(); - n = in->readInteger(); - numFaces++; - i++; - - if( !UbMath::inClosedInterval(j,0,numVertices-1) - || !UbMath::inClosedInterval(k,0,numVertices-1) - || !UbMath::inClosedInterval(l,0,numVertices-1) - || !UbMath::inClosedInterval(n,0,numVertices-1) - ) - { - throw UbException(UB_EXARGS,"vierecksindex ist groesser als max Knotenindex oder kleiner 0"); - } - triangles->push_back(GbTriFaceMesh3D::TriFace(j,k,l)); - triangles->push_back(GbTriFaceMesh3D::TriFace(l,n,j)); - } - - in->readLine(); - - } - UBLOG(logDEBUG1," - read faces (#"<<(int)triangles->size()<<", #nonTriangles="<<(int)triangles->size()-numFaces<<") done"); - - FeTriFaceMesh3D* mesh = new FeTriFaceMesh3D(meshName, nodes, triangles); - - if(removeRedundantNodes) mesh->deleteRedundantNodes(); - - mesh->resizeAttributes(); - //mesh->createVertexTriFaceMap(); - mesh->calculateValues(); - - - return mesh; -} -/*======================================================================*/ -FeTriFaceMesh3D* FeTriFaceMesh3DCreator::readMeshFromSTLFile(string filename, string meshName, bool removeRedundantNodes) -{ - UbFileInputASCII stlfile(filename); - if(!stlfile) throw UbException(UB_EXARGS,"cannot open file "+filename); - return FeTriFaceMesh3DCreator::readMeshFromSTLFile(&stlfile,meshName,removeRedundantNodes); -} -/*======================================================================*/ -FeTriFaceMesh3D* FeTriFaceMesh3DCreator::readMeshFromSTLFile(UbFileInput *in, string meshName, bool removeRedundantNodes) -{ - UBLOG(logINFO,"FeTriFaceMesh3DCreator::readMeshFromSTLFile !!! Dieses Format hat leider redundante Knoten ..."); - - vector<FeTriFaceMesh3D::Vertex> *nodes = new vector<FeTriFaceMesh3D::Vertex>; - vector<FeTriFaceMesh3D::TriFace> *triangles = new vector<FeTriFaceMesh3D::TriFace>; - string dummy; - - double x, y, z; - int nr=0; - - in->readLine(); - while(dummy!="endsolid") - { - in->readLine(); - in->readLine(); - dummy = in->readString(); - if(dummy!="vertex") throw UbException(UB_EXARGS,"no vertex format"); - x=in->readDouble(); - y=in->readDouble(); - z=in->readDouble(); - nodes->push_back(FeTriFaceMesh3D::Vertex((float)x,(float)y,(float)z)); - in->readLine(); - in->readString(); - x=in->readDouble(); - y=in->readDouble(); - z=in->readDouble(); - nodes->push_back(FeTriFaceMesh3D::Vertex((float)x,(float)y,(float)z)); - in->readLine(); - in->readString(); - x=in->readDouble(); - y=in->readDouble(); - z=in->readDouble(); - nodes->push_back(FeTriFaceMesh3D::Vertex((float)x,(float)y,(float)z)); - triangles->push_back(FeTriFaceMesh3D::TriFace(nr,nr+1,nr+2)); - in->readLine(); - in->readLine(); - in->readLine(); - dummy = in->readString(); - nr+=3; - } - - - FeTriFaceMesh3D* mesh = new FeTriFaceMesh3D(meshName, nodes, triangles); - - if(removeRedundantNodes) mesh->deleteRedundantNodes(); - - mesh->resizeAttributes(); -// mesh->createVertexTriFaceMap(); - mesh->calculateValues(); - - - return mesh; -} -// /*======================================================================*/ -// FeTriFaceMesh3D* FeTriFaceMesh3DCreator::readMeshFromMeshFile(string filename, string meshName, bool removeRedundantNodes) -// { -// public static void read(String file, ArrayList<Node3d> nodeList, ArrayList<TrianglePatch> patches) throws FileReaderException { -// -// UBLOG(logINFO,"FeTriFaceMesh3DCreator::readMeshFromSTLFile !!! Dieses Format hat leider redundante Knoten ..."); -// -// vector<FeTriFaceMesh3D::Vertex> *nodes = new vector<FeTriFaceMesh3D::Vertex>; -// vector<FeTriFaceMesh3D::TriFace> *triangles = new vector<FeTriFaceMesh3D::TriFace>; -// string dummy; -// -// double x, y, z; -// int nr=0; -// -// in->readLine(); -// while(dummy!="endsolid") -// { -// in->readLine(); -// in->readLine(); -// dummy = in->readString(); -// if(dummy!="vertex") throw UbException(UB_EXARGS,"no vertex format"); -// x=in->readDouble(); -// y=in->readDouble(); -// z=in->readDouble(); -// nodes->push_back(FeTriFaceMesh3D::Vertex((float)x,(float)y,(float)z)); -// in->readLine(); -// in->readString(); -// x=in->readDouble(); -// y=in->readDouble(); -// z=in->readDouble(); -// nodes->push_back(FeTriFaceMesh3D::Vertex((float)x,(float)y,(float)z)); -// in->readLine(); -// in->readString(); -// x=in->readDouble(); -// y=in->readDouble(); -// z=in->readDouble(); -// nodes->push_back(FeTriFaceMesh3D::Vertex((float)x,(float)y,(float)z)); -// triangles->push_back(FeTriFaceMesh3D::TriFace(nr,nr+1,nr+2)); -// in->readLine(); -// in->readLine(); -// in->readLine(); -// dummy = in->readString(); -// nr+=3; -// } -// -// -// FeTriFaceMesh3D* mesh = new FeTriFaceMesh3D(meshName, nodes, triangles); -// -// if(removeRedundantNodes) mesh->deleteRedundantNodes(); -// -// return mesh; -// -// -// try { -// -// FileInput input = new FileInput(file); -// -// int line = 0; -// while(true) -// { -// if(line>1000) break; -// if(input.readLine().contains("Vertices")) -// break; -// line++; -// } -// -// int num_of_points = input.readInt(); -// -// for (int i = 0; i < num_of_points; i++) { -// float x = (float) input.readDouble(); -// float y = (float) input.readDouble(); -// float z = (float) input.readDouble(); -// int nr = input.readInt(); -// nodeList.add(new Node3d(x, y, z)); -// } -// -// input.skipLine(); -// input.skipLine(); -// int num_of_triangles = input.readInt(); -// -// for (int i = 0; i < num_of_triangles; i++) { -// -// int a = input.readInt(); -// int b = input.readInt(); -// int c = input.readInt(); -// int nr = input.readInt(); -// -// Node3d P1 = nodeList.get(a - 1); -// Node3d P2 = nodeList.get(b - 1); -// Node3d P3 = nodeList.get(c - 1); -// -// patches.add(new TrianglePatch(P1, P2, P3)); -// } -// -// // END reading mesh file -// } -// -// -- -// -// Dipl.-Ing. Sebastian Bindick -// -// Institute for Computational Modeling in Civil Engineering (iRMB) Technische Universit�t Braunschweig Pockelsstr. 3 (9th Floor) D-38106, Braunschweig, Germany -// -// phone +49 531/391-7598 -// fax +49 531/391-7599 -// email bindick@irmb.tu-bs.de -// web www.irmb.tu-bs.de -// -// -/*======================================================================*/ -FeTriFaceMesh3D* FeTriFaceMesh3DCreator::readMeshFromAVSFile(string filename, string meshName, bool removeRedundantNodes) -{ - UbFileInputASCII stlfile(filename); - if(!stlfile) throw UbException(UB_EXARGS,"cannot open file "+filename); - return FeTriFaceMesh3DCreator::readMeshFromAVSFile(&stlfile,meshName,removeRedundantNodes); -} -/*======================================================================*/ -FeTriFaceMesh3D* FeTriFaceMesh3DCreator::readMeshFromAVSFile(UbFileInput *in, string meshName, bool removeRedundantNodes) -{ - UBLOG(logINFO,"FeTriFaceMesh3DCreator.readMeshFromAVSFile !!! Dieses Format hat leider redundante Knoten ..."); - - vector<FeTriFaceMesh3D::Vertex> *nodes = new vector<FeTriFaceMesh3D::Vertex>; - vector<FeTriFaceMesh3D::TriFace> *triangles = new vector<FeTriFaceMesh3D::TriFace>; - string dummy; - - in->readLine(); - int numberNodes = in->readInteger(); - int numberTris = in->readInteger(); - in->readLine(); - - double x,y,z; - for(int u=0;u<numberNodes;u++) - { - in->readInteger(); - x=in->readDouble(); - y=in->readDouble(); - z=in->readDouble(); - in->readLine(); - nodes->push_back(FeTriFaceMesh3D::Vertex((float)x,(float)y,(float)z)); - } - int id1,id2,id3; - for(int u=0;u<numberTris;u++) - { - in->readInteger(); - in->readInteger(); - in->readString(); - id1 = in->readInteger(); - id2 = in->readInteger(); - id3 = in->readInteger(); - triangles->push_back(FeTriFaceMesh3D::TriFace(id1-1,id2-1,id3-1)); - } - - FeTriFaceMesh3D* mesh = new FeTriFaceMesh3D(meshName, nodes, triangles); - - if(removeRedundantNodes) mesh->deleteRedundantNodes(); - - mesh->resizeAttributes(); -// mesh->createVertexTriFaceMap(); - mesh->calculateValues(); - - - return mesh; -} -/*======================================================================*/ -FeTriFaceMesh3D* FeTriFaceMesh3DCreator::readMeshFromVTKASCIIFile(string filename, string meshName, GbTriFaceMesh3D::KDTREE_SPLITAGORITHM splitAlg, bool removeRedundantNodes) -{ - UbFileInputASCII stlfile(filename); - if(!stlfile) throw UbException(UB_EXARGS,"cannot open file "+filename); - return FeTriFaceMesh3DCreator::readMeshFromVTKASCIIFile(&stlfile,meshName,splitAlg,removeRedundantNodes); -} -/*======================================================================*/ -FeTriFaceMesh3D* FeTriFaceMesh3DCreator::readMeshFromVTKASCIIFile(UbFileInput *in, string meshName, GbTriFaceMesh3D::KDTREE_SPLITAGORITHM splitAlg, bool removeRedundantNodes) -{ - UBLOG(logDEBUG1,"GbTriFaceMesh3DCreator.readMeshFromVTKASCIIFile !!! Dieses Format hat leider redundante Knoten ..."); - - vector<GbTriFaceMesh3D::Vertex> *nodes = new vector<GbTriFaceMesh3D::Vertex>; - vector<GbTriFaceMesh3D::TriFace> *triangles = new vector<GbTriFaceMesh3D::TriFace>; - string dummy; - - in->readLine(); - in->readLine(); - in->readLine(); - in->readLine(); - - in->readString(); - int numberNodes = in->readInteger(); - in->readLine(); - - double x,y,z; - for(int u=0;u<numberNodes;u++) - { - x=in->readDouble(); - y=in->readDouble(); - z=in->readDouble(); - nodes->push_back(GbTriFaceMesh3D::Vertex((float)x,(float)y,(float)z)); - } - in->readLine(); - in->readString(); - int numberTris = in->readInteger(); - in->readLine(); - UBLOG(logDEBUG1,"numberTris:"<<numberTris); - - int id1,id2,id3; - for(int u=0;u<numberTris;u++) - { - in->readInteger(); - id1 = in->readInteger(); - id2 = in->readInteger(); - id3 = in->readInteger(); - triangles->push_back(GbTriFaceMesh3D::TriFace(id1,id2,id3)); - //cout<<u<<" - id1,id2,id3:"<<id1<<","<<id2<<","<<id3<<endl; - } - UBLOG(logDEBUG1,"Tris gelesen"); - - FeTriFaceMesh3D* mesh = new FeTriFaceMesh3D(meshName, nodes, triangles); - - if(removeRedundantNodes) mesh->deleteRedundantNodes(); - - mesh->resizeAttributes(); -// mesh->createVertexTriFaceMap(); - mesh->calculateValues(); - - UBLOG(logDEBUG1,"mesh erzeugt (with remove redundant nodes = "<< boolalpha <<removeRedundantNodes<<")"); - - return mesh; -} diff --git a/src/basics/geometry3d/fem/creator/FeTriFaceMesh3DCreator.h b/src/basics/geometry3d/fem/creator/FeTriFaceMesh3DCreator.h deleted file mode 100644 index d6f11cae3..000000000 --- a/src/basics/geometry3d/fem/creator/FeTriFaceMesh3DCreator.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef FETRIFACEMESH3DCREATOR_H -#define FETRIFACEMESH3DCREATOR_H - -#include <geometry3d/creator/GbObject3DCreator.h> -#include <geometry3d/fem/FeTriFaceMesh3D.h> -#include <basics/utilities/UbFileInputASCII.h> - -#ifdef CAB_QT -#include <qfiledialog.h> -#endif - -#ifdef CAB_VTK -//#include <geometry3d/presentation/vtkGbTriangularMesh3D.h> -#endif - -class FeTriFaceMesh3DCreator : public GbObject3DCreator -{ -public: - static FeTriFaceMesh3DCreator* getInstance() - { - static FeTriFaceMesh3DCreator instance; - return &instance; - } - static FeTriFaceMesh3D* readMeshFromFile(std::string filename, std::string meshName, bool removeRedundantNodes=true); - - static FeTriFaceMesh3D* readMeshFromPLYFile(std::string filename, std::string meshName, bool removeRedundantNodes=true); - static FeTriFaceMesh3D* readMeshFromPLYFile(UbFileInput* in, std::string meshName, bool removeRedundantNodes=true); - - static FeTriFaceMesh3D* readMeshFromSTLFile(std::string filename, std::string meshName, bool removeRedundantNodes=true); - static FeTriFaceMesh3D* readMeshFromSTLFile(UbFileInput* in, std::string meshName, bool removeRedundantNodes=true); - - static FeTriFaceMesh3D* readMeshFromAVSFile(std::string filename, std::string meshName, bool removeRedundantNodes=true); - static FeTriFaceMesh3D* readMeshFromAVSFile(UbFileInput* in, std::string meshName, bool removeRedundantNodes=true); - - static FeTriFaceMesh3D* readMeshFromVTKASCIIFile(std::string filename, std::string meshName="", GbTriFaceMesh3D::KDTREE_SPLITAGORITHM splitAlg = GbTriFaceMesh3D::KDTREE_SAHPLIT, bool removeRedundantNodes=true); - static FeTriFaceMesh3D* readMeshFromVTKASCIIFile(UbFileInput* in, std::string meshName="", GbTriFaceMesh3D::KDTREE_SPLITAGORITHM splitAlg = GbTriFaceMesh3D::KDTREE_SAHPLIT, bool removeRedundantNodes=true); - - - FeTriFaceMesh3D* createGbObject3D() { return new FeTriFaceMesh3D(); } - - std::string getGbObject3DTypeID(){ return "FeTriFaceMesh3D"; }; - std::string toString() { return "FeTriFaceMesh3DCreator"; } - -#ifdef CAB_QT - - - FeTriFaceMesh3D* createGbObject3DwithQt() - { - //QString s = QFileDialog::getOpenFileName(NULL,NULL,NULL,"open file dialog","Choose a STL file" ); - QString s = QFileDialog::getOpenFileName(NULL, "Choose a STL file", "/home", "*.stl"); - //QFileDialog* fd = new QFileDialog( NULL ); - //fd->setIconText(QString("Hallo")); - //fd->show(); - //TODO: Open File Dialog einbauen. - UbFileInputASCII in( s.toAscii().data() ); - stringstream stream; - stream <<"TriangularMesh3D ";//<<_objCount++; - FeTriFaceMesh3D *mesh = NULL;//FeTriFaceMesh3DCreator::readMeshFromSTLFile(&in, stream.str() ); - return mesh; - } - //QDialog* getSpecificInstrument() { return 0;} - void editGbObject3DwithQt(GbObject3D* gbObj) - { - } -#endif -#ifdef CAB_VTK -public: - Presentator* createObjectPresentator(ObObject *object) { return new vtkGbTriangularMesh3D((GbTriangularMesh3D*)object); } -#endif - - -private: - FeTriFaceMesh3DCreator( const FeTriFaceMesh3DCreator& ); //no copy allowed - const FeTriFaceMesh3DCreator& operator=( const FeTriFaceMesh3DCreator& ); //no copy allowed - FeTriFaceMesh3DCreator() : GbObject3DCreator() {} -}; - -#ifndef SWIG -UB_AUTO_RUN_NAMED( GbObject3DFactory::getInstance()->addObObjectCreator(FeTriFaceMesh3DCreator::getInstance()), CAB_FeTriFaceMesh3DCreator); -#endif - -#endif diff --git a/src/basics/geometry3d/presentation/QGbCuboid3DInstrument.cpp b/src/basics/geometry3d/presentation/QGbCuboid3DInstrument.cpp deleted file mode 100644 index 0e444b4b7..000000000 --- a/src/basics/geometry3d/presentation/QGbCuboid3DInstrument.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include "./QGbCuboid3DInstrument.h" - -/**** Qt ****/ -#include <qlineedit.h> -#include <qstring.h> -#include <qcheckbox.h> - -/**** CAB ****/ -#include "./../GbCuboid3D.h" -#include "./../GbPoint3D.h" - - -QGbCuboid3DInstrument::QGbCuboid3DInstrument( QWidget* parent, Qt::WFlags flags ):QDialog(parent, flags) -{ - ui.setupUi(this); - - this->gbCuboid = NULL; - -} - -QGbCuboid3DInstrument::~QGbCuboid3DInstrument() -{ -} - -void QGbCuboid3DInstrument::setGbCuboid3D(GbCuboid3D* cuboid) -{ - this->gbCuboid = cuboid; - ui.lineEditPoint1X->setText( QString("%1").arg(gbCuboid->getPoint1()->getX1Coordinate() ) ); - ui.lineEditPoint1Y->setText( QString("%1").arg(gbCuboid->getPoint1()->getX2Coordinate() ) ); - ui.lineEditPoint1Z->setText( QString("%1").arg(gbCuboid->getPoint1()->getX3Coordinate() ) ); - ui.lineEditPoint2X->setText( QString("%1").arg(gbCuboid->getPoint2()->getX1Coordinate() ) ); - ui.lineEditPoint2Y->setText( QString("%1").arg(gbCuboid->getPoint2()->getX2Coordinate() ) ); - ui.lineEditPoint2Z->setText( QString("%1").arg(gbCuboid->getPoint2()->getX3Coordinate() ) ); - //this->checkBoxActive->setChecked( cuboid->isActive() ); - ui.checkBoxActive->setChecked( true ); -} - -GbCuboid3D* QGbCuboid3DInstrument::getGbCuboid3D() -{ - return this->gbCuboid; -} - -//void QGbCuboid3DInstrument::SetGbObject3D(GbObject3D* gbObj) -//{ -// this->SetGbSphere(dynamic_cast<GbSphere3D*>(gbObj)); -//} - -void QGbCuboid3DInstrument::on_pBtnOK_clicked() -{ - this->gbCuboid->getPoint1()->setX1(ui.lineEditPoint1X->text().toDouble() ); - this->gbCuboid->getPoint1()->setX2(ui.lineEditPoint1Y->text().toDouble() ); - this->gbCuboid->getPoint1()->setX3(ui.lineEditPoint1Z->text().toDouble() ); - this->gbCuboid->getPoint2()->setX1(ui.lineEditPoint2X->text().toDouble() ); - this->gbCuboid->getPoint2()->setX2(ui.lineEditPoint2Y->text().toDouble() ); - this->gbCuboid->getPoint2()->setX3(ui.lineEditPoint2Z->text().toDouble() ); - //this->gbCuboid->setActive( this->checkBoxActive->isChecked() ); - - this->gbCuboid->notifyObserversObjectChanged(); - this->accept(); -} - - -void QGbCuboid3DInstrument::on_pBtnCancel_clicked() -{ - this->reject(); -} - diff --git a/src/basics/geometry3d/presentation/QGbCuboid3DInstrument.h b/src/basics/geometry3d/presentation/QGbCuboid3DInstrument.h deleted file mode 100644 index 312fb0efa..000000000 --- a/src/basics/geometry3d/presentation/QGbCuboid3DInstrument.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef QGBCUBOID3DINSTRUMENT_H -#define QGBCUBOID3DINSTRUMENT_H - - -#include "./QGbCuboid3DInstrumentUI.h" - -class GbCuboid3D; -class GbObject3D; - -class QGbCuboid3DInstrument : public QDialog -{ - Q_OBJECT - -public: - QGbCuboid3DInstrument( QWidget* parent = 0, Qt::WFlags fl = 0 ); - ~QGbCuboid3DInstrument(); - void setGbCuboid3D(GbCuboid3D* cuboid); - GbCuboid3D* getGbCuboid3D(); - -protected: - GbCuboid3D* gbCuboid; - -private: - Ui::QGbCuboid3DInstrument ui; - -private slots: - void on_pBtnOK_clicked(); - void on_pBtnCancel_clicked(); -}; - -#endif diff --git a/src/basics/geometry3d/presentation/QGbCuboid3DInstrument.ui b/src/basics/geometry3d/presentation/QGbCuboid3DInstrument.ui deleted file mode 100644 index e584634af..000000000 --- a/src/basics/geometry3d/presentation/QGbCuboid3DInstrument.ui +++ /dev/null @@ -1,347 +0,0 @@ -<ui version="4.0" > - <author></author> - <comment></comment> - <exportmacro></exportmacro> - <class>QGbCuboid3DInstrument</class> - <widget class="QDialog" name="QGbCuboid3DInstrument" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>252</width> - <height>239</height> - </rect> - </property> - <property name="windowTitle" > - <string>GbCuboid3DInstrument</string> - </property> - <layout class="QGridLayout" > - <property name="margin" > - <number>10</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="0" column="0" > - <widget class="QLabel" name="textLabel2" > - <property name="font" > - <font> - <family>Arial</family> - <pointsize>20</pointsize> - <weight>50</weight> - <italic>false</italic> - <bold>false</bold> - <underline>false</underline> - <strikeout>false</strikeout> - </font> - </property> - <property name="text" > - <string>Cuboid</string> - </property> - </widget> - </item> - <item row="1" column="0" colspan="4" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <layout class="QVBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabelPoint1" > - <property name="font" > - <font> - <family>Arial</family> - <pointsize>10</pointsize> - <weight>50</weight> - <italic>false</italic> - <bold>false</bold> - <underline>false</underline> - <strikeout>false</strikeout> - </font> - </property> - <property name="text" > - <string>Point 1:</string> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel1" > - <property name="text" > - <string>X:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEditPoint1X" > - <property name="text" > - <string>0</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel1_2" > - <property name="text" > - <string>Y:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEditPoint1Y" > - <property name="text" > - <string>0</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel1_3" > - <property name="text" > - <string>Z:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEditPoint1Z" > - <property name="text" > - <string>0</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - <item> - <layout class="QVBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabelPoint2" > - <property name="font" > - <font> - <family>Arial</family> - <pointsize>10</pointsize> - <weight>50</weight> - <italic>false</italic> - <bold>false</bold> - <underline>false</underline> - <strikeout>false</strikeout> - </font> - </property> - <property name="text" > - <string>Point 2:</string> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel1_4" > - <property name="text" > - <string>X:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEditPoint2X" > - <property name="text" > - <string>0</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel1_2_2" > - <property name="text" > - <string>Y:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEditPoint2Y" > - <property name="text" > - <string>0</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel1_3_2" > - <property name="text" > - <string>Z:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEditPoint2Z" > - <property name="text" > - <string>0</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - </layout> - </item> - <item row="0" column="2" colspan="2" > - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType" > - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="sizeHint" > - <size> - <width>90</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="4" column="0" > - <widget class="QPushButton" name="pBtnOK" > - <property name="text" > - <string>OK</string> - </property> - </widget> - </item> - <item row="4" column="3" > - <widget class="QPushButton" name="pBtnCancel" > - <property name="text" > - <string>Cancel</string> - </property> - </widget> - </item> - <item row="3" column="0" colspan="2" > - <spacer> - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType" > - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="sizeHint" > - <size> - <width>20</width> - <height>13</height> - </size> - </property> - </spacer> - </item> - <item row="2" column="3" > - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType" > - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="sizeHint" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="2" column="0" colspan="3" > - <widget class="QCheckBox" name="checkBoxActive" > - <property name="text" > - <string>Active</string> - </property> - <property name="checked" > - <bool>true</bool> - </property> - </widget> - </item> - <item row="4" column="1" > - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType" > - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="sizeHint" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <layoutdefault spacing="6" margin="11" /> - <pixmapfunction>qPixmapFromMimeSource</pixmapfunction> - <resources/> - <connections/> -</ui> diff --git a/src/basics/geometry3d/presentation/QGbCylinder3DInstrument.cpp b/src/basics/geometry3d/presentation/QGbCylinder3DInstrument.cpp deleted file mode 100644 index 34ff20fe1..000000000 --- a/src/basics/geometry3d/presentation/QGbCylinder3DInstrument.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include "./QGbCylinder3DInstrument.h" - -/**** Qt ****/ -#include <QtCore/QString> -#include <QtGui/QLineEdit> -#include <QtGui/QCheckBox> -#include <QtGui/QTabWidget> - -/**** CAB ****/ -#include "./../GbCylinder3D.h" -#include "./../GbPoint3D.h" - -QGbCylinder3DInstrument::QGbCylinder3DInstrument( QWidget* parent, Qt::WFlags flags ) -{ - ui.setupUi(this); - - /*JZ TODO daher Buttons noch ausgeschaltet (29.11.05)*/ - ui.rBtnXAxis->setEnabled(false); - ui.rBtnYAxis->setEnabled(false); - ui.rBtnZAxis->setEnabled(false); - - this->gbCylinder = NULL; -} - -QGbCylinder3DInstrument::~QGbCylinder3DInstrument(void) -{ -} - -void QGbCylinder3DInstrument::setGbCylinder3D(GbCylinder3D* cylinder) -{ - this->gbCylinder = cylinder; - ui.lineEdit1_X_1->setText( QString("%1").arg(gbCylinder->getPoint1()->x1 ) ); - ui.lineEdit1_Y_1->setText( QString("%1").arg(gbCylinder->getPoint1()->x2 ) ); - ui.lineEdit1_Z_1->setText( QString("%1").arg(gbCylinder->getPoint1()->x3 ) ); - ui.lineEdit1_X_2->setText( QString("%1").arg(gbCylinder->getPoint2()->x1 ) ); - ui.lineEdit1_Y_2->setText( QString("%1").arg(gbCylinder->getPoint2()->x2 ) ); - ui.lineEdit1_Z_2->setText( QString("%1").arg(gbCylinder->getPoint2()->x3 ) ); - ui.dSpBoxRadius1->setValue(gbCylinder->getRadius()); - ui.checkBoxActive1->setChecked( true ); - ui.lineEdit2_X->setText( QString("%1").arg(gbCylinder->getPoint1()->x1 ) ); - ui.lineEdit2_Y->setText( QString("%1").arg(gbCylinder->getPoint1()->x2 ) ); - ui.lineEdit2_Z->setText( QString("%1").arg(gbCylinder->getPoint1()->x3 ) ); - ui.dSpBoxRadius2->setValue(gbCylinder->getRadius()); - ui.checkBoxActive2->setChecked( true ); - ui.lineEditLength->setText( QString("%1").arg(gbCylinder->getHeight()) ); - //if (!this->gbCylinder->isParallelToX1Axis()) - //{ - // if (!this->gbCylinder->isParallelToX2Axis()) - // { - // ui.rBtnZAxis->setChecked(true); - // } - // else ui.rBtnYAxis->setChecked(true); - //} - //else ui.rBtnXAxis->setChecked(true); -} - -GbCylinder3D* QGbCylinder3DInstrument::getGbCylinder3D(void) -{ - return this->gbCylinder; -} - -//void QGbSphere3DInstrument::SetGbObject3D(GbObject3D* gbObj) -//{ -// this->SetGbSphere(dynamic_cast<GbSphere3D*>(gbObj)); -//} - -void QGbCylinder3DInstrument::on_pBtnOK_clicked() -{ - if(ui.tabWidget->currentIndex()==0) - { - this->gbCylinder->setPoint1( ui.lineEdit1_X_1->text().toDouble(), - ui.lineEdit1_Y_1->text().toDouble(), - ui.lineEdit1_Z_1->text().toDouble()); - - this->gbCylinder->setPoint2( ui.lineEdit1_X_2->text().toDouble(), - ui.lineEdit1_Y_2->text().toDouble(), - ui.lineEdit1_Z_2->text().toDouble()); - this->gbCylinder->setRadius(ui.dSpBoxRadius1->value()); - - this->gbCylinder->notifyObserversObjectChanged(); - } - if(ui.tabWidget->currentIndex()==1) - { - this->gbCylinder->setPoint1( ui.lineEdit2_X->text().toDouble(), - ui.lineEdit2_Y->text().toDouble(), - ui.lineEdit2_Z->text().toDouble()); - this->gbCylinder->setPoint2( ui.lineEdit2_X->text().toDouble(), - ui.lineEdit2_Y->text().toDouble()+ui.lineEditLength->text().toDouble(), - ui.lineEdit2_Z->text().toDouble()); - this->gbCylinder->setRadius(ui.dSpBoxRadius2->value()); - - this->gbCylinder->notifyObserversObjectChanged(); - } - - this->accept(); -} - - -void QGbCylinder3DInstrument::on_pBtnCancel_clicked() -{ - this->reject(); -} diff --git a/src/basics/geometry3d/presentation/QGbCylinder3DInstrument.h b/src/basics/geometry3d/presentation/QGbCylinder3DInstrument.h deleted file mode 100644 index 3ab65d380..000000000 --- a/src/basics/geometry3d/presentation/QGbCylinder3DInstrument.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef QGBCYLINDER3DINSTRUMENT_H -#define QGBCYLINDER3DINSTRUMENT_H - -#include <QtGui/QDialog> -#include <QtGui/QWidget> - -#include "./QGbCylinder3DInstrumentUI.h" -#include "./QGbObject3DInstrument.h" - -class GbCylinder3D; -class GbObject3D; - -class QGbCylinder3DInstrument : public QDialog -{ - - Q_OBJECT - -public: - QGbCylinder3DInstrument( QWidget* parent = 0, Qt::WFlags flags = 0 ); - ~QGbCylinder3DInstrument(); - void setGbCylinder3D(GbCylinder3D* cylinder); - GbCylinder3D* getGbCylinder3D(); - -protected: - GbCylinder3D* gbCylinder; - -private: - Ui::QGbCylinder3DInstrument ui; - -private slots: - void on_pBtnOK_clicked(); - void on_pBtnCancel_clicked(); -}; - -#endif \ No newline at end of file diff --git a/src/basics/geometry3d/presentation/QGbCylinder3DInstrument.ui b/src/basics/geometry3d/presentation/QGbCylinder3DInstrument.ui deleted file mode 100644 index 18f74c576..000000000 --- a/src/basics/geometry3d/presentation/QGbCylinder3DInstrument.ui +++ /dev/null @@ -1,682 +0,0 @@ -<ui version="4.0" > - <author></author> - <comment></comment> - <exportmacro></exportmacro> - <class>QGbCylinder3DInstrument</class> - <widget class="QDialog" name="QGbCylinder3DInstrument" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>457</width> - <height>347</height> - </rect> - </property> - <property name="windowTitle" > - <string>GbCylinder3DInstrument</string> - </property> - <layout class="QGridLayout" > - <property name="margin" > - <number>8</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="1" column="0" > - <widget class="QTabWidget" name="tabWidget" > - <widget class="QWidget" name="tabPoints" > - <attribute name="title" > - <string>Define by Points</string> - </attribute> - <layout class="QGridLayout" > - <property name="margin" > - <number>8</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="0" column="0" > - <widget class="QGroupBox" name="groupBox" > - <property name="title" > - <string>Base Centerpoint</string> - </property> - <layout class="QGridLayout" > - <property name="margin" > - <number>8</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="2" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel1_3_2" > - <property name="text" > - <string>Z:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEdit1_Z_1" > - <property name="text" > - <string>0.0</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="1" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel1_2_3" > - <property name="text" > - <string>Y:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEdit1_Y_1" > - <property name="text" > - <string>0.0</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="0" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel1_5" > - <property name="text" > - <string>X:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEdit1_X_1" > - <property name="text" > - <string>0.0</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item row="0" column="1" > - <widget class="QGroupBox" name="groupBox_2" > - <property name="title" > - <string>Top Centerpoint</string> - </property> - <layout class="QGridLayout" > - <property name="margin" > - <number>8</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="2" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel1_3_3_2_2" > - <property name="text" > - <string>Z:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEdit1_Z_2" > - <property name="text" > - <string>0.0</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="1" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel1_2_2_2_2" > - <property name="text" > - <string>Y:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEdit1_Y_2" > - <property name="text" > - <string>0.0</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="0" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel1_4_2_2" > - <property name="text" > - <string>X:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEdit1_X_2" > - <property name="text" > - <string>0.0</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item row="1" column="0" colspan="2" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QCheckBox" name="checkBoxActive1" > - <property name="text" > - <string>Active</string> - </property> - <property name="checked" > - <bool>true</bool> - </property> - </widget> - </item> - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" > - <size> - <width>51</width> - <height>60</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QGroupBox" name="groupBox_3_2" > - <property name="minimumSize" > - <size> - <width>16</width> - <height>60</height> - </size> - </property> - <property name="title" > - <string>Radius</string> - </property> - <layout class="QGridLayout" > - <property name="margin" > - <number>8</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="0" column="1" > - <widget class="QDoubleSpinBox" name="dSpBoxRadius1" > - <property name="decimals" > - <number>1</number> - </property> - <property name="maximum" > - <double>100</double> - </property> - <property name="value" > - <double>3</double> - </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QWidget" name="tabLength" > - <attribute name="title" > - <string>Define by Length</string> - </attribute> - <layout class="QGridLayout" > - <property name="margin" > - <number>8</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="0" column="1" > - <widget class="QGroupBox" name="groupBox_5" > - <property name="title" > - <string>Parameters</string> - </property> - <layout class="QGridLayout" > - <property name="margin" > - <number>8</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="2" column="0" colspan="2" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QRadioButton" name="rBtnXAxis" > - <property name="text" > - <string>X - Axis</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="rBtnYAxis" > - <property name="text" > - <string>Y - Axis</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="rBtnZAxis" > - <property name="text" > - <string>Z - Axis</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="0" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel1_5_2_2" > - <property name="text" > - <string>Length:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEditLength" > - <property name="text" > - <string>0.0</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="1" column="0" > - <widget class="QLabel" name="label" > - <property name="text" > - <string>Parallel to</string> - </property> - </widget> - </item> - <item row="0" column="1" > - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - <widget class="QWidget" name="widget_2" > - <property name="geometry" > - <rect> - <x>11</x> - <y>71</y> - <width>194</width> - <height>18</height> - </rect> - </property> - </widget> - </widget> - </item> - <item row="0" column="0" > - <widget class="QGroupBox" name="groupBox_4" > - <property name="title" > - <string>Base Centerpoint</string> - </property> - <layout class="QGridLayout" > - <property name="margin" > - <number>8</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="2" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel1_3_2_2" > - <property name="text" > - <string>Z:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEdit2_Z" > - <property name="text" > - <string>0.0</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="1" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel1_2_3_2" > - <property name="text" > - <string>Y:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEdit2_Y" > - <property name="text" > - <string>0.0</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="0" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel1_5_2" > - <property name="text" > - <string>X:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEdit2_X" > - <property name="text" > - <string>0.0</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item row="1" column="0" colspan="2" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QCheckBox" name="checkBoxActive2" > - <property name="text" > - <string>Active</string> - </property> - <property name="checked" > - <bool>true</bool> - </property> - </widget> - </item> - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" > - <size> - <width>51</width> - <height>60</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QGroupBox" name="groupBox_3_2_2" > - <property name="minimumSize" > - <size> - <width>16</width> - <height>60</height> - </size> - </property> - <property name="title" > - <string>Radius</string> - </property> - <layout class="QGridLayout" > - <property name="margin" > - <number>8</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="0" column="1" > - <widget class="QDoubleSpinBox" name="dSpBoxRadius2" > - <property name="decimals" > - <number>1</number> - </property> - <property name="maximum" > - <double>100</double> - </property> - <property name="value" > - <double>3</double> - </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </item> - </layout> - <widget class="QWidget" name="widget" > - <property name="geometry" > - <rect> - <x>9</x> - <y>9</y> - <width>415</width> - <height>101</height> - </rect> - </property> - </widget> - </widget> - </widget> - </item> - <item row="0" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel2" > - <property name="font" > - <font> - <family>Arial</family> - <pointsize>20</pointsize> - <weight>50</weight> - <italic>false</italic> - <bold>false</bold> - <underline>false</underline> - <strikeout>false</strikeout> - </font> - </property> - <property name="text" > - <string>Cylinder</string> - </property> - </widget> - </item> - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType" > - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="sizeHint" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item row="3" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QPushButton" name="pBtnOK" > - <property name="text" > - <string>OK</string> - </property> - </widget> - </item> - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="pBtnCancel" > - <property name="text" > - <string>Cancel</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="2" column="0" > - <spacer> - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" > - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <layoutdefault spacing="6" margin="11" /> - <pixmapfunction>qPixmapFromMimeSource</pixmapfunction> - <tabstops> - <tabstop>tabWidget</tabstop> - <tabstop>lineEdit1_X_1</tabstop> - <tabstop>lineEdit1_X_2</tabstop> - <tabstop>lineEdit1_Y_1</tabstop> - <tabstop>lineEdit1_Y_2</tabstop> - <tabstop>lineEdit1_Z_1</tabstop> - <tabstop>lineEdit1_Z_2</tabstop> - <tabstop>checkBoxActive1</tabstop> - <tabstop>dSpBoxRadius1</tabstop> - <tabstop>lineEdit2_X</tabstop> - <tabstop>lineEdit2_Y</tabstop> - <tabstop>lineEdit2_Z</tabstop> - <tabstop>lineEditLength</tabstop> - <tabstop>rBtnXAxis</tabstop> - <tabstop>rBtnYAxis</tabstop> - <tabstop>rBtnZAxis</tabstop> - <tabstop>checkBoxActive2</tabstop> - <tabstop>dSpBoxRadius2</tabstop> - <tabstop>pBtnOK</tabstop> - <tabstop>pBtnCancel</tabstop> - </tabstops> - <resources/> - <connections/> -</ui> diff --git a/src/basics/geometry3d/presentation/QGbObject3DInstrument.cpp b/src/basics/geometry3d/presentation/QGbObject3DInstrument.cpp deleted file mode 100644 index 62c4b2bf4..000000000 --- a/src/basics/geometry3d/presentation/QGbObject3DInstrument.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "./QGbObject3DInstrument.h" - -/**** Qt ****/ -#include <qlineedit.h> - -/**** vtk ****/ -#include "./../GbObject3D.h" -#include "./../../../basics/utilities/UbMath.h" - -//#define PI 3.14159265358979323846 - -QGbObject3DInstrument::QGbObject3DInstrument( QWidget* parent, Qt::WFlags flags ) -{ - ui.setupUi(this); - - this->gbObject3D = NULL; -} - -QGbObject3DInstrument::~QGbObject3DInstrument() -{ -} - -void QGbObject3DInstrument::setGbObject3D(GbObject3D* obj) -{ - this->gbObject3D = obj; -} - -GbObject3D* QGbObject3DInstrument::getGbObject3D() -{ - return this->gbObject3D; -} - -void QGbObject3DInstrument::on_pBtnOK_clicked() -{ - double rx = ui.lineEditRotationX->text().toDouble(); - double ry = ui.lineEditRotationY->text().toDouble(); - double rz = ui.lineEditRotationZ->text().toDouble(); - - rx *= UbMath::PI /180; - ry *= UbMath::PI /180; - rz *= UbMath::PI /180; - - if ( rx != 0.0 || ry != 0.0 || rz != 0.0 ) this->gbObject3D->rotate(rx, ry, rz); - - double sx = ui.lineEditScalingX->text().toDouble(); - double sy = ui.lineEditScalingY->text().toDouble(); - double sz = ui.lineEditScalingZ->text().toDouble(); - - if ( sx != 0.0 || sy != 0.0 || sz != 0.0 ) this->gbObject3D->scale(sx, sy, sz); - - double x = ui.lineEditTranlationX->text().toDouble(); - double y = ui.lineEditTranlationY->text().toDouble(); - double z = ui.lineEditTranlationZ->text().toDouble(); - - if ( x != 0.0 || y != 0.0 || z != 0.0 ) this->gbObject3D->translate(x, y, z); - - this->gbObject3D->notifyObserversObjectChanged(); - - this->accept(); -} - - -void QGbObject3DInstrument::on_pBtnCancel_clicked() -{ - this->reject(); -} diff --git a/src/basics/geometry3d/presentation/QGbObject3DInstrument.h b/src/basics/geometry3d/presentation/QGbObject3DInstrument.h deleted file mode 100644 index 5c3e556b5..000000000 --- a/src/basics/geometry3d/presentation/QGbObject3DInstrument.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef QGBOBJECT3DINSTRUMENT_H -#define QGBOBJECT3DINSTRUMENT_H - -#include <QDialog> -#include "./QGbObject3DInstrumentUI.h" - - -class GbObject3D; - -class QGbObject3DInstrument : public QDialog -{ - Q_OBJECT - -public: - QGbObject3DInstrument( QWidget* parent = 0, Qt::WFlags flags = 0 ); - ~QGbObject3DInstrument(); - void setGbObject3D(GbObject3D* gbObject); - GbObject3D* getGbObject3D(); - -protected: - GbObject3D *gbObject3D; - -private: - Ui::QGbObject3DInstrument ui; - -private slots: - void on_pBtnOK_clicked(); - void on_pBtnCancel_clicked(); -}; -#endif diff --git a/src/basics/geometry3d/presentation/QGbObject3DInstrument.ui b/src/basics/geometry3d/presentation/QGbObject3DInstrument.ui deleted file mode 100644 index 2fb6f96a9..000000000 --- a/src/basics/geometry3d/presentation/QGbObject3DInstrument.ui +++ /dev/null @@ -1,512 +0,0 @@ -<ui version="4.0" > - <author></author> - <comment></comment> - <exportmacro></exportmacro> - <class>QGbObject3DInstrument</class> - <widget class="QDialog" name="QGbObject3DInstrument" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>391</width> - <height>167</height> - </rect> - </property> - <property name="windowTitle" > - <string>GeneralModifyInstrument</string> - </property> - <layout class="QGridLayout" > - <property name="margin" > - <number>10</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="2" column="1" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QPushButton" name="pBtnOK" > - <property name="text" > - <string>OK</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="pBtnCancel" > - <property name="text" > - <string>Cancel</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="2" column="2" > - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType" > - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="sizeHint" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="2" column="0" > - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType" > - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="sizeHint" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="1" column="1" > - <spacer> - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType" > - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="sizeHint" > - <size> - <width>20</width> - <height>16</height> - </size> - </property> - </spacer> - </item> - <item row="0" column="0" colspan="3" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <layout class="QGridLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="0" column="0" > - <widget class="QLabel" name="textLabel1" > - <property name="font" > - <font> - <family>Tahoma</family> - <pointsize>10</pointsize> - <weight>50</weight> - <italic>false</italic> - <bold>false</bold> - <underline>false</underline> - <strikeout>false</strikeout> - </font> - </property> - <property name="text" > - <string>Translation:</string> - </property> - </widget> - </item> - <item row="3" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel2_2_2" > - <property name="font" > - <font> - <family>Tahoma</family> - <pointsize>10</pointsize> - <weight>50</weight> - <italic>false</italic> - <bold>false</bold> - <underline>false</underline> - <strikeout>false</strikeout> - </font> - </property> - <property name="text" > - <string>Z:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEditTranlationZ" > - <property name="text" > - <string>0.0</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="1" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel2" > - <property name="font" > - <font> - <family>Tahoma</family> - <pointsize>10</pointsize> - <weight>50</weight> - <italic>false</italic> - <bold>false</bold> - <underline>false</underline> - <strikeout>false</strikeout> - </font> - </property> - <property name="text" > - <string>X:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEditTranlationX" > - <property name="text" > - <string>0.0</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="2" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel2_2" > - <property name="font" > - <font> - <family>Tahoma</family> - <pointsize>10</pointsize> - <weight>50</weight> - <italic>false</italic> - <bold>false</bold> - <underline>false</underline> - <strikeout>false</strikeout> - </font> - </property> - <property name="text" > - <string>Y:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEditTranlationY" > - <property name="text" > - <string>0.0</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - <item> - <layout class="QGridLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="0" column="0" > - <widget class="QLabel" name="textLabel1_2" > - <property name="font" > - <font> - <family>Tahoma</family> - <pointsize>10</pointsize> - <weight>50</weight> - <italic>false</italic> - <bold>false</bold> - <underline>false</underline> - <strikeout>false</strikeout> - </font> - </property> - <property name="text" > - <string>Rotation:</string> - </property> - </widget> - </item> - <item row="3" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel2_2_2_2" > - <property name="font" > - <font> - <family>Tahoma</family> - <pointsize>10</pointsize> - <weight>50</weight> - <italic>false</italic> - <bold>false</bold> - <underline>false</underline> - <strikeout>false</strikeout> - </font> - </property> - <property name="text" > - <string>Z:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEditRotationZ" > - <property name="text" > - <string>0.0</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="1" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel2_3" > - <property name="font" > - <font> - <family>Tahoma</family> - <pointsize>10</pointsize> - <weight>50</weight> - <italic>false</italic> - <bold>false</bold> - <underline>false</underline> - <strikeout>false</strikeout> - </font> - </property> - <property name="text" > - <string>X:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEditRotationX" > - <property name="text" > - <string>0.0</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="2" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel2_2_3" > - <property name="font" > - <font> - <family>Tahoma</family> - <pointsize>10</pointsize> - <weight>50</weight> - <italic>false</italic> - <bold>false</bold> - <underline>false</underline> - <strikeout>false</strikeout> - </font> - </property> - <property name="text" > - <string>Y:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEditRotationY" > - <property name="text" > - <string>0.0</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - <item> - <layout class="QGridLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="0" column="0" > - <widget class="QLabel" name="textLabel1_2_2" > - <property name="font" > - <font> - <family>Tahoma</family> - <pointsize>10</pointsize> - <weight>50</weight> - <italic>false</italic> - <bold>false</bold> - <underline>false</underline> - <strikeout>false</strikeout> - </font> - </property> - <property name="text" > - <string>Scaling:</string> - </property> - </widget> - </item> - <item row="3" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel2_2_2_2_2" > - <property name="font" > - <font> - <family>Tahoma</family> - <pointsize>10</pointsize> - <weight>50</weight> - <italic>false</italic> - <bold>false</bold> - <underline>false</underline> - <strikeout>false</strikeout> - </font> - </property> - <property name="text" > - <string>Z:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEditScalingZ" > - <property name="text" > - <string>1.0</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="1" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel2_3_2" > - <property name="font" > - <font> - <family>Tahoma</family> - <pointsize>10</pointsize> - <weight>50</weight> - <italic>false</italic> - <bold>false</bold> - <underline>false</underline> - <strikeout>false</strikeout> - </font> - </property> - <property name="text" > - <string>X:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEditScalingX" > - <property name="text" > - <string>1.0</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="2" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel2_2_3_2" > - <property name="font" > - <font> - <family>Tahoma</family> - <pointsize>10</pointsize> - <weight>50</weight> - <italic>false</italic> - <bold>false</bold> - <underline>false</underline> - <strikeout>false</strikeout> - </font> - </property> - <property name="text" > - <string>Y:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEditScalingY" > - <property name="text" > - <string>1.0</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - </layout> - </item> - </layout> - </widget> - <layoutdefault spacing="6" margin="11" /> - <pixmapfunction>qPixmapFromMimeSource</pixmapfunction> - <resources/> - <connections/> -</ui> diff --git a/src/basics/geometry3d/presentation/QGbSphere3DInstrument.cpp b/src/basics/geometry3d/presentation/QGbSphere3DInstrument.cpp deleted file mode 100644 index bb397eda5..000000000 --- a/src/basics/geometry3d/presentation/QGbSphere3DInstrument.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "./QGbSphere3DInstrument.h" - -/**** Qt ****/ -#include <qlineedit.h> -#include <qstring.h> -#include <qcheckbox.h> - -/**** CAB ****/ -#include "./../GbSphere3D.h" - -QGbSphere3DInstrument::QGbSphere3DInstrument( QWidget* parent, Qt::WFlags flags ):QDialog(parent,flags) -{ - - ui.setupUi(this); - - this->gbSphere = NULL; -} - -QGbSphere3DInstrument::~QGbSphere3DInstrument(void) -{ -} - -void QGbSphere3DInstrument::setGbSphere3D(GbSphere3D* sphere) -{ - this->gbSphere = sphere; - ui.lineEditX->setText( QString("%1").arg(gbSphere->getX1Centroid() ) ); - ui.lineEditY->setText( QString("%1").arg(gbSphere->getX2Centroid() ) ); - ui.lineEditZ->setText( QString("%1").arg(gbSphere->getX3Centroid() ) ); - ui.lineEditName->setText( QString(gbSphere->getName().c_str()) ); - ui.lineEditRadius->setText( QString("%1").arg(gbSphere->getRadius() ) ); - ui.checkBoxActive->setChecked( true ); -} - -GbSphere3D* QGbSphere3DInstrument::getGbSphere3D(void) -{ - return this->gbSphere; -} - -//void QGbSphere3DInstrument::SetGbObject3D(GbObject3D* gbObj) -//{ -// this->SetGbSphere(dynamic_cast<GbSphere3D*>(gbObj)); -//} - -void QGbSphere3DInstrument::on_pBtnOK_clicked() -{ - this->gbSphere->setCenterX1Coordinate(ui.lineEditX->text().toDouble()); - this->gbSphere->setCenterX2Coordinate(ui.lineEditY->text().toDouble()); - this->gbSphere->setCenterX3Coordinate(ui.lineEditZ->text().toDouble()); - this->gbSphere->setRadius(ui.lineEditRadius->text().toDouble()); - this->gbSphere->setName(ui.lineEditName->text().toStdString()); - //this->gbSphere->setActive( this->checkBoxActive->isChecked() ); - this->gbSphere->notifyObserversObjectChanged(); - this->accept(); -} - - -void QGbSphere3DInstrument::on_pBtnCancel_clicked() -{ - this->reject(); -} diff --git a/src/basics/geometry3d/presentation/QGbSphere3DInstrument.h b/src/basics/geometry3d/presentation/QGbSphere3DInstrument.h deleted file mode 100644 index afe97b1ef..000000000 --- a/src/basics/geometry3d/presentation/QGbSphere3DInstrument.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef QGBSPHERE3DINSTRUMENT_H -#define QGBSPHERE3DINSTRUMENT_H - -#include <QtGui/QDialog> -#include <QtGui/QWidget> - -#include "./QGbSphere3DInstrumentUI.h" -#include "./QGbObject3DInstrument.h" - -class GbSphere3D; -class GbObject3D; - - -class QGbSphere3DInstrument : public QDialog -{ - Q_OBJECT - -public: - QGbSphere3DInstrument( QWidget* parent = 0, Qt::WFlags flags = 0 ); - ~QGbSphere3DInstrument(); - void setGbSphere3D(GbSphere3D* sphere); - GbSphere3D* getGbSphere3D(); - //void SetGbObject3D(GbObject3D*); - -protected: - GbSphere3D* gbSphere; - -private: - Ui::QGbSphere3DInstrument ui; - -private slots: - void on_pBtnOK_clicked(); - void on_pBtnCancel_clicked(); -}; - -#endif diff --git a/src/basics/geometry3d/presentation/QGbSphere3DInstrument.ui b/src/basics/geometry3d/presentation/QGbSphere3DInstrument.ui deleted file mode 100644 index dced5d31c..000000000 --- a/src/basics/geometry3d/presentation/QGbSphere3DInstrument.ui +++ /dev/null @@ -1,303 +0,0 @@ -<ui version="4.0" > - <author></author> - <comment></comment> - <exportmacro></exportmacro> - <class>QGbSphere3DInstrument</class> - <widget class="QDialog" name="QGbSphere3DInstrument" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>426</width> - <height>180</height> - </rect> - </property> - <property name="windowTitle" > - <string>GbSphere3DInstrument</string> - </property> - <widget class="QWidget" name="layoutWidget" > - <property name="geometry" > - <rect> - <x>10</x> - <y>50</y> - <width>406</width> - <height>82</height> - </rect> - </property> - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <layout class="QVBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel1" > - <property name="text" > - <string>X:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEditX" > - <property name="text" > - <string>0</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel1_2" > - <property name="text" > - <string>Y:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEditY" > - <property name="text" > - <string>0</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel1_3" > - <property name="text" > - <string>Z:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEditZ" > - <property name="text" > - <string>0</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - <item> - <layout class="QVBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <layout class="QVBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel1_3_2" > - <property name="text" > - <string>Radius:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEditRadius" > - <property name="text" > - <string>5</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - <item> - <widget class="QCheckBox" name="checkBoxActive" > - <property name="text" > - <string>Active</string> - </property> - <property name="checked" > - <bool>true</bool> - </property> - </widget> - </item> - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType" > - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="sizeHint" > - <size> - <width>20</width> - <height>16</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QWidget" name="layoutWidget" > - <property name="geometry" > - <rect> - <x>10</x> - <y>144</y> - <width>401</width> - <height>28</height> - </rect> - </property> - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QPushButton" name="pBtnOK" > - <property name="text" > - <string>OK</string> - </property> - </widget> - </item> - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType" > - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="sizeHint" > - <size> - <width>132</width> - <height>16</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="pBtnCancel" > - <property name="text" > - <string>Cancel</string> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="" > - <property name="geometry" > - <rect> - <x>12</x> - <y>12</y> - <width>401</width> - <height>35</height> - </rect> - </property> - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="textLabel2" > - <property name="font" > - <font> - <family>Arial</family> - <pointsize>20</pointsize> - <weight>50</weight> - <italic>false</italic> - <bold>false</bold> - <underline>false</underline> - <strikeout>false</strikeout> - </font> - </property> - <property name="text" > - <string>Sphere</string> - </property> - </widget> - </item> - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType" > - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="sizeHint" > - <size> - <width>101</width> - <height>33</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QLabel" name="textLabel1_3_3" > - <property name="text" > - <string>Name:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEditName" /> - </item> - </layout> - </widget> - </widget> - <layoutdefault spacing="6" margin="11" /> - <pixmapfunction>qPixmapFromMimeSource</pixmapfunction> - <resources/> - <connections/> -</ui> diff --git a/src/basics/geometry3d/presentation/QVTKGbObject3DViewer.cpp b/src/basics/geometry3d/presentation/QVTKGbObject3DViewer.cpp deleted file mode 100644 index 46f97bf4a..000000000 --- a/src/basics/geometry3d/presentation/QVTKGbObject3DViewer.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include "./QVTKGbObject3DViewer.h" - -/**** Qt ****/ -#include <qtabwidget.h> -#include <qlabel.h> -/**** vtk ****/ - -#include <QVTKWidget.h> -//#include "QvtkWindow.h" - -/**** CAB ****/ -#include "./../../../basics/utilities/UbMath.h" -#include "./../GbObject3DManager.h" - - -#include "./../../../userinterface/instrument/QManagerPresentatorInstrument.h" -//#include "./QGbObject3DManagerInstrument.h" - - - -QVTKGbObject3DViewer::QVTKGbObject3DViewer():QVTKViewer3DApplication() -{ - //GbObjectManagerInstrument - this->gbObject3DManager = new GbObject3DManager(); - QManagerPresentatorInstrument* gbObjManInst = new QManagerPresentatorInstrument(gbObject3DManager); - //gbObjManInst->setQViewer(this->getViewer()); - - //Instrumente hinzufügen - this->addInstrument(gbObjManInst, "Geometries"); -} - -QVTKGbObject3DViewer::~QVTKGbObject3DViewer() -{ -} - diff --git a/src/basics/geometry3d/presentation/QVTKGbObject3DViewer.h b/src/basics/geometry3d/presentation/QVTKGbObject3DViewer.h deleted file mode 100644 index 86b4cb831..000000000 --- a/src/basics/geometry3d/presentation/QVTKGbObject3DViewer.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef QVTKGBOBJECT3DVIEWER_H -#define QVTGBOBJECT3DKVIEWER_H - -#include "./../../../userinterface/viewer3d/QVTKViewer3DApplication.h" - -class QVTKWindow; -class QVTKViewer3D; -class GbObject3DManager; -class OctNodeGridManager; - -class QVTKGbObject3DViewer : public QVTKViewer3DApplication -{ -public: - QVTKGbObject3DViewer(); - ~QVTKGbObject3DViewer(); - -protected: - - GbObject3DManager* gbObject3DManager; - -}; -#endif diff --git a/src/basics/geometry3d/presentation/vtkGbCuboid3D.cpp b/src/basics/geometry3d/presentation/vtkGbCuboid3D.cpp deleted file mode 100644 index bfd53a09c..000000000 --- a/src/basics/geometry3d/presentation/vtkGbCuboid3D.cpp +++ /dev/null @@ -1,144 +0,0 @@ -#include "./vtkGbCuboid3D.h" - -#include "./../GbCuboid3D.h" -#include "./../../../userinterface/presentation/vtkEventCallbacks.h" - -#include "vtkCubeSource.h" -#include "vtkPolyDataMapper.h" -//#include "math.h" - -vtkGbCuboid3D::vtkGbCuboid3D(GbCuboid3D* gbObject) -{ - this->gbCuboid = gbObject; - this->gbCuboid->addObserver(this); - - this->setName("vtkGbCuboid3D"); - - this->source = vtkCubeSource::New(); - this->mapper = vtkPolyDataMapper::New(); - - this->setValues(); - - this->mapper->SetInput( this->source->GetOutput() ); - this->actor->SetMapper( this->mapper ); -} - -vtkGbCuboid3D::~vtkGbCuboid3D(void) -{ - this->gbCuboid->removeObserver(this); - if (this->source) this->source->Delete(); -} - -//void vtkGbCuboid3D::ModifiedEventFired() -//{ -// //double a_orien[3]; -// double a_pos[3]; -// this->actor->GetPosition(a_pos); -// //this->actor->GetOrientation(a_orien); -// this->actor->SetPosition(0.0,0.0,0.0); -// this->actor->SetOrientation(0.0,0.0,0.0); -// this->actor->SetScale(1.0,1.0,1.0); -// -// //cout<<"Orien:"<<a_orien[0]<<","<<a_orien[1]<<","<<a_orien[3]<<endl; -// //cout<<"Position:"<<a_pos[0]<<","<<a_pos[1]<<","<<a_pos[3]<<endl; -// -// this->gbCuboid->translate(a_pos[0], a_pos[1], a_pos[2]); -// this->gbCuboid->notifyObserversObjectChanged(); -//} - -void vtkGbCuboid3D::applyActorModifications() -{ - if (isModified) - { - double pos[3]; - double scale[3]; - //double orien[3]; - this->actor->GetPosition(pos); - this->actor->GetScale(scale); - //this->actor->GetOrientation(orien); - - this->actor->SetPosition(0.0,0.0,0.0); - this->actor->SetOrientation(0.0,0.0,0.0); - this->actor->SetScale(1.0,1.0,1.0); - - //cout<<"Orien:"<<a_orien[0]<<","<<a_orien[1]<<","<<a_orien[3]<<endl; - //cout<<"Position:"<<a_pos[0]<<","<<a_pos[1]<<","<<a_pos[3]<<endl; - - - //////////////////////////////////////////////////////////////////////////// - ////Rotieren - ////[Cy x1 + Sy x3, x2, -Sy x1 + Cy x3, 1] - //double center[3]; - //center[0] = this->gbCuboid->getX1Centroid(); - //center[1] = this->gbCuboid->getX2Centroid(); - //center[2] = this->gbCuboid->getX3Centroid(); - - ////Punkt1 - //double p1x = this->gbCuboid->getPoint1()->getX1Coordinate(); - //double p1y = this->gbCuboid->getPoint1()->getX2Coordinate(); - //double p1z = this->gbCuboid->getPoint1()->getX3Coordinate(); - - //p1x = cos(orien[1]) * p1x + sin(orien[1]) * p1z; - ////p1y = p1y; - //p1z = -sin(orien[1]) * p1x + cos(orien[1]) * p1z; - - //this->gbCuboid->getPoint1()->setX1(p1x); - //this->gbCuboid->getPoint1()->setX2(p1y); - //this->gbCuboid->getPoint1()->setX3(p1z); - - // - ////Punkt2 - //double p2x = this->gbCuboid->getPoint2()->getX1Coordinate(); - //double p2y = this->gbCuboid->getPoint2()->getX2Coordinate(); - //double p2z = this->gbCuboid->getPoint2()->getX3Coordinate(); - - //p2x = cos(orien[1]) * p2x + sin(orien[1]) * p2z; - ////p1y = p1y; - //p2z = -sin(orien[1]) * p2x + cos(orien[1]) * p2z; - - //this->gbCuboid->getPoint2()->setX1(p2x); - //this->gbCuboid->getPoint2()->setX2(p2y); - //this->gbCuboid->getPoint2()->setX3(p2z); - // - //////////////////////////////////////////////////////////////////////////// - - if (scale[0] != 1.0) this->gbCuboid->scale(scale[0], scale[1], scale[2]); - else this->gbCuboid->translate(pos[0], pos[1], pos[2]); - this->gbCuboid->notifyObserversObjectChanged(); - - //Methode der Basisklasse aufrufen. - vtkPoElement3D::applyActorModifications(); - } -} - -void vtkGbCuboid3D::setValues(void) -{ - double bounds[6]; - bounds[0] = this->gbCuboid->getX1Minimum(); - bounds[1] = this->gbCuboid->getX1Maximum(); - bounds[2] = this->gbCuboid->getX2Minimum(); - bounds[3] = this->gbCuboid->getX2Maximum(); - bounds[4] = this->gbCuboid->getX3Minimum(); - bounds[5] = this->gbCuboid->getX3Maximum(); - this->source->SetBounds(bounds); - -// this->actor->SetVisibility( this->gbCuboid->isActive() ); -} - -bool vtkGbCuboid3D::isPointInObject(double const point[3]) -{ - return this->gbCuboid->isPointInGbObject3D(point[0], point[1], point[2]); -} - -void vtkGbCuboid3D::objectChanged(UbObservable*) -{ - this->setValues(); - this->source->Update(); -} - -void vtkGbCuboid3D::objectWillBeDeleted(UbObservable*) -{ - //TODO: Hier muss auf jeden Fall noch was geschehen.... - this->gbCuboid->removeObserver(this); - delete this; -} diff --git a/src/basics/geometry3d/presentation/vtkGbCuboid3D.h b/src/basics/geometry3d/presentation/vtkGbCuboid3D.h deleted file mode 100644 index 4163d4467..000000000 --- a/src/basics/geometry3d/presentation/vtkGbCuboid3D.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef VTKGBCUBOID3D_H -#define VTKGBCUBOID3D_H - -#include "./../../../userinterface/presentation/vtkPoElement3D.h" - -/**** vtk ****/ -class vtkCubeSource; -class vtkPolyDataMapper; - -class GbCuboid3D; - -class vtkGbCuboid3D : public vtkPoElement3D -{ -public: - vtkGbCuboid3D(GbCuboid3D*); - ~vtkGbCuboid3D(void); - void objectChanged(UbObservable*); - void objectWillBeDeleted(UbObservable*); - //void ModifiedEventFired(void); - void applyActorModifications(); - bool isPointInObject(double const point[3]); -protected: - void setValues(); - - GbCuboid3D* gbCuboid; - vtkCubeSource* source; - vtkPolyDataMapper* mapper; -}; -#endif diff --git a/src/basics/geometry3d/presentation/vtkGbCylinder3D.cpp b/src/basics/geometry3d/presentation/vtkGbCylinder3D.cpp deleted file mode 100644 index 77390a146..000000000 --- a/src/basics/geometry3d/presentation/vtkGbCylinder3D.cpp +++ /dev/null @@ -1,103 +0,0 @@ -#include "./vtkGbCylinder3D.h" - -#include "./../GbCylinder3D.h" -#include "./../GbPoint3D.h" -#include "./../../../userinterface/presentation/vtkEventCallbacks.h" - -#include "vtkCylinderSource.h" -#include "vtkPolyDataMapper.h" - - -vtkGbCylinder3D::vtkGbCylinder3D(GbCylinder3D* gbObject) -{ - this->gbCylinder = gbObject; - this->gbCylinder->addObserver(this); - - this->setName("vtkGbCylinder3D"); - - this->source = vtkCylinderSource::New(); - this->mapper = vtkPolyDataMapper::New(); - - this->setValues(); - - this->mapper->SetInput( this->source->GetOutput() ); - this->actor->SetMapper( this->mapper ); - - //this->applyActorModifications(); -} - -vtkGbCylinder3D::~vtkGbCylinder3D(void) -{ - this->gbCylinder->removeObserver(this); - if (this->source) this->source->Delete(); -} - - -void vtkGbCylinder3D::setValues(void) -{ - //this->source->SetCenter( this->gbCylinder->getX1Centroid(), - // this->gbCylinder->getX2Centroid(), - // this->gbCylinder->getX3Centroid()); - //this->source->SetHeight(this->gbCylinder->getLength()); - //this->source->SetRadius( this->gbCylinder->getRadius()); - - /* JZ Attention not ready still some work TODO*/ - this->source->SetHeight(this->gbCylinder->getHeight()); - this->source->SetCenter(this->gbCylinder->getX1Centroid(), - this->gbCylinder->getX2Centroid(), - this->gbCylinder->getX3Centroid()); - this->source->SetRadius( this->gbCylinder->getRadius() ); - this->source->SetResolution(10); -} - -void vtkGbCylinder3D::applyActorModifications() -{ - //this->actor->SetScale(1.0, this->gbCylinder->getLength(), 1.0); - this->source->SetHeight(this->gbCylinder->getHeight()); - this->actor->SetPosition( this->gbCylinder->getPoint1()->x1, - this->gbCylinder->getPoint1()->x2, - this->gbCylinder->getPoint1()->x3); - this->source->SetRadius( this->gbCylinder->getRadius() ); - - - - //if (this->isModified) - //{ - // double pos[3]; - // double scale[3]; - // this->actor->GetPosition(pos); - // this->actor->GetScale(scale); - - // this->actor->SetPosition(0.0,0.0,0.0); - // this->actor->SetOrientation(0.0,0.0,0.0); - // this->actor->SetScale(1.0,1.0,1.0); - - - // if (scale[0] != 1.0) this->gbCylinder->scale(scale[0], scale[1], scale[2]); - // else this->gbCylinder->translate(pos[0], pos[1], pos[2]); - // this->gbCylinder->notifyObserversObjectChanged(); - - // vtkPoElement3D::applyActorModifications(); - //} -} - -bool vtkGbCylinder3D::isPointInObject(double const point[3]) -{ - return this->gbCylinder->isPointInGbObject3D(point[0], point[1], point[2]); -} - -//Wird aufgerufen, wenn sich das zugehörige GBObject3D ändert. -void vtkGbCylinder3D::objectChanged(UbObservable*) -{ - this->setValues(); -// this->applyActorModifications(); - this->source->Modified(); -} - -void vtkGbCylinder3D::objectWillBeDeleted(UbObservable*) -{ - //TODO: Hier muss auf jeden Fall noch was geschehen.... - this->gbCylinder->removeObserver(this); - delete this; -} - diff --git a/src/basics/geometry3d/presentation/vtkGbCylinder3D.h b/src/basics/geometry3d/presentation/vtkGbCylinder3D.h deleted file mode 100644 index 19da3417b..000000000 --- a/src/basics/geometry3d/presentation/vtkGbCylinder3D.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef VTKGBCYLINDER3D_H -#define VTKGBCYLINDER3D_H - -#include "./../../../userinterface/presentation/vtkPoElement3D.h" - -class GbCylinder3D; - -class vtkCylinderSource; -class vtkPolyDataMapper; - - -class vtkGbCylinder3D : public vtkPoElement3D -{ -public: - vtkGbCylinder3D(GbCylinder3D* cylinder); - ~vtkGbCylinder3D(); - void objectChanged(UbObservable*); - void objectWillBeDeleted(UbObservable*); - //void ModifiedEventFired(void); - void applyActorModifications(); - bool isPointInObject(double const point[3]); -protected: - void setValues(); - - GbCylinder3D* gbCylinder; - vtkCylinderSource* source; - vtkPolyDataMapper* mapper; -}; -#endif - diff --git a/src/basics/geometry3d/presentation/vtkGbSphere3D.cpp b/src/basics/geometry3d/presentation/vtkGbSphere3D.cpp deleted file mode 100644 index bac51ecc1..000000000 --- a/src/basics/geometry3d/presentation/vtkGbSphere3D.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include "./vtkGbSphere3D.h" - -#include "./../GbSphere3D.h" -#include "./../../../userinterface/presentation/vtkEventCallbacks.h" - -#include "vtkSphereSource.h" -#include "vtkPolyDataMapper.h" - - -vtkGbSphere3D::vtkGbSphere3D(GbSphere3D* gbObject):vtkPoElement3D() -{ - this->gbSphere = gbObject; - this->gbSphere->addObserver(this); - - this->setName("vtkGbSphere3D"); - - - this->source = vtkSphereSource::New(); - this->mapper = vtkPolyDataMapper::New(); - - this->setValues(); - - this->mapper->SetInput( this->source->GetOutput() ); - this->actor->SetMapper( this->mapper ); -// this->actor->GetProperty()->SetRepresentationToWireframe(); -} - -vtkGbSphere3D::~vtkGbSphere3D(void) -{ - this->gbSphere->removeObserver(this); - if (this->source) this->source->Delete(); -} - -//void vtkGbSphere3D::ModifiedEventFired() -//{ -// ////double a_orien[3]; -// //double a_pos[3]; -// ////double a_scale[3]; -// //this->actor->GetPosition(a_pos); -// ////this->actor->GetOrientation(a_orien); -// ////this->actor->GetScale(a_scale); -// -// //this->actor->SetPosition(0.0,0.0,0.0); -// //this->actor->SetOrientation(0.0,0.0,0.0); -// //this->actor->SetScale(1.0,1.0,1.0); -// // -// ////cout<<"Orien:"<<a_orien[0]<<","<<a_orien[1]<<","<<a_orien[3]<<endl; -// ////cout<<"Position:"<<a_pos[0]<<","<<a_pos[1]<<","<<a_pos[3]<<endl; -// ////cout<<"Scale:"<<a_scale[0]<<","<<a_scale[1]<<","<<a_scale[3]<<endl; -// -// //this->gbSphere->translate(a_pos[0], a_pos[1], a_pos[2]); -// //this->gbSphere->notifyObserversObjectChanged(); -// PoElement3D::ModifiedEventFired(); -//} - -void vtkGbSphere3D::setValues(void) -{ - this->source->SetCenter( this->gbSphere->getX1Centroid(), - this->gbSphere->getX2Centroid(), - this->gbSphere->getX3Centroid() ); - - this->source->SetRadius( this->gbSphere->getRadius() ); -// this->actor->SetVisibility( this->gbSphere->isActive() ); -} - -void vtkGbSphere3D::applyActorModifications() -{ - if (this->isModified) - { - //double a_orien[3]; - double pos[3]; - double scale[3]; - this->actor->GetPosition(pos); - //this->actor->GetOrientation(a_orien); - this->actor->GetScale(scale); - - this->actor->SetPosition(0.0,0.0,0.0); - this->actor->SetOrientation(0.0,0.0,0.0); - this->actor->SetScale(1.0,1.0,1.0); - - //cout<<"Orien:"<<a_orien[0]<<","<<a_orien[1]<<","<<a_orien[3]<<endl; - //cout<<"Position:"<<a_pos[0]<<","<<a_pos[1]<<","<<a_pos[3]<<endl; - //cout<<"Scale:"<<a_scale[0]<<","<<a_scale[1]<<","<<a_scale[3]<<endl; - - if (scale[0] != 1.0) this->gbSphere->scale(scale[0], scale[1], scale[2]); - else this->gbSphere->translate(pos[0], pos[1], pos[2]); - this->gbSphere->notifyObserversObjectChanged(); - - vtkPoElement3D::applyActorModifications(); - } -} - -bool vtkGbSphere3D::isPointInObject(double const point[3]) -{ - return this->gbSphere->isPointInGbObject3D(point[0], point[1], point[2]); -} - -//Wird aufgerufen, wenn sich das zugehörige GBObject3D ändert. -void vtkGbSphere3D::objectChanged(UbObservable*) -{ - this->setValues(); - this->source->Modified(); - this->actor->Modified(); -} - -void vtkGbSphere3D::objectWillBeDeleted(UbObservable*) -{ - //TODO: Hier muss auf jeden Fall noch was geschehen.... - this->gbSphere->removeObserver(this); - delete this; -} - diff --git a/src/basics/geometry3d/presentation/vtkGbSphere3D.h b/src/basics/geometry3d/presentation/vtkGbSphere3D.h deleted file mode 100644 index dd6c1f696..000000000 --- a/src/basics/geometry3d/presentation/vtkGbSphere3D.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef VTKGBSPHERE3D_H -#define VTKGBSPHERE3D_H - -#include "./../../../userinterface/presentation/vtkPoElement3D.h" -//#include "./../../../../vtkEventListeners.h" - -class GbSphere3D; - -class vtkSphereSource; -class vtkPolyDataMapper; - -class vtkGbSphere3D : public vtkPoElement3D -{ -public: - vtkGbSphere3D(GbSphere3D*); - ~vtkGbSphere3D(void); - void objectChanged(UbObservable*); - void objectWillBeDeleted(UbObservable*); - //void ModifiedEventFired(void); - void applyActorModifications(); - bool isPointInObject(double const point[3]); - - virtual string toString() { return "vtkGbSphere3D"; } - -protected: - void setValues(); - - GbSphere3D* gbSphere; - vtkPolyDataMapper* mapper; - vtkSphereSource* source; -}; -#endif - diff --git a/src/basics/geometry3d/presentation/vtkGbTriangularMesh3D.cpp b/src/basics/geometry3d/presentation/vtkGbTriangularMesh3D.cpp deleted file mode 100644 index f772e7c97..000000000 --- a/src/basics/geometry3d/presentation/vtkGbTriangularMesh3D.cpp +++ /dev/null @@ -1,167 +0,0 @@ -#include "./vtkGbTriangularMesh3D.h" - -/**** CAB ****/ -#include "./../GbTriangularMesh3D.h" -#include "./../GbTriangle3D.h" -#include "./../../../basics/utilities/UbMath.h" - -/**** vtk ****/ -#include "vtkUnstructuredGrid.h" -#include "vtkDataSetMapper.h" -#include "vtkPoints.h" -#include "vtkTriangle.h" -#include "vtkIdList.h" - -/*** temp ****/ -#include "./../GbPoint3D.h" -#include "vtkMatrix4x4.h" - -//#define PI 3.14159265358979323846 - -vtkGbTriangularMesh3D::vtkGbTriangularMesh3D(GbTriangularMesh3D* mesh) -{ - this->gbTriangularMesh = mesh; - this->gbTriangularMesh->addObserver(this); - - this->setName("vtkGbTriangularMesh3D"); - - this->unstGrid = vtkUnstructuredGrid::New(); - this->buildGrid(); - - - this->dataSetMapper = vtkDataSetMapper::New(); - this->dataSetMapper->SetInput(unstGrid); - - this->actor->SetMapper( this->dataSetMapper ); -} - -vtkGbTriangularMesh3D::~vtkGbTriangularMesh3D(void) -{ - this->gbTriangularMesh->removeObserver(this); - this->unstGrid->Delete(); - this->dataSetMapper->Delete(); -} - -//void vtkGbTriangularMesh3D::ModifiedEventFired() -//{ -// double pos[3]; -// this->actor->GetPosition(pos); -// -// this->actor->SetPosition(0.0,0.0,0.0); -// this->actor->SetOrientation(0.0,0.0,0.0); -// this->actor->SetScale(1.0,1.0,1.0); -// -// double x1 = pos[0]; -// double x2 = pos[1]; -// double x3 = pos[3]; -// -// vector<GbPoint3D*>* pointList = this->gbTriangularMesh->getNodes(); -// for (int pos=0; pos<pointList->size(); pos++) -// { -// (*pointList)[pos]->translate(x1,x2,x3); -// //((*pointList)[pos])->translate(pos[0], pos[1], pos[3]); -// } -// this->gbTriangularMesh->notifyObserversObjectChanged(); -//} - -void vtkGbTriangularMesh3D::applyActorModifications() -{ - if (isModified) - { - double pos[3]; - double orien[3]; - double scale[3]; - this->actor->GetPosition(pos); - this->actor->GetOrientation(orien); - this->actor->GetScale(scale); - - orien[0] = orien[0] / 180 * UbMath::PI; - orien[1] = orien[1] / 180 * UbMath::PI; - orien[2] = orien[2] / 180 * UbMath::PI; - - //cout<<"Orien:"<<orien[0]<<","<<orien[1]<<","<<orien[3]<<endl; - //cout<<"Position:"<<pos[0]<<","<<pos[1]<<","<<pos[3]<<endl; - //cout<<"Scale:"<<scale[0]<<","<<scale[1]<<","<<scale[3]<<endl; - - this->actor->SetPosition(0.0,0.0,0.0); - this->actor->SetOrientation(0.0,0.0,0.0); - this->actor->SetScale(1.0,1.0,1.0); - - vector<GbPoint3D*>* pointList = this->gbTriangularMesh->getNodes(); - for (int index=0; index<(int)pointList->size(); index++) - { - (*pointList)[index]->rotate(orien[0], orien[1], orien[2]); - (*pointList)[index]->scale(scale[0], scale[1], scale[2]); - (*pointList)[index]->translate(pos[0], pos[1], pos[2]); - } - this->gbTriangularMesh->notifyObserversObjectChanged(); - //Methode der Basisklasse aufrufen. - vtkPoElement3D::applyActorModifications(); - } -} - -void vtkGbTriangularMesh3D::buildGrid(void) -{ - this->unstGrid->Reset(); - - vector<GbTriangle3D*>* triangles = this->gbTriangularMesh->getTriangles(); - double xyz[3]; - //this.setContext(new PoContext3D()); - - vtkPoints* points = vtkPoints::New(); - vtkTriangle* triangle = vtkTriangle::New(); - for(int u=0; u<(int)triangles->size(); u++) - { - xyz[0] = (*triangles)[u]->getPoint(0)->getX1Coordinate(); - xyz[1] = (*triangles)[u]->getPoint(0)->getX2Coordinate(); - xyz[2] = (*triangles)[u]->getPoint(0)->getX3Coordinate(); - triangle->GetPointIds()->InsertId(0, points->InsertNextPoint(xyz)); - //points.InsertPoint(u, xyz); // 3D geometry - - xyz[0] = (*triangles)[u]->getPoint(1)->getX1Coordinate(); - xyz[1] = (*triangles)[u]->getPoint(1)->getX2Coordinate(); - xyz[2] = (*triangles)[u]->getPoint(1)->getX3Coordinate(); - triangle->GetPointIds()->InsertId(1, points->InsertNextPoint(xyz)); - //points.InsertPoint(u, xyz); // 3D geometry - - xyz[0] = (*triangles)[u]->getPoint(2)->getX1Coordinate(); - xyz[1] = (*triangles)[u]->getPoint(2)->getX2Coordinate(); - xyz[2] = (*triangles)[u]->getPoint(2)->getX3Coordinate(); - triangle->GetPointIds()->InsertId(2, points->InsertNextPoint(xyz)); - //points.InsertPoint(u, xyz); // 3D geometry - - this->insertNextCell( triangle->GetCellType(), triangle->GetPointIds() ); // grid topology - - } - this->setPoints(points); - //this->source->SetCenter( this->gbSphere->getX1Centroid(), - // this->gbSphere->getX2Centroid(), - // this->gbSphere->getX3Centroid() ); - - //this->source->SetRadius( this->gbSphere->getRadius() ); - //this->actor->SetVisibility( this->gbSphere->isActive() ); - //this->unstGrid->Modified(); -} - -int vtkGbTriangularMesh3D::insertNextCell(int type, vtkIdList* idList) -{ - return this->unstGrid->InsertNextCell(type, idList); -} - -void vtkGbTriangularMesh3D::setPoints(vtkPoints* points) -{ - this->unstGrid->SetPoints(points); -} - -void vtkGbTriangularMesh3D::objectChanged(UbObservable*) -{ - this->buildGrid(); - this->unstGrid->Update(); -} - -void vtkGbTriangularMesh3D::objectWillBeDeleted(UbObservable*) -{ - //TODO: Hier muss auf jeden Fall noch was geschehen.... - this->gbTriangularMesh->removeObserver(this); - delete this; -} diff --git a/src/basics/geometry3d/presentation/vtkGbTriangularMesh3D.h b/src/basics/geometry3d/presentation/vtkGbTriangularMesh3D.h deleted file mode 100644 index 968f98846..000000000 --- a/src/basics/geometry3d/presentation/vtkGbTriangularMesh3D.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef VTKGBTRIANGULARMESH3D_H -#define VTKGBTRIANGULARMESH3D_H - -#include "./../../../userinterface/presentation/vtkPoElement3D.h" - -class GbTriangularMesh3D; -class vtkUnstructuredGrid; -class vtkDataSetMapper; -class vtkIdList; -class vtkPoints; - -class vtkGbTriangularMesh3D : public vtkPoElement3D -{ -public: - vtkGbTriangularMesh3D(GbTriangularMesh3D* mesh); - ~vtkGbTriangularMesh3D(); - void objectChanged(UbObservable* ); - void objectWillBeDeleted(UbObservable* ); - int insertNextCell(int, vtkIdList*); - void setPoints(vtkPoints*); - //void ModifiedEventFired(void); - void applyActorModifications(); -protected: - void buildGrid(); - - GbTriangularMesh3D* gbTriangularMesh; - vtkUnstructuredGrid* unstGrid; - vtkDataSetMapper* dataSetMapper; -}; -#endif - diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAdapter.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAdapter.h index f91e6ad48..2a5223765 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAdapter.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAdapter.h @@ -11,10 +11,8 @@ #include "BoundaryConditions.h" #include "basics/objects/ObObject.h" -#include "basics/objects/ObObjectCreator.h" #include "basics/utilities/UbFileOutput.h" #include "basics/utilities/UbFileInput.h" -#include "basics/utilities/UbAutoRun.hpp" #include "BCAlgorithm.h" diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBCAdapter.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBCAdapter.h index 9da55f374..64caced01 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBCAdapter.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBCAdapter.h @@ -37,7 +37,6 @@ public: //------------- implements D3Q27BoundaryConditionAdapter ----- start std::string toString(); - ObObjectCreator* getCreator(); void init(const D3Q27Interactor* const& interactor, const double& time=0); void update(const D3Q27Interactor* const& interactor, const double& time=0); diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.h index f846d405f..462cf564a 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.h @@ -66,7 +66,6 @@ public: } //------------- implements D3Q27BoundaryConditionAdapter ----- start - ObObjectCreator* getCreator(); void init(const D3Q27Interactor* const& interactor, const double& timestep=0) {} void update(const D3Q27Interactor* const& interactor, const double& timestep=0) {} diff --git a/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp b/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp index 3bf919dde..89ddd366e 100644 --- a/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp +++ b/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp @@ -1,7 +1,6 @@ #include "D3Q27TriFaceMeshInteractor.h" #include <basics/utilities/UbMath.h> #include <basics/utilities/UbLogger.h> -#include <basics/utilities/UbStaticPathMap.h> #include <basics/writer/WbWriterVtkBinary.h> #include <basics/writer/WbWriterVtkXmlBinary.h> -- GitLab