1#ifndef __FIBEROPERATIONS_FRAGMENTSLICER_HPP
2#define __FIBEROPERATIONS_FRAGMENTSLICER_HPP
4#include "SliceExtractor.hpp"
5#include "RegularCoordinateSlice.hpp"
7#include <field/Field.hpp>
10#define Verbose(X) AppVerbose("FieldSlice",X)
23template <
class Converter,
class InputTypes>
27 double myCoordinateValue;
59 if (
fid) printf(
" FragmentSlicer::apply(fid=%s)\n",
fid->Name().c_str() );
60 else puts (
" FragmentSlicer::apply(contiguous field)");
68 puts(
" FragmentSlicer::apply(): could not get coordinate index");
74 printf(
" FragmentSlicer's getRectilinearIndex() yielded an exact slice value of %lg)\n",
CoordinateIndex );
83 puts(
"FieldSlice: Could not Make Size Interface in Creator, no field Creatable!");
87 Verbose(5) <<
" FragmentSlicer::apply() Coordinate Index for this slice is " <<
sliceIndex;
93 if (!mySliceCoordinateField)
96 if (
fid)
FIC =
fid->getFragmentIDCollection();
98 Verbose(0) <<
" No mySliceCoordinateField - Creating a new one!";
99 mySliceCoordinateField =
new Field(
FIC);
103 SliceFragID = mySliceCoordinateField->makeFragmentID(
fid->Name() +
"_2D" );
129 Verbose(5) <<
"ADDING sliced data set originating from 3D source...";
134 Verbose(5) <<
" Could not produce slice coordinates for index " <<
sliceIndex
135 <<
", call to RegularCoordinateSlice::getCoordinates() failed.";
141 Verbose(5) <<
" --> slice index is out of range for the given coordinate value, no slice data provided.";
153 assert( 0 &&
"Sorry, slice data has not been specified as 3D array, which is easy to support but has not been implemented for now." );
164 printf(
__FILE__ " FragmentSlicer: cannot extract slice, destination is too small for input %dx%dx%d\n",
172 Verbose(5) <<
"Creating new output field";
173 OutputField =
new Field( mySliceCoordinateField->getFragmentIDCollection() );
177 Verbose(5) <<
"Reusing previous OutputField";
180 Verbose(5) <<
"Slicer is setting up slice constructor for "
183 Assert( mySliceCoordinateField->getFragmentIDCollection() == OutputField->getFragmentIDCollection() );
constexpr __enable_if_is_duration< _ToDur > floor(const duration< _Rep, _Period > &__d)
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
const string & Name() const
Text ID of the fragment.
Definition FragmentID.hpp:65
Base class for iterators over the fragments of a field.
Definition FragmentID.hpp:249
static RefPtr< Cache, CacheBase > & MemCache()
bool makeDimensions(MultiIndex< N > &Dims, const RefPtr< CreativeArrayBase > &DC)
Given a data creator, retrieve the dimensionality information from the associated data,...
Definition MemArrayBase.hpp:186
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
IndexTypeConfig< sizeof(void *)>::index_t index_t
Define the index type as according to the size of a pointer, i.e.
Definition Index.hpp:22
Definition CreativeIterator.hpp:84
Extract 2D slices from a regular 3D data field along a given coordinate.
Definition FragmentSlicer.hpp:25
bool apply(const RefPtr< FragmentID > &fid, const RefPtr< CreativeArrayBase > &DataCreator) override
Iteration callback function.
Definition FragmentSlicer.hpp:52
Helper class to select a slice from a regular grid.
Definition RegularCoordinateSlice.hpp:26
MemCore::RefPtr< MemBase > getCoordinates(index_t sliceIndex, const MultiIndex< 3 > &DataDims, const RefPtr< Field > &Coords, const RefPtr< FragmentID > &fid)
Definition RegularCoordinateSlice.cpp:95
bool getRectilinearIndex(double CoordinateValue, const MemCore::RefPtr< MemBase > &CoordValues, double &CoordinateIndex)
Given a dataset of three-dimensional coordinate values, either uniform or rectilinear,...
Definition RegularCoordinateSlice.cpp:27