Blue Brain BioExplorer
AbstractSimulationHandler.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2024, EPFL/Blue Brain Project
3  * All rights reserved. Do not distribute without permission.
4  *
5  * This file is part of Blue Brain BioExplorer <https://github.com/BlueBrain/BioExplorer>
6  *
7  * This library is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU Lesser General Public License version 3.0 as published
9  * by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14  * details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #pragma once
22 
25 
26 namespace core
27 {
33 {
34 public:
36  virtual AbstractSimulationHandlerPtr clone() const = 0;
37 
39 
41 
42  PLATFORM_API virtual void bind(const MaterialPtr& /* material */){};
43 
44  PLATFORM_API virtual void unbind(const MaterialPtr& /* material */){};
45 
47  uint32_t getCurrentFrame() const { return _currentFrame; }
52  virtual void* getFrameData(uint32_t frame) { return _frameData.data(); }
53 
57  uint64_t getFrameSize() const { return _frameSize; }
61  void setFrameSize(const uint64_t frameSize) { _frameSize = frameSize; }
65  uint32_t getNbFrames() const { return _nbFrames; }
69  void setNbFrames(const uint32_t nbFrames) { _nbFrames = nbFrames; }
74  double getDt() const { return _dt; }
76  const std::string& getUnit() const { return _unit; }
79  virtual bool isReady() const { return true; }
81  virtual void waitReady() const {}
82 
83 protected:
84  uint32_t _getBoundedFrame(const uint32_t frame) const;
85 
86  uint32_t _currentFrame{std::numeric_limits<uint32_t>::max()};
87  uint32_t _nbFrames{0};
88  uint64_t _frameSize{0};
89  double _dt{0};
90  std::string _unit;
91 
93 };
94 } // namespace core
#define PLATFORM_API
Definition: Api.h:37
The AbstractSimulationHandler class handles simulation frames for the current circuit.
virtual AbstractSimulationHandlerPtr clone() const =0
virtual void * getFrameData(uint32_t frame)
returns a void pointer to the simulation data for the given frame or nullptr if the frame is not load...
uint32_t getNbFrames() const
getNbFrames returns the number of frame for the current simulation
void setNbFrames(const uint32_t nbFrames)
setNbFrames sets the number of frame for the current simulation
const std::string & getUnit() const
AbstractSimulationHandler & operator=(const AbstractSimulationHandler &rhs)
virtual PLATFORM_API void unbind(const MaterialPtr &)
void setFrameSize(const uint64_t frameSize)
setFrameSize Sets the size of the current simulation frame
uint64_t getFrameSize() const
getFrameSize return the size of the current simulation frame
virtual PLATFORM_API void bind(const MaterialPtr &)
uint32_t _getBoundedFrame(const uint32_t frame) const
std::shared_ptr< AbstractSimulationHandler > AbstractSimulationHandlerPtr
Definition: Types.h:179
std::shared_ptr< Material > MaterialPtr
Definition: Types.h:117
std::vector< float > floats
Definition: Types.h:45