From 9623a4f25ba0b3771b5912b3e8fd91535dfa94ef Mon Sep 17 00:00:00 2001 From: Soeren Peters <peters@irmb.tu-bs.de> Date: Wed, 30 Sep 2020 16:14:01 +0200 Subject: [PATCH] Update Coprocessors. --- .../CoProcessors/CoProcessor.cpp | 33 ++++++++++++ .../CoProcessors/CoProcessor.h | 45 ++++++++++++++++ .../CoProcessors/NUPSCounterCoProcessor.cpp | 51 ++++++++++++------- .../CoProcessors/NUPSCounterCoProcessor.h | 49 +++++++++++++++--- .../CoProcessors/WriteBlocksCoProcessor.cpp | 33 ++++++++++++ .../CoProcessors/WriteBlocksCoProcessor.h | 49 +++++++++++++++--- .../WriteBoundaryConditionsCoProcessor.cpp | 35 ++++++++++++- .../WriteBoundaryConditionsCoProcessor.h | 43 ++++++++++++++++ .../WriteMacroscopicQuantitiesCoProcessor.cpp | 33 ++++++++++++ .../WriteMacroscopicQuantitiesCoProcessor.h | 49 +++++++++++++++++- 10 files changed, 388 insertions(+), 32 deletions(-) diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/CoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/CoProcessor.cpp index e03555d59..cd74e2322 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/CoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/CoProcessors/CoProcessor.cpp @@ -1,3 +1,36 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file CoProcessor.cpp +//! \ingroup CoProcessors +//! \author Konstantin Kutscher +//======================================================================================= + #include "CoProcessor.h" #include "Grid3D.h" diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/CoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/CoProcessor.h index 69fc1e33b..6abcda31a 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/CoProcessor.h +++ b/src/cpu/VirtualFluidsCore/CoProcessors/CoProcessor.h @@ -1,3 +1,36 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file CoProcessor.h +//! \ingroup CoProcessors +//! \author Konstantin Kutscher +//======================================================================================= + #ifndef CoProcessor_H #define CoProcessor_H @@ -6,12 +39,24 @@ class Grid3D; class UbScheduler; +//! \class CoProcessor +//! \brief An abstract class implements observer design pettern class CoProcessor { public: + //! Class default constructor CoProcessor(); + //! \brief Construct CoProcessor object for grid object and scheduler object. + //! \pre The Grid3D and UbScheduler objects must exist. + //! \param grid is observable Grid3D object + //! \param s is UbScheduler object for scheduling of observer + //! \details + //! Class CoProcessor implements the observer design pettern. CoProcessor object is observer. Grid3D object is observable. CoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s); + //! Class destructor virtual ~CoProcessor(); + //! \brief Updates observer + //! \param step is the actual time step virtual void process(double step) = 0; protected: SPtr<Grid3D> grid; diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.cpp index a42e2aa37..482d9a05d 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.cpp @@ -1,3 +1,36 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file NUPSCounterCoProcessor.cpp +//! \ingroup CoProcessors +//! \author Konstantin Kutscher +//======================================================================================= + #include "NUPSCounterCoProcessor.h" #include "Communicator.h" @@ -19,9 +52,7 @@ NUPSCounterCoProcessor::NUPSCounterCoProcessor(SPtr<Grid3D> grid, SPtr<UbSchedul double nop = comm->getNumberOfProcesses(); int minInitLevel = grid->getCoarsestInitializedLevel(); int maxInitLevel = grid->getFinestInitializedLevel(); - int gl = 2; UbTupleInt3 blocknx = grid->getBlockNX(); - //double nod = (val<1>(blocknx)+gl) * (val<2>(blocknx)+gl) * (val<3>(blocknx)+gl); double nod = (double)(val<1>(blocknx)) * (double)(val<2>(blocknx)) * (double)(val<3>(blocknx)); nup = 0; @@ -49,28 +80,14 @@ void NUPSCounterCoProcessor::collectData(double step) if (comm->getProcessID() == comm->getRoot()) { double time = timer.stop(); - //double time = timer.elapsed(); - //std::ofstream ostr; - //std::string fname = path; - //ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app); - //if(!ostr) - //{ - // ostr.clear(); - // std::string path = UbSystem::getPathFromString(fname); - // if(path.size()>0){ UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);} - // if(!ostr) throw UbException(UB_EXARGS,"couldn't open file "+fname); - //} double nups_t = nup_t*(step-nupsStep)/time; - double nups = nup*(step-nupsStep)/time;//timer.getTotalTime(); + double nups = nup*(step-nupsStep)/time; double tnups = nups/(double)numOfThreads; - //ostr << nups << std::endl; - //ostr.close(); UBLOG(logINFO, "Calculation step = "<<step); UBLOG(logINFO, "Total performance = "<<nups_t<<" NUPS"); UBLOG(logINFO, "Performance per process = "<<nups<<" NUPS"); UBLOG(logINFO, "Performance per thread = "<<tnups<<" NUPS"); UBLOG(logINFO, "Time for " << step-nupsStep <<" steps = "<< time <<" s"); - //timer.restart(); nupsStep = step; timer.resetAndStart(); } diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.h index dd101a6ee..6c6802521 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.h @@ -1,9 +1,35 @@ -/* -* NUPSCounterCoProcessor.h -* -* Created on: 03.05.2011 -* Author: K. Kucher -*/ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file NUPSCounterCoProcessor.h +//! \ingroup CoProcessors +//! \author Konstantin Kutscher +//======================================================================================= #ifndef NUPSCOUNTERCoProcessor_H_ #define NUPSCOUNTERCoProcessor_H_ @@ -17,18 +43,27 @@ class Communicator; class Grid3D; class UbScheduler; +//! \class NUPSCounterCoProcessor +//! \brief A class calculates Nodal Updates Per Second (NUPS) class NUPSCounterCoProcessor: public CoProcessor { public: + //! \brief Construct NUPSCounterCoProcessor object for grid object and scheduler object. + //! \pre The Grid3D and UbScheduler objects must exist. + //! \param grid is observable Grid3D object + //! \param s is UbScheduler object for scheduling of observer + //! \param numOfThreads is number of threads + //! \param comm is Communicator object NUPSCounterCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, int numOfThreads, SPtr<Communicator> comm); virtual ~NUPSCounterCoProcessor(); void process(double step)override; protected: + //! Collect data for calculation of NUPS + //! \param step is a time step void collectData(double step); UbTimer timer; - //boost::timer timer; int numOfThreads; double numberOfNodes; double numberOfBlocks; diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBlocksCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/WriteBlocksCoProcessor.cpp index f27d2d59f..57a23c176 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBlocksCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteBlocksCoProcessor.cpp @@ -1,3 +1,36 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file WriteBlocksCoProcessor.cpp +//! \ingroup CoProcessors +//! \author Konstantin Kutscher +//======================================================================================= + #include "WriteBlocksCoProcessor.h" #include "basics/writer/WbWriterVtkXmlASCII.h" diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBlocksCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/WriteBlocksCoProcessor.h index 041d29586..352029cd1 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBlocksCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteBlocksCoProcessor.h @@ -1,9 +1,35 @@ -/* -* WriteBlocksCoProcessor.h -* -* Created on: 24.09.2012 -* Author: K. Kucher -*/ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file WriteBlocksCoProcessor.h +//! \ingroup CoProcessors +//! \author Konstantin Kutscher +//======================================================================================= #ifndef WriteBlocksCoProcessor_H_ #define WriteBlocksCoProcessor_H_ @@ -18,15 +44,26 @@ class Grid3D; class UbScheduler; class WbWriter; +//! \class WriteBlocksCoProcessor +//! \brief A class writes a block grid to a VTK-file class WriteBlocksCoProcessor: public CoProcessor { public: + //! \brief Construct WriteBlocksCoProcessor object. + //! \pre The Grid3D and UbScheduler objects must exist. + //! \param grid is observable Grid3D object + //! \param s is UbScheduler object for scheduling of observer + //! \param path is path of folder for output + //! \param writer is WbWriter object + //! \param comm is Communicator object WriteBlocksCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& path, WbWriter* const writer, SPtr<Communicator> comm); virtual ~WriteBlocksCoProcessor(); void process(double step) override; protected: + //! Collect data for VTK-file + //! \param step is a time step void collectData(double step); std::string path; diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBoundaryConditionsCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/WriteBoundaryConditionsCoProcessor.cpp index d74e1edf3..5749cd0cb 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBoundaryConditionsCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteBoundaryConditionsCoProcessor.cpp @@ -1,3 +1,36 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file WriteBoundaryConditionsCoProcessor.cpp +//! \ingroup CoProcessors +//! \author Konstantin Kutscher +//======================================================================================= + #include "WriteBoundaryConditionsCoProcessor.h" #include "LBMKernel.h" #include "BCProcessor.h" @@ -130,7 +163,7 @@ void WriteBoundaryConditionsCoProcessor::addDataGeo(SPtr<Block3D> block) SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); //knotennummerierung faengt immer bei 0 an! - unsigned int SWB, SEB, NEB, NWB, SWT, SET, NET, NWT; + unsigned int SWB, SEB, NEB, NWB, SWT, SET, NET, NWT; int minX1 = 0; int minX2 = 0; diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBoundaryConditionsCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/WriteBoundaryConditionsCoProcessor.h index 407d56b3e..ff73768ab 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBoundaryConditionsCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteBoundaryConditionsCoProcessor.h @@ -1,3 +1,36 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file WriteBoundaryConditionsCoProcessor.h +//! \ingroup CoProcessors +//! \author Konstantin Kutscher +//======================================================================================= + #ifndef WriteBoundaryConditionsCoProcessor_H #define WriteBoundaryConditionsCoProcessor_H @@ -15,16 +48,26 @@ class WbWriter; class Block3D; class LBMUnitConverter; +//! \brief A class writes boundary conditions information to a VTK-file class WriteBoundaryConditionsCoProcessor : public CoProcessor { public: WriteBoundaryConditionsCoProcessor(); + //! \brief Construct WriteBoundaryConditionsCoProcessor object + //! \pre The Grid3D and UbScheduler objects must exist + //! \param grid is observable Grid3D object + //! \param s is UbScheduler object for scheduling of observer + //! \param path is path of folder for output + //! \param writer is WbWriter object + //! \param comm is Communicator object WriteBoundaryConditionsCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& path, WbWriter* const writer, SPtr<Communicator> comm); ~WriteBoundaryConditionsCoProcessor() {} void process(double step) override; protected: + //! Collect data for VTK-file + //! \param step is a time step void collectData(double step); void addDataGeo(SPtr<Block3D> block); void clearData(); diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp index 25ce8cd39..8a08d4344 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp @@ -1,3 +1,36 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file WriteMacroscopicQuantitiesCoProcessor.cpp +//! \ingroup CoProcessors +//! \author Konstantin Kutscher +//======================================================================================= + #include "WriteMacroscopicQuantitiesCoProcessor.h" #include "LBMKernel.h" #include "BCProcessor.h" diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.h index e112fc10a..d650bc881 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.h @@ -1,3 +1,36 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file WriteMacroscopicQuantitiesCoProcessor.h +//! \ingroup CoProcessors +//! \author Konstantin Kutscher +//======================================================================================= + #ifndef WriteMacroscopicQuantitiesCoProcessor_H #define WriteMacroscopicQuantitiesCoProcessor_H @@ -6,7 +39,7 @@ #include <vector> #include "CoProcessor.h" - +#include "UbTuple.h" #include "LBMSystem.h" class Communicator; @@ -16,10 +49,20 @@ class LBMUnitConverter; class WbWriter; class Block3D; + +//! \brief A class writes macroscopic quantities information to a VTK-file class WriteMacroscopicQuantitiesCoProcessor : public CoProcessor { public: WriteMacroscopicQuantitiesCoProcessor(); + //! \brief Construct WriteMacroscopicQuantitiesCoProcessor object + //! \pre The Grid3D and UbScheduler objects must exist + //! \param grid is observable Grid3D object + //! \param s is UbScheduler object for scheduling of observer + //! \param path is path of folder for output + //! \param writer is WbWriter object + //! \param conv is LBMUnitConverter object + //! \param comm is Communicator object WriteMacroscopicQuantitiesCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& path, WbWriter* const writer, SPtr<LBMUnitConverter> conv, SPtr<Communicator> comm); @@ -28,7 +71,11 @@ public: void process(double step) override; protected: + //! Collect data for VTK-file + //! \param step is a time step void collectData(double step); + //! Collect data for VTK-file + //! \param block is a time step void addDataMQ(SPtr<Block3D> block); void clearData(); -- GitLab