FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
StorageTransformations.hpp
1#ifndef __FIBER_BUNDLE_STORAGETRANSFORMATIONS_HPP
2#define __FIBER_BUNDLE_STORAGETRANSFORMATIONS_HPP
3
4#include <memcore/Interface.hpp>
5#include <memcore/typemap.hpp>
6
7
8#include "BundleAPI.h"
9#include "GridID.hpp"
10
11namespace Fiber
12{
13
16class BUNDLE_API StorageTransformations : public MemCore::Interface<StorageTransformations>
17 , public MemCore::typemap<MemCore::TypeInfo>
18{
19public:
20 class BUNDLE_API IOPerformance : public ReferenceBase<IOPerformance>
21 {
22 public:
25 {}
26
28
36 virtual void beginWrite(
39 const std::string& theFieldName,
40 const std::string& theRepresenterName,
42 const std::string& theGridname,
43 double theTime
44 ) = 0;
45
54 virtual void endWrite(
58 const std::string& theFieldName,
59 const std::string& theRepresenterName,
61 const std::string& theGridname,
62 double theTime
63 ) = 0;
64
65 virtual void doneRead(
67 size_t BytesRead,
68 CreativeArrayBase&theCreator,
69 const DynamicSize&DS,
70 int NumberOfAvailableFragments,
71 int CurrentFragmentNumber);
72
73 };
74
75 RefPtr<IOPerformance> myIOPerformance;
76
77
78 /*
79 TODO: The following compression variables should go in a struct
80 that is returned by a function that is called with the full context information.
81 */
82
83
87 int CompressViaLZ4Filter = -1;
88
92 int GzipCompressionLevel = -1;
93
95 bool DoScaling = false;
96
97 int zstdCompressionLevel = -1;
98 int zstdDictionary = -1;
99
100
104 bool EnableShuffleFilter = false;
105
106 uint32_t ScaleFactor = 0;
107
108
109 int HDF5_CustomFilter = 0;
110 std::vector<unsigned int> HDF5FilterParameters;
111
112
113 bool useWindowsNativeVFDforHDF5 = true;
114
115
143 int Power10ScaleFactor = 0;
144
149 virtual bool SkipStorage( double time, const string&gridname,
151 const SkeletonID&Sid,
152 const string&RepresenterName,
153 const Field&F,
154 const string&FieldName,
155 Fiber::CreativeArrayBase&theCreator,
157 ) const;
158
159
162 {
167
168 bool doEnableWriteSinglePrecisionForCoordinates = false,
169 doEnableWriteSinglePrecisionForVectors = false,
170 doEnableWriteSinglePrecisionForBivectors = false;
171
173 bool WriteAsSinglePrecision(const std::string&FieldName, const std::type_info&theType) const;
174
176 bool EnableNumericalShift(const std::string&FieldName, const std::type_info&theType) const;
177
179 void enable(bool toWhat = true)
180 {
181 doEnableWriteSinglePrecisionForCoordinates =
182 doEnableWriteSinglePrecisionForVectors =
183 doEnableWriteSinglePrecisionForBivectors = toWhat;
184 }
185
187 void disable()
188 {
189 enable(false);
190 }
191 };
192
193
196 {
197 enum class SzipCoding
198 {
199 None,
200 Entropy,
201 NearestNeighbor
202 };
203
221 SzipCoding SzipCodingMethod = SzipCoding::None;
222
240 unsigned int szip_pixels_per_block = 16;
241
242
247 {
248 None = -1,
249 BLOSCLZ = 0,
250 LZ4 = 1,
251 LZ4HC = 2,
252 SNAPPY = 3,
253 ZLIB = 4,
254 ZSTD = 5
255 };
256
292 Compressor BLOSC = None;
293
294 enum Shuffle
295 {
296 NoShuffle = -1,
297 DOSHUFFLE = 1, /* byte-wise shuffle */
298 MEMCPYED = 0, /* plain copy */
299 DOBITSHUFFLE = 2 /* bit-wise shuffle */
300 };
301
302 Shuffle ShuffleMode = NoShuffle;
303
307 int CompressionLevel = 0;
308
319 bool ComputeRangeAttributeOnWriting = false;
320
324 struct ZFP
325 {
326 enum
327 {
328 none,
329 rate,
330 precision,
331 accuracy,
332 expert,
333 lossless,
334 zfp_default
335
336 } mode = none;
337
338 double data_rate,
339 data_accuracy;
340
341 unsigned data_precision;
342
344 unsigned minbits, maxbits, maxprec, minexp;
345
346 }
352
353 enum AutoSettingStrategy
354 {
355 Uncompressed,
356 BestForReading,
357 BestForWriting,
358 SmallestSize
359 };
360
361 bool doEnableWriteSinglePrecision = false,
362 doEnableNumericalShift = false;
363
364 void setAutomaticStrategy(AutoSettingStrategy StrategyMode = BestForReading);
365
367 {}
368
369 FilterSettings(AutoSettingStrategy StrategyMode)
370 {
371 setAutomaticStrategy(StrategyMode);
372 }
373
375 string human_readable_description() const;
376 };
377
381// FilterSettings::AutoSettingStrategy StrategyMode = FilterSettings::BestForReading;
382 FilterSettings::AutoSettingStrategy StrategyMode = FilterSettings::Uncompressed;
383
385 {
386 double time;
387 const string gridname;
389 const SkeletonID Sid;
390 const string RepresenterName;
392 const string FieldName;
396 };
397
398
404
407 virtual FilterSettings getFilterSettings( double time, const string&gridname,
409 const SkeletonID&Sid,
410 const string&RepresenterName,
411 const Field&F,
412 const string&FieldName,
413 Fiber::CreativeArrayBase&theCreator,
415 const MemCore::RefPtr<MemBase>&Mb) const;
416
417
420 bool StoreFragmentsSeparately = false;
421 bool StoreFieldsSeparately = false;
422 bool StoreGridsSeparately = false;
423
441 bool trulyDeleteFileContents = false;
442
445
448
449
451
453
454 void autoSetup();
455
456
463 virtual bool isSaveableTime(double T) const;
464
470 {
487
488
495 int ELINK_CACHESIZE = 128*1024;
496
503 int FileSpaceStrategyThreshold = 4096;
504
513 int sieve_buf_size = 0;
514
518 int MDC_initial_size = 32*1024,
519 MDC_max_size = 64*1024,
520 MDC_min_size = 1024;
521
522 }
527
528 virtual std::pair<string,string> getExternalLocation( double time, const string&gridname,
529 const SkeletonID&Sid,
530 const string&RepresenterName,
531 const string&FieldName ) const;
532
533 virtual string getExternalLocationPrefix( double time, const string&gridname,
534 const SkeletonID&Sid,
535 const string&RepresenterName,
536 const string&FieldName ) const;
537
544 virtual void setFieldPacking( double time, const string&gridname,
546 const SkeletonID&Sid,
547 const string&RepresenterName,
548 const Field&F,
549 const string&FieldName,
550 Fiber::CreativeArrayBase&theCreator,
551 const MemCore::RefPtr<Fiber::FragmentID>&fID) const;
552
553
554 bool EnableExternalFileReference = false;
555
564 virtual string getExternalFileReference(const string&MainFile, const string&FragmentFile);
565
566
567 bool AllowExternalLinkingOnWritingOutOfRAMData = false;
568
575 virtual std::string
576 getExternalLinkFilename(const std::string&link_containing_file_name,
577 const std::string&external_target_file_name) const;
578
579 virtual DynamicSize computeChunkSize(const DynamicSize&FragmentSize,
580 size_t TypeSize, string&StorageInfo);
581
582 virtual bool isSaveableField(const FieldID&id, const Field&F,
583 const WeakPtr<Fiber::Grid>&theGrid,
584 const std::string &theRepresenterName,
585 double theTime,
586 const std::string &theGridname,
588
589 virtual bool isSaveableFragment(
591 const FieldID&id, const Field&F,
592 const WeakPtr<Fiber::Grid>&theGrid,
593 const std::string &theRepresenterName,
594 double theTime,
595 const std::string &theGridname,
597
601 virtual void isSaved(const RefPtr<CreativeArrayBase>&cab,
603 const FieldID&id, const Field&F,
604 const WeakPtr<Fiber::Grid>&theGrid,
605 const std::string &theRepresenterName,
606 double theTime,
607 const std::string &theGridname,
609};
610
611} // namespace Fiber
612
613
614#endif // __FIBER_BUNDLE_STORAGETRANSFORMATIONS_HPP
basic_string< char > string
Base class for multidimensional arrays that employ deferred storage, i.e.
Definition CreativeArrayBase.hpp:75
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
Identifier for Fields within a Grid.
Definition FieldID.hpp:53
A Field is a collection of CreativeArrayBase reference pointers which are accessed via FragmentID obj...
Definition Field.hpp:245
Identifier for Skeletons within a Grid.
Definition SkeletonID.hpp:24
Definition StorageTransformations.hpp:21
virtual void endWrite(double SecondsUsedToWriteData, const MemCore::RefPtr< MemCore::ChunkBase > &Mb, const MemCore::RefPtr< Fiber::FragmentID > &fID, const std::string &theFieldName, const std::string &theRepresenterName, const Fiber::SkeletonID &theSkeletonID, const std::string &theGridname, double theTime)=0
virtual void beginWrite(const MemCore::RefPtr< MemCore::ChunkBase > &Cb, const MemCore::RefPtr< Fiber::FragmentID > &fID, const std::string &theFieldName, const std::string &theRepresenterName, const Fiber::SkeletonID &theSkeletonID, const std::string &theGridname, double theTime)=0
Indication that some data is going to be written now.
Definition StorageTransformations.hpp:18
PrecisionTransformation defaultPrecisionTransformation
Setting for the default value of getFilterSettings, and overriden function may or may not use this.
Definition StorageTransformations.hpp:403
struct Fiber::StorageTransformations::HDF5_Tuning HDF5
Data member for HDF5 tuning.
std::set< RefPtr< FieldID > > SaveableFields
Do only for certain field names.
Definition StorageTransformations.hpp:444
std::set< RefPtr< GridID > > SaveableGrids
Do only for certain grid names.
Definition StorageTransformations.hpp:447
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
Definition StorageTransformations.hpp:385
https://computing.llnl.gov/projects/zfp
Definition StorageTransformations.hpp:325
unsigned minbits
Expert mode:
Definition StorageTransformations.hpp:344
Definition StorageTransformations.hpp:196
Compressor
Compression mode.
Definition StorageTransformations.hpp:247
struct Fiber::StorageTransformations::FilterSettings::ZFP zfp
ZFP filter parameters.
Tuning parameters related to HDF5 files.
Definition StorageTransformations.hpp:470
string elink_prefix
The external link prefix as used by HDF5:
Definition StorageTransformations.hpp:486
Definition StorageTransformations.hpp:162
std::set< string > Fieldnames_to_NeverWrite_as_SinglePrecision
field names to never write as single precision
Definition StorageTransformations.hpp:166
std::set< string > Fieldnames_to_AlwaysWrite_as_SinglePrecision_if_possible
field names to always write as single precision
Definition StorageTransformations.hpp:164