From 1f242d8911b5762ec7dabf7438ab435ca50228d3 Mon Sep 17 00:00:00 2001 From: HRN Date: Fri, 27 Dec 2024 19:26:09 +0330 Subject: [PATCH] Some changes to be compatible with phasicFlowPlus-v1.0 --- CMakeLists.txt | 5 +- cmake/makeExecutableGlobals.cmake | 4 +- cmake/makeLibraryGlobals.cmake | 4 +- .../eventSubscriber/eventMessage.hpp | 116 ------------------ .../eventSubscriber/eventObserver.cpp | 56 --------- .../eventSubscriber/eventObserver.hpp | 65 ---------- .../eventSubscriber/eventSubscriber.cpp | 92 -------------- .../eventSubscriber/eventSubscriber.hpp | 64 ---------- utilities/Utilities/CMakeLists.txt | 2 +- 9 files changed, 7 insertions(+), 401 deletions(-) delete mode 100644 src/phasicFlow/eventSubscriber/eventMessage.hpp delete mode 100644 src/phasicFlow/eventSubscriber/eventObserver.cpp delete mode 100644 src/phasicFlow/eventSubscriber/eventObserver.hpp delete mode 100644 src/phasicFlow/eventSubscriber/eventSubscriber.cpp delete mode 100644 src/phasicFlow/eventSubscriber/eventSubscriber.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 962c594d..fbb2eaf2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ else() set(Kokkos_Source_DIR $ENV{HOME}/Kokkos/kokkos) endif() message(STATUS "Kokkos source directory is ${Kokkos_Source_DIR}") -add_subdirectory(${Kokkos_Source_DIR} ${phasicFlow_BINARY_DIR}/kokkos) +add_subdirectory(${Kokkos_Source_DIR} ./kokkos) Kokkos_cmake_settings() @@ -68,14 +68,13 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) #add a global include directory include_directories(src/setHelpers src/demComponent "${PROJECT_BINARY_DIR}") - add_subdirectory(src) add_subdirectory(solvers) add_subdirectory(utilities) -#add_subdirectory(DEMSystems) +add_subdirectory(DEMSystems) install(FILES "${PROJECT_BINARY_DIR}/phasicFlowConfig.H" DESTINATION include) diff --git a/cmake/makeExecutableGlobals.cmake b/cmake/makeExecutableGlobals.cmake index 06c48e14..45d77e4e 100644 --- a/cmake/makeExecutableGlobals.cmake +++ b/cmake/makeExecutableGlobals.cmake @@ -31,8 +31,8 @@ target_include_directories(${target_name} message(STATUS "\nCreating make file for executable ${target_name}") message(STATUS " ${target_name} link libraries are: ${${target_link_libs}}") -message(STATUS " ${target_name} source files are: ${${source_files}}") -message(STATUS " ${target_name} include dirs are: ${includeDirs}\n") +#message(STATUS " ${target_name} source files are: ${${source_files}}") +#message(STATUS " ${target_name} include dirs are: ${includeDirs}\n") install(TARGETS ${target_name} DESTINATION bin) diff --git a/cmake/makeLibraryGlobals.cmake b/cmake/makeLibraryGlobals.cmake index 4197983b..95d52a47 100644 --- a/cmake/makeLibraryGlobals.cmake +++ b/cmake/makeLibraryGlobals.cmake @@ -41,8 +41,8 @@ target_include_directories(${target_name} message(STATUS "\nCreating make file for library ${target_name}") message(STATUS " ${target_name} link libraries are: ${${target_link_libs}}") -message(STATUS " ${target_name} source files are: ${source_files}") -message(STATUS " ${target_name} include dirs are: ${includeDirs}\n \n") +#message(STATUS " ${target_name} source files are: ${source_files}") +#message(STATUS " ${target_name} include dirs are: ${includeDirs}\n \n") install(TARGETS ${target_name} DESTINATION lib) install(FILES ${includeFiles} DESTINATION include/${target_name}) diff --git a/src/phasicFlow/eventSubscriber/eventMessage.hpp b/src/phasicFlow/eventSubscriber/eventMessage.hpp deleted file mode 100644 index cfd57ab6..00000000 --- a/src/phasicFlow/eventSubscriber/eventMessage.hpp +++ /dev/null @@ -1,116 +0,0 @@ -/*------------------------------- phasicFlow --------------------------------- - O C enter of - O O E ngineering and - O O M ultiscale modeling of - OOOOOOO F luid flow ------------------------------------------------------------------------------- - Copyright (C): www.cemf.ir - email: hamid.r.norouzi AT gmail.com ------------------------------------------------------------------------------- -Licence: - This file is part of phasicFlow code. It is a free software for simulating - granular and multiphase flows. You can redistribute it and/or modify it under - the terms of GNU General Public License v3 or any other later versions. - - phasicFlow is distributed to help others in their research in the field of - granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - ------------------------------------------------------------------------------*/ - - -#ifndef __eventMessage_hpp__ -#define __eventMessage_hpp__ - - -namespace pFlow -{ - -class eventMessage -{ -public: - enum event : unsigned int - { - DELETE = 1, - INSERT = 2, - REARRANGE = 4, - SIZE_CHANGED = 8, - CAP_CHANGED = 16, - RANGE_CHANGED = 32 - }; - -protected: - - unsigned int message_; - -public: - - eventMessage() - : - message_(0) - {} - - eventMessage(unsigned int msg) - : - message_(msg) - {} - - inline unsigned int get()const - { - return message_; - } - - inline void set(unsigned int msg) - { - message_= msg; - } - - inline void add(unsigned int msg) - { - message_ = message_+ msg; - } - - inline bool equivalentTo( const event& evt )const - { - return (message_ & evt) == evt; - } - - inline bool isNull()const - { - return message_ == 0u; - } - inline bool isDeleted()const - { - return equivalentTo(event::DELETE); - } - - inline bool isInsert()const - { - return equivalentTo(event::INSERT); - } - - inline bool isRearranged()const - { - return equivalentTo(event::REARRANGE); - } - - inline bool isSizeChanged()const - { - return equivalentTo(event::SIZE_CHANGED); - } - - inline bool isCapacityChanged()const - { - return equivalentTo(event::CAP_CHANGED); - } - - inline bool isRangeChanged()const - { - return equivalentTo(event::RANGE_CHANGED); - } - -}; - -} - -#endif // __eventMessage_hpp__ diff --git a/src/phasicFlow/eventSubscriber/eventObserver.cpp b/src/phasicFlow/eventSubscriber/eventObserver.cpp deleted file mode 100644 index 0010aefc..00000000 --- a/src/phasicFlow/eventSubscriber/eventObserver.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/*------------------------------- phasicFlow --------------------------------- - O C enter of - O O E ngineering and - O O M ultiscale modeling of - OOOOOOO F luid flow ------------------------------------------------------------------------------- - Copyright (C): www.cemf.ir - email: hamid.r.norouzi AT gmail.com ------------------------------------------------------------------------------- -Licence: - This file is part of phasicFlow code. It is a free software for simulating - granular and multiphase flows. You can redistribute it and/or modify it under - the terms of GNU General Public License v3 or any other later versions. - - phasicFlow is distributed to help others in their research in the field of - granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - ------------------------------------------------------------------------------*/ - -#include "eventObserver.hpp" -#include "eventSubscriber.hpp" - -pFlow::eventObserver::eventObserver(): - subscriber_(nullptr), - subscribed_(false) -{} - -pFlow::eventObserver::eventObserver -( - const eventSubscriber& subscriber, - bool subscribe -) -: - subscriber_(&subscriber), - subscribed_(false) -{ - if(subscribe && subscriber_) - { - subscribed_ = subscriber_->subscribe(this); - } -} - -pFlow::eventObserver::~eventObserver() -{ - if(subscribed_ && subscriber_) - subscriber_->unsubscribe(this); -} - -bool pFlow::eventObserver::subscribe(const eventSubscriber& subscriber) -{ - subscriber_ = &subscriber; - subscribed_ = subscriber_->subscribe(this); - return subscribed_; -} - diff --git a/src/phasicFlow/eventSubscriber/eventObserver.hpp b/src/phasicFlow/eventSubscriber/eventObserver.hpp deleted file mode 100644 index aa4efd08..00000000 --- a/src/phasicFlow/eventSubscriber/eventObserver.hpp +++ /dev/null @@ -1,65 +0,0 @@ -/*------------------------------- phasicFlow --------------------------------- - O C enter of - O O E ngineering and - O O M ultiscale modeling of - OOOOOOO F luid flow ------------------------------------------------------------------------------- - Copyright (C): www.cemf.ir - email: hamid.r.norouzi AT gmail.com ------------------------------------------------------------------------------- -Licence: - This file is part of phasicFlow code. It is a free software for simulating - granular and multiphase flows. You can redistribute it and/or modify it under - the terms of GNU General Public License v3 or any other later versions. - - phasicFlow is distributed to help others in their research in the field of - granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - ------------------------------------------------------------------------------*/ - - -#ifndef __eventObserver_hpp__ -#define __eventObserver_hpp__ - -#include "eventMessage.hpp" - -namespace pFlow -{ - -class eventSubscriber; - - -class eventObserver -{ -protected: - - const eventSubscriber* subscriber_ = nullptr; - - // if this object is linked to subscriber - bool subscribed_ = false; - -public: - - eventObserver(); - - eventObserver(const eventSubscriber& subscriber, bool subscribe = true ); - - virtual ~eventObserver(); - - inline bool subscribed()const {return subscribed_;} - - bool subscribe(const eventSubscriber& subscriber); - - inline void invalidateSubscriber() - { - subscribed_ = false; - } - - virtual bool update(const eventMessage& msg)=0; -}; - -} // pFlow - - -#endif // __eventObserver_hpp__ diff --git a/src/phasicFlow/eventSubscriber/eventSubscriber.cpp b/src/phasicFlow/eventSubscriber/eventSubscriber.cpp deleted file mode 100644 index 2b187cde..00000000 --- a/src/phasicFlow/eventSubscriber/eventSubscriber.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/*------------------------------- phasicFlow --------------------------------- - O C enter of - O O E ngineering and - O O M ultiscale modeling of - OOOOOOO F luid flow ------------------------------------------------------------------------------- - Copyright (C): www.cemf.ir - email: hamid.r.norouzi AT gmail.com ------------------------------------------------------------------------------- -Licence: - This file is part of phasicFlow code. It is a free software for simulating - granular and multiphase flows. You can redistribute it and/or modify it under - the terms of GNU General Public License v3 or any other later versions. - - phasicFlow is distributed to help others in their research in the field of - granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - ------------------------------------------------------------------------------*/ - - -#include "eventSubscriber.hpp" -#include "Set.hpp" - -pFlow::eventSubscriber::~eventSubscriber() -{ - for(auto& observer:observerList_) - { - observer->invalidateSubscriber(); - } -} - -bool pFlow::eventSubscriber::subscribe -( - eventObserver* observer -)const -{ - if(observer) - { - observerList_.push_back(observer); - return true; - } - else - { - return false; - } -} - -bool pFlow::eventSubscriber::unsubscribe -( - eventObserver* observer -)const -{ - if(observer) - { - observerList_.remove(observer); - } - return true; -} - -bool pFlow::eventSubscriber::notify -( - const eventMessage &msg -) -{ - for ( auto& observer:observerList_ ) - { - if(observer) - if( !observer->update(msg) ) return false; - } - - return true; -} - -bool pFlow::eventSubscriber::notify -( - const eventMessage& msg, - const List& exclutionList -) -{ - Set sortedExcList(exclutionList.begin(),exclutionList.end()); - - for(auto& observer:observerList_) - { - if( observer && sortedExcList.count(observer) == 0 ) - { - if(!observer->update(msg)) return false; - } - } - - return true; -} \ No newline at end of file diff --git a/src/phasicFlow/eventSubscriber/eventSubscriber.hpp b/src/phasicFlow/eventSubscriber/eventSubscriber.hpp deleted file mode 100644 index 26e98e2c..00000000 --- a/src/phasicFlow/eventSubscriber/eventSubscriber.hpp +++ /dev/null @@ -1,64 +0,0 @@ -/*------------------------------- phasicFlow --------------------------------- - O C enter of - O O E ngineering and - O O M ultiscale modeling of - OOOOOOO F luid flow ------------------------------------------------------------------------------- - Copyright (C): www.cemf.ir - email: hamid.r.norouzi AT gmail.com ------------------------------------------------------------------------------- -Licence: - This file is part of phasicFlow code. It is a free software for simulating - granular and multiphase flows. You can redistribute it and/or modify it under - the terms of GNU General Public License v3 or any other later versions. - - phasicFlow is distributed to help others in their research in the field of - granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - ------------------------------------------------------------------------------*/ - - -#ifndef __eventSubscriber_hpp__ -#define __eventSubscriber_hpp__ - -#include "List.hpp" -#include "eventObserver.hpp" -#include "eventMessage.hpp" - -namespace pFlow -{ - - - -class eventSubscriber -{ -protected: - - // - list of subsribed objectd that recieve updage messages - mutable List observerList_; - -public: - - eventSubscriber() - {} - - virtual ~eventSubscriber(); - - virtual bool subscribe(eventObserver* observer)const; - - virtual bool unsubscribe(eventObserver* observer)const; - - bool notify(const eventMessage& msg); - - bool notify(const eventMessage& msg, const List& exclutionList ); - - - -}; - -} // pFlow - - - -#endif // __eventSubscriber_hpp__ diff --git a/utilities/Utilities/CMakeLists.txt b/utilities/Utilities/CMakeLists.txt index 598a542a..e39fea4a 100644 --- a/utilities/Utilities/CMakeLists.txt +++ b/utilities/Utilities/CMakeLists.txt @@ -1,7 +1,7 @@ set(SourceFiles readFromTimeFolder.cpp -#readControlDict.cpp +readControlDict.cpp vtkFile/vtkFile.cpp geometryPhasicFlow/Wall/Wall.cpp geometryPhasicFlow/planeWall/planeWall.cpp