1#ifndef FIBEROPERATIONS_RANGEBASE_HPP
2#define FIBEROPERATIONS_RANGEBASE_HPP 20241206
4#include <field/MemBase.hpp>
5#include <grid/Representation.hpp>
6#include <memcore/typemap.hpp>
7#include <memcore/Profiler.hpp>
9#include "fiberopDllApi.h"
12#define RangeVerbose(X) AppVerbose("Range",X)
18#if (__cplusplus == 201703L)
19#define RangeAttributeName "Range"
20#define RangeFragmentsAttributeName "RangeFragments"
22static constinit auto RangeAttributeName =
"Range";
23 [[maybe_unused]]
static constinit auto RangeFragmentsAttributeName =
"RangeFragments";
37 const char* what()
const noexcept override;
82 CAB.removeAttribute( RangeAttributeName );
85static void clear(
Field&F);
89 return F.getAttribute( RangeAttributeName );
92static RefPtr<DataRangeBase> get_cached_rangebase_if_older_than_field(
const Field&F)
94 if (RefPtr<DataRangeBase> DR = interface_cast<DataRangeBase>(F) )
96 if ( !DR->isOlderThan( F ) )
103static bool need_to_recompute(
const Field&F);
106static void setRangeCompleteness(Field&F,
unsigned nFragments,
unsigned FragmentsNotUsedForRangeComputation);
107static bool isRangeComplete(Field&F);
109 typedef RefPtr<DataRangeBase> compute_range_and_set_attribute_func(CreativeArrayBase&CAB,
const RefPtr<MemBase>&ArrayBase);
110 typedef RefPtr<DataRangeBase> get_range_if_older_than_creator_data_func(CreativeArrayBase&CAB);
113static void computeRangeOnAvailableFragments(Field&F,
114 compute_range_and_set_attribute_func*typed_compute_function,
115 get_range_if_older_than_creator_data_func*range_determinator,
116 bool RequestToLoadMore =
false);
141extern fiberop_API RefPtr<DataRangeBase>
142 getFragmentRange(CreativeArrayBase&CAB,
bool AsynchRequest=
false,
bool theAvoidDataLoading =
false,
const RefPtr<MemBase>&PossibleData =
nullptr);
160inline RefPtr<DataRangeBase>
174extern fiberop_API RefPtr<DataRangeBase>
175 getFieldRange_internal(Field&F, std::string&ErrorMessage,
bool AsynchRequest=
false,
bool theAvoidDataLoading =
false)
185inline RefPtr<DataRangeBase>
186 getFieldRange(Field&F, std::string&ErrorMessage,
bool AsynchRequest=
false,
bool theAvoidDataLoading =
false)
187 PERFORMANCE_WARNING_2(" data may be needed to be loaded from disc during this function
call. Use
getQuickFieldRange() to avoid this warning and data loading.")
190inline
RefPtr<DataRangeBase>
201inline RefPtr<DataRangeBase>
213inline RefPtr<DataRangeBase>
getFieldRange(Field& F,
bool AsynchRequest =
false,
bool theAvoidDataLoading =
false)
214 PERFORMANCE_WARNING_1();
222inline RefPtr<DataRangeBase>
getFieldRange(
const RefPtr<Field>& F,
bool AsynchRequest =
false,
bool theAvoidDataLoading =
false)
224 if (!F)
return nullptr;
226std::string ErrorMessage;
227 return getFieldRange(*F, ErrorMessage, AsynchRequest, theAvoidDataLoading);
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 Field is a collection of CreativeArrayBase reference pointers which are accessed via FragmentID obj...
Definition Field.hpp:245
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
RefPtr< DataRangeBase > getFieldRange(Field &F, std::string &ErrorMessage, bool AsynchRequest=false, bool theAvoidDataLoading=false)
Determine and eventually compute the numerical range of a field.
Definition RangeBase.hpp:191
RefPtr< DataRangeBase > getQuickFieldRange(Field &F, std::string &ErrorMessage, bool AsynchRequest=false)
Determine and eventually compute the numerical range of a field without loading data,...
Definition RangeBase.hpp:202
RefPtr< DataRangeBase > getFieldRange_internal(Field &F, string &ErrorMessage, bool AsynchRequest, bool theAvoidDataLoading)
TODO: Go via a type registry.
Definition Range.cpp:54
RefPtr< DataRangeBase > getFragmentRange(CreativeArrayBase &CAB, bool AsynchRequest, bool theAvoidDataLoading, const RefPtr< MemBase > &PossibleData)
TODO: Go via a type registry.
Definition Range.cpp:18
std::string to_string(const span< char > &s)
StrongPtr< Object, ObjectBase > RefPtr
Definition RangeBase.hpp:35
Base class for ranges that can be attached to Creators.
Definition RangeBase.hpp:33
virtual void expandRange(const RefPtr< DataRangeBase > &DRB)=0
Append a given range, if possible. Child class might do type conversions.
virtual RefPtr< DataRangeBase > getFloatRange() const =0
Virtual function to retrieve a general floating-point version of a range which may be any kind of int...