diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index ccde036a316f8337c5170f422366d611885239b8..244634e4152ed23dd3e57856ed99796488f7e72d 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -22,18 +22,20 @@ add_library( ) set(COSTO_INSTALL_DIR "/home/chantraitt/softs/04-costo/install/depot_git") - -add_library(costo SHARED IMPORTED) # or STATIC instead of SHARED -set_target_properties(costo PROPERTIES - IMPORTED_LOCATION "${COSTO_INSTALL_DIR}/lib/libcosto.so" +add_library(CPO SHARED IMPORTED) # or STATIC instead of SHARED +set_target_properties(CPO PROPERTIES + IMPORTED_LOCATION ${COSTO_INSTALL_DIR}/lib/libCPO.so INTERFACE_INCLUDE_DIRECTORIES "${COSTO_INSTALL_DIR}/includes" ) -target_link_libraries( +target_include_directories(PugsUtils + PUBLIC "${COSTO_INSTALL_DIR}/includes/utils" +) + target_link_libraries( PugsUtils ${PETSC_LIBRARIES} ${SLEPC_LIBRARIES} - costo + CPO ) # --------------- get git revision info --------------- diff --git a/src/utils/Messenger.cpp b/src/utils/Messenger.cpp index 6a17cdae7f66c10d07c8392691ef329f7ae498b1..92f8c5f51d52343e94290c368c7becbc55a6c630 100644 --- a/src/utils/Messenger.cpp +++ b/src/utils/Messenger.cpp @@ -1,6 +1,5 @@ #include <utils/Messenger.hpp> -#include "couplingObjects.hpp" #include <utils/CommunicatorManager.hpp> #include <iostream> @@ -35,8 +34,9 @@ Messenger::Messenger([[maybe_unused]] int& argc, [[maybe_unused]] char* argv[]) MPI_Init(&argc, &argv); if (CommunicatorManager::hasSplitColor()) { - costo::coupling myCoupling = costo::coupling(CommunicatorManager::splitColor()); - m_pugs_comm_world = myCoupling.getLocalComm(); + myCoupling = new costo::coupling(CommunicatorManager::splitColor()); + + m_pugs_comm_world = myCoupling->getLocalComm(); /* auto res = */ /* MPI_Comm_split(MPI_COMM_WORLD, CommunicatorManager::splitColor(), key, &m_pugs_comm_world); */ /* if (res) { */ diff --git a/src/utils/Messenger.hpp b/src/utils/Messenger.hpp index 7b0c8e1ac98514b12e34b49a507cde53fb6453bb..5e067f036875ba8c5815594d09b56def85650338 100644 --- a/src/utils/Messenger.hpp +++ b/src/utils/Messenger.hpp @@ -16,6 +16,9 @@ #include <mpi.h> #endif // PUGS_HAS_MPI +#include "/home/chantraitt/softs/04-costo/install/depot_git/includes/couplingObjects.hpp" +#include "/home/chantraitt/softs/04-costo/install/depot_git/includes/utils/costoMacros.hpp" +#include <utils/CommunicatorManager.hpp> #include <utils/Exceptions.hpp> #include <utils/PugsTraits.hpp> @@ -406,6 +409,8 @@ class Messenger } public: + costo::coupling* myCoupling = nullptr; + static void create(int& argc, char* argv[]); static void destroy(); diff --git a/src/utils/Serializer.cpp b/src/utils/Serializer.cpp index 77bb699960872e1f267d6f531518c2b915b5bc40..081df24da20d5fe17aa40530486481ffb5063846 100644 --- a/src/utils/Serializer.cpp +++ b/src/utils/Serializer.cpp @@ -1,4 +1,6 @@ #include <mesh/MeshNodeBoundary.hpp> +#include <utils/FPEManager.hpp> +#include <utils/Messenger.hpp> #include <utils/Serializer.hpp> void @@ -54,8 +56,27 @@ Serializer::Serializer(const std::shared_ptr<const IBoundaryDescriptor>& boundar for (unsigned short j = 0; j < MeshType::Dimension; ++j) { pts[2 * r + j] = positions[r][j]; } - std::cout << "\033[01;31m" << pts[2 * r] << "; " << pts[2 * r + 1] << "\033[00;00m" << std::endl; + /* std::cout << "\033[01;31m" << pts[2 * r] << "; " << pts[2 * r + 1] << "\033[00;00m" << std::endl; */ } + const int dest = 1; + const int tag = 100; + std::vector<int> shape; + shape.resize(3); + shape[0] = mesh->numberOfNodes(); + shape[1] = 2; + shape[2] = 0; + std::cout << "\033[01;31m" + << "LA0" + << "\033[00;00m" << std::endl; + parallel::Messenger::getInstance().myCoupling->sendData(shape, pts, dest, tag); + std::cout << "\033[01;31m" + << "LA1" + << "\033[00;00m" << std::endl; + + std::vector<int> recv; + const int src = 1; + parallel::Messenger::getInstance().myCoupling->recvData(recv, src, tag + 10); + /* mess.myCoupling->sendData(shape, pts, dest, tag); */ /* for (size_t i_node = 0; i_node < mesh->numberOfNodes(); i_node++) { */ /* std::cout << "\033[01;31m" << coords [[i_node]] << "\033[00;00m" << std::endl; */