FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
HDF5CreatorBase.hpp
1#ifndef __FIBER_HDF5CREATORBASE_HPP
2#define __FIBER_HDF5CREATORBASE_HPP
3
4#include <F5/F5R.h>
5#include <F5/F5private.h>
6#include <field/MemArray.hpp>
7#include <field/CreativeArray.hpp>
8#include <field/Field.hpp>
9#include <queue>
10#include <memory>
11#include "TypeRegistry.hpp"
12#include "F5Fragment.hpp"
13
14#include <memcore/Loader.hpp>
15#include <memcore/AlzheimerCreator.hpp>
16
17#include <future>
18#include <mutex>
19
20namespace Fiber
21{
22
23//class FiberIOHDF5_API HDF5CreatorBase : public CreativeArray
24
28class FiberIOHDF5_API HDF5CreatorBase : public AlzheimerCreator<MemBase, CreativeArrayBase>
29 , public F5Fragment
30{
31protected:
32 using F5Fragment::myGroup;
33
35
36 DynamicSize mySize;
37 unsigned ElementSize = 0; // is filled in after setup()
38
39 std::atomic<long> NumberOfLoadingOperations = 0;
40
41 std::atomic<bool> isLoading = false;
42
43 mutable std::mutex CreationMutex;
44// mutable std::mutex LoadingFlagMutex;
45
46 virtual HDF5CreatorBase::DataPtr_t load_data() = 0;
47
48 void setup(const RefPtr<FiberTypeBase>&MyFiberType);
49
50 std::future<bool> AsynchroneouslyComputedData;
51
52public:
53static bool loadHDF5Data(const RefPtr<HDF5CreatorBase>&TheHDF5Creator, const result&R);
54
55 /* WorkQueue
56 template<class T>
57 using Queue = std::queue<T>;
58
59 std::shared_ptr<WorkerQueue<Queue>> _WorkQueue;
60
61 static std::shared_ptr<WorkerQueue<Queue>> getWorkQueue();
62 */
63
64public:
69 string path_info;
70
73
74 int FragmentNumber = 1;
75 WeakPtr<Field> MyLoaderField;
76
77 Timer Stats;
78
79
84 const F5Fragment&HC,
85 const DynamicSize&theSize,
88
89
91
92 string makeInfoString() const;
93
94 const type_info&getType() override;
95 const type_info&const_getType() const;
96
97 size_t getMemSize() const
98 {
99 return mySize.getNumberOfElements()*ElementSize;
100 }
101
107 RefPtr<MemBase> produce() override;
108
109 bool request(const result&R) override;
110
111 bool isUnderCreation() const override;
112
113 bool discardCreation() override;
114
115 Creature::ReasonForReleasal release() override;
116};
117
118
119} // namespace Fiber
120
121
122#endif // __FIBER_HDF5CREATORBASE_HPP
Definition F5Fragment.hpp:12
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
A class describing an n-dimensional space at runtime.
Definition field/DynamicSize.hpp:29
Deferred creation of MemBase objects from an HDF5 file.
Definition HDF5CreatorBase.hpp:30
string path_info
Some textual information about this dataset, to be displayed in a progress/status bar if part of a GU...
Definition HDF5CreatorBase.hpp:69
const type_info & getType(const std::string &s)
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2