Microflow 3D  v1.0
ThreadArray.h
Go to the documentation of this file.
1 // ==============================================================================================
2 // Microflow 3D, http://www.microflow.pwr.edu.pl/
3 // Created by Roman Szafran on 18.05.19.
4 // Copyright (c) 2019 Wroclaw University of Science and Technology.
5 // Distributed under the Apache License, Version 2.0. You may obtain a copy of the License at
6 // http://www.apache.org/licenses/LICENSE-2.0 or see accompanying file license.txt.
7 // Redistributions of source code must retain the above copyright and license notice.
8 // ==============================================================================================
9 
10 # pragma once
11 
12 #include <memory>
13 #include <vector>
14 #include <GeometryBuilder/NodeID.h>
15 
16 #include "MFDatabase/Thread.h"
17 
18 namespace MF {
19  namespace Database {
20 
22  class ThreadArray {
23  public:
24 
25  ThreadArray(){ m_ThreadsTable_Ptr = std::make_shared<std::vector<std::shared_ptr<MF::Database::Thread>>>();};
26  ~ThreadArray() = default;
27 
30  static std::shared_ptr<MF::Database::ThreadArray> New(const std::shared_ptr<MF::GU::LatticeParametersD3Q19>& LatticeParameters_Ptr) {
31  auto ThreadArray_Ptr = std::make_shared<MF::Database::ThreadArray>();
33  return ThreadArray_Ptr;
34  }
35 
40  std::shared_ptr<MF::Database::Thread> NewThread(uint64_t NodeID, uint32_t NrOfNodes) {
41  auto Thread_Ptr = MF::Database::Thread::New(m_LatticeParameters_Ptr, NodeID, NrOfNodes);
42  m_ThreadsTable_Ptr->push_back(Thread_Ptr);
43  return Thread_Ptr;
44  }
45  inline static std::shared_ptr<MF::GU::LatticeParametersD3Q19> m_LatticeParameters_Ptr;
46  std::shared_ptr<std::vector<std::shared_ptr<MF::Database::Thread>>> m_ThreadsTable_Ptr;
47  };
48  } /* namespace Database */
49 } /* namespace MF */
std::shared_ptr< std::vector< std::shared_ptr< MF::Database::Thread > > > m_ThreadsTable_Ptr
Array of MFThreads shared pointer.
Definition: ThreadArray.h:46
static std::shared_ptr< MF::GU::LatticeParametersD3Q19 > m_LatticeParameters_Ptr
Lattice parameters shared pointer.
Definition: ThreadArray.h:45
static std::shared_ptr< MF::Database::ThreadArray > New(const std::shared_ptr< MF::GU::LatticeParametersD3Q19 > &LatticeParameters_Ptr)
MFThreadArray allocator.
Definition: ThreadArray.h:30
std::shared_ptr< MF::Database::Thread > NewThread(uint64_t NodeID, uint32_t NrOfNodes)
New MFThread allocator.
Definition: ThreadArray.h:40
MFThreadArray is an std::vector object that stores shared pointers to MFThreads.
Definition: ThreadArray.h:22
static std::shared_ptr< MF::Database::Thread > New(const std::shared_ptr< MF::GU::LatticeParametersD3Q19 > &LatticeParameters_Ptr, uint64_t NodeID, uint32_t NrOfNodes)
MFThread allocator.
Definition: Thread.h:58