1#include "IntegralFace.hpp"
3#warning "Including a header from a plugin"
4#include <BaseSpace/FieldInterpolator.hpp>
6#include <eagle/PhysicalSpace.hpp>
8#include <ocean/shrimp/VEnum.hpp>
9#include <ocean/shrimp/VFlagList.hpp>
10#include <ocean/shrimp/PhysicalSpace.hpp>
12#include <memcore/Timer.hpp>
14#include <bone/FishField.hpp>
15#include <bone/FishSlice.hpp>
17#include <ocean/shrimp/VObjectStatus.hpp>
18#include <fish/fiber/baseop/LocalFromWorldPoint.hpp>
19#include <fish/fiber/baseop/ExpandBBox.hpp>
21#include <ode/dop853def.hpp>
22#include <baseop/TangentialVectors.hpp>
24#include <memcore/Timer.hpp>
26#include <grid/types/LineSet.hpp>
28#include <fish/fiber/baseop/RectilinearInterpolation.hpp>
65template<
class FieldType>
66struct IntegrationPoint
68 typedef typename FieldType::Chart_t Chart_t;
156 RefPtr<Chunk<point> > location;
159 RefPtr<Chunk<FieldType> > direction;
162 RefPtr<Chunk<point> > index_location;
165 RefPtr<Chunk<FragmentID_t> > fragment;
277template<
typename FieldType,
typename LineType,
int InterpolType>
278class AtomicIntegrator;
280struct AtomicIntegratorParameterBase
290template<
typename FieldType,
typename LineType>
291class AtomicIntegratorParameter:
public AtomicIntegratorParameterBase
296template <
class Extractor,
class Container>
299typedef typename Extractor::output_t output_t;
302size_t nLines = Lines.size();
329template <
class Container>
335 typedef FieldLines::IntegrationPoint<Eagle::PhysicalSpace::tvector> input_t;
336 typedef Eagle::point3 output_t;
338 output_t operator()(
const input_t&in)
const
340 return output_t(in.location);
349 const std::vector<
RefPtr<
Chunk< FieldLines::IntegrationPoint<Eagle::PhysicalSpace::tvector> > > >&Lines,
size_t nPoints)
354 cout <<
"CollectLineData(), before setPositions" <<
endl;
358 cout <<
"CollectLineData() ERROR setting Positions" <<
endl;
362struct ExtractPointLocation
364 typedef FieldLines::IntegrationPoint<Eagle::metric44> input_t;
365 typedef Eagle::point3 output_t;
367 output_t operator()(
const input_t&in)
const
369 return output_t(in.location[1],in.location[2],in.location[3]);
375 typedef FieldLines::IntegrationPoint<Eagle::metric44> input_t;
376 typedef double output_t;
378 output_t operator()(
const input_t&in)
const
380 return in.location[0];
391 const std::vector<
RefPtr<
Chunk< FieldLines::IntegrationPoint<Eagle::metric44> > > >&Lines,
size_t nPoints)
397 CartesianVertices[
"ProperTime" ]->setPersistentData(
CollectLines( ExtractTime(), Lines, nPoints) );
413struct CopyExtractorMetric33
415 typedef FieldLines::IntegrationPoint<Eagle::metric33> input_t;
416 typedef Eagle::point3 output_t;
418 output_t operator()(
const input_t&in)
const
420 return output_t(in.location);
426 const std::vector<
RefPtr<
Chunk< FieldLines::IntegrationPoint<Eagle::metric33> > > >&Lines,
size_t nPoints)
440template <
class Container>
444 cout <<
"createLineSet() Lines has lines: " << Lines.size() <<
endl;
446size_t NumberOfLines = Lines.size();
451 for(
index_t line=0; line<NumberOfLines; line++)
454 index_t LineLength = Lines[line]->std_vector().size();
457 cout <<
"createLineSet() Line has length: " << LineLength <<
endl;
461 for(
index_t i=0; i<LineLength; i++)
481template <
class FieldType,
typename LineType,
int InterpolType>
491 double min_line_length;
517 size_t getNPoints() {
return nPoints;}
530 if( dop && !AI.inited )
531 AI.initDop853( Lines.size() );
551#pragma omp for schedule(static, 10)
555 for(
unsigned p = 0; p < Lines.size(); p++)
624 for(
unsigned p = 0; p < Lines.size(); p++)
637template<
typename FieldType,
typename LineType>
640 string name() {
return "Unknown"; }
643template <
typename FieldType,
typename LineType>
644class IntegralLinesParameters
647 IntegralLinesParameters(
VObject*)
656template <
typename FieldType,
typename LineType>
657class IntegralLines :
public IntegralFace,
public IntegralLinesParameters<FieldType, LineType>
660enum { NumberOfInputFields = 1 };
676 , Fish<
Field>(
"inputfield")
679#
define FORCE_CONSTANT_COORDS_OPTION
"ForceConstantCoords"
680 , SpecialOptions(
this,
"options",
Options(FORCE_CONSTANT_COORDS_OPTION),2 )
685 typedef typename FieldType::Chart_t Chart_t;
689 bool update(
VRequest&R,
double precision)
override;
691 static string createChildname(
const string&
inputfield)
713 template<
class IntegratorType>
733 return IntT.getNPoints();
738template<
typename FieldType,
typename LineType>
739bool IntegralLines<FieldType,LineType>::update(
VRequest&
Context,
double precision)
747 printf(
"IntegralLines::update() -->%s<--: enter\n", Name().c_str() );
fflush(
stdout);
753 puts(
"IntegralLines::update() 1. Get input field information");
fflush(
stdout);
759 if(!
FieldSelection.theSourceBundle) {
return errorMsg(
Context,
"No bundle found in integrate field"); }
760 if(!InputToIntegrateField) {
return errorMsg(
Context,
"No integratable field in input bundle"); }
774EmitterFieldData
EFD( EmitterGS, EmitterFS, time );
795 if (options(
"dop853") ) grid_name +=
"_dop853";
801 InputToIntegrateField, time, grid_name);
805 puts(
"IntegralLines::update() 3.5 no update needed");
811 puts(
"IntegralLines::update() 4. Make sure we have seeding points");
fflush(
stdout);
814 if (!ToIntegratefieldBBox)
return setStatusError(
Context,
"No bounding box available.\n");
817AutoEmitterData
AED( EmitterCoordinates, ToIntegratefieldBBox, 23 );
819 if (!
AED.EmitterCoordinates)
820 return setStatusError(
Context,
"No Emitter Coordinates");
831 return setStatusError(
Context,
"Emitter points not in a supported format");
896double min_line_length = 0.0;
902 step_size *= ToIntegratefieldBBox->radius();
916 cout <<
"IntegralLines::update() Number of Seeds: " << nEmPoints <<
endl;
924 puts(
"IntegralLines::update() 6. Do the actual computation X");
fflush(
stdout);
928unsigned int nth = nEmPoints/10;
931size_t nPoints = nEmPoints;
940for(
unsigned i = 0; i < Lines.size(); i++ )
948 if( IntegrationPoint<FieldType>::point::Dims < 4 )
952 start.location[0]=0.0;
967 if( IntegrationPoint<FieldType>::point::Dims < 4 )
971 start.direction[0] = 0.0;
979 start.is_end =
false;
981 Lines[i]->push_back(start);
1002AIP.LocalPointFinder = LocalPointFinder;
1004AIP.BBP = ToIntegratefieldBBox;
1005AIP.step_size = step_size;
1006AIP.scale = options(
"invert")?-1.0:1.0;
1011cout <<
"integrallines: Fieldselection1: " <<
AIP.FieldSelection.getFieldName() <<
endl;
1061 CurviCellsPerUniCell <<
Context << LocalPointFinder->MaxListSize;
1201 if(IntegrationPoint<FieldType>::point::Dims == 3)
1219 if(IntegrationPoint<FieldType>::point::Dims == 4)
1245 for(
unsigned j = 0; j < 3; j++)
1247 cout<<
"InegralLine:update(): Direction: " << LineData[ MIndex(
vert_count) ] <<
endl;
1263 if( options(
"addData") )
1295 if (options(
"addMagnitude"))
1310#define DOUBLELINE "\u2016"
1324 puts(
"LINE INTEGRATOR ERROR: Could not set up standard fields on lines!");
fflush(
stdout);
1339 FieldSelection.BundleSource().speak(
"FieldSelection.BundleSource()");
1343 myIntegralLines <<
Context << GS;
1346 infoMsg(
Context,
"Done, output at: " + grid_name);
1353 puts(
"IntegralLine::update() >>> EXIT");
basic_ostream< _CharT, _Traits > & endl(basic_ostream< _CharT, _Traits > &__os)
constexpr void resize(size_type __new_size)
Convenience class that implements a pointer to a Bundle object but adds some useful member funtions t...
Definition Bundle.hpp:779
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
An abstract selection of fields, that is given by names of fields and possible types for each field.
Definition FieldSelection.hpp:23
string getFieldName() const
Retrieve the name of a unique field, if only one is stored here.
Definition FieldSelection.cpp:68
An internal class that stores a couple of textual names.
Definition FieldSelector.hpp:18
RefPtr< Field > getField(const string &theName, int Level=0, const string &ChartName=string()) const
Return a field of the given name in the Cartesian representation of the Vertices on the toplevel refi...
Definition FieldSelector.cpp:231
A Field is a collection of CreativeArrayBase reference pointers which are accessed via FragmentID obj...
Definition Field.hpp:245
Context information to select a grid from within a bundle.
Definition GridSelector.hpp:26
A Grid is a set of Skeleton objects, each of them accessed via some unique SkeletonID object.
Definition Grid.hpp:60
A set of lines stored on a Grid.
Definition LineSet.hpp:55
Use this class to compute a local cell index and fragment ID (if neccessary) of any coordinate field ...
Definition LocalFromWorldPoint.hpp:71
A Representation is a set of Field objects, each of them accessed via some FieldID identifier.
Definition Representation.hpp:101
bool setPositions(const RefPtr< Field > &P)
Set the positional component of this Representation object.
Definition Representation.cpp:519
Identifier for Skeletons within a Grid.
Definition SkeletonID.hpp:24
A Skeleton is a set of Representation object, each of them accessed by an Representer object.
Definition Skeleton.hpp:102
Definition IntegralFace.hpp:37
double norm(const PhysicalSpace::bivector &v)
Definition GridInspector.hpp:13
static const char Velocity[]
The velocity with which particles pass through this line.
Definition LineSet.hpp:163