1#define ENABLE_MEMCORE_GETTIME
2#include <memcore/Timer.hpp>
4#include "IntegralFace.hpp"
6#include <BaseSpace/FieldInterpolator.hpp>
7#include <eagle/PhysicalSpace.hpp>
8#include <eagle/STA.hpp>
9#include <ocean/shrimp/VEnum.hpp>
10#include <ocean/shrimp/PhysicalSpace.hpp>
12#include <fish/fiber/vector/Interpolate.hpp>
13#include <fish/fiber/vector/LinearIpol.hpp>
14#include <bone/FishField.hpp>
15#include <bone/FishSlice.hpp>
16#include <ocean/shrimp/VObjectStatus.hpp>
17#include <fish/fiber/baseop/LocalFromWorldPoint.hpp>
18#include <fish/fiber/baseop/ExpandBBox.hpp>
19#include <fish/fiber/baseop/CopySkeletons.hpp>
22#include <ode/dop853def.hpp>
23#include <baseop/TangentialVectors.hpp>
26#include <memcore/Timer.hpp>
28#include <grid/types/LineSet.hpp>
29#include <fish/fiber/baseop/RefineSurface.hpp>
43 template<
int N,
typename T>
49 puts(
"getMemArrayViaMBase() No cBase for FIELD found in field");
fflush(
stdout);
56 puts(
"getMemArrayViaMBase() No mBase for FIELD found in field");
fflush(
stdout);
61 ret = myField->getCreator(FragID)->create();
64 mBase.speak(
"MBase Inforation ------>");
65 puts(
"getMemArrayViaMBase() ERROR retrieving matching field.");
103 , theFieldName(fieldName)
115 timeDifferenceMap[t1] = timeDifferenceMap[t0] =
stepTime;
118 timeDifferenceMap[t0] = 0.0;
127 printf(
"GridIterator::apply() Null to field retrieved. Abording at t=%f!", t);
133 fieldObjectCollection[t] =
fieldObj;
136 printf(
"GridIterator::apply() inserted %s st %.18f --> map size:%d\n", theFieldName.c_str(), t,
int(fieldObjectCollection.
size() ) );
162 puts(
"FieldCollectionDataBase1D::FieldCollectionDataBase1D() ERROR No Field in Grid");
168 size = Positions->Size()[0];
174template <
class FieldType,
typename LineType>
181 unsigned getVertexSize()
183 puts(
"FieldCollection::getVertexSize() not implemented, returning ZERO");
187 unsigned getDataSize()
189 puts(
"FieldCollection::getDataSize() not implemented, returning ZERO");
202 unsigned long stepNr;
220 LocalPointFinder.speak(
"--------------------------------------------------------------~AtomicDataBase() LocalPointFinder");
fflush(
stdout);
221 BB.speak(
"--------------------------------------------------------------~AtomicDataBase() BB");
fflush(
stdout);
222 GI.speak(
"--------------------------------------------------------------~AtomicDataBase() GI");
fflush(
stdout);
229template<
typename FieldType,
typename LineType,
int InterpolType>
242 unsigned long nextStartIndexPerCoarseCall(
unsigned long start,
unsigned long size )
244 puts(
"FieldLines::AtomicIntegrator<FieldType>.nextStartIndexPerCoarseCall() ERROR: Unsupported type Field/Line Type doing nothing!");
fflush(
stdout);
251 const unsigned index,
const double time )
253 puts(
"FieldLines::AtomicIntegrator<FieldType>.extractLocalData() ERROR: Unsupported type Field/Line Type doing nothing!");
fflush(
stdout);
263 unsigned integration_width)
265 puts(
"FieldLines::AtomicIntegrator<FieldType>.doEuler (Fronts) () ERROR: Unsupported type Field/Line Type doing nothing!");
fflush(
stdout);
273 unsigned integration_width )
275 puts(
"FieldLines::AtomicIntegrator<FieldType>.doDop853() ERROR: Unsupported type FieldType doing nothing!");
fflush(
stdout);
281 puts(
"FieldLines::AtomicIntegrator<FieldType>.initDop853() ERROR: Unsupported type FieldType doing nothing!");
fflush(
stdout);
292template<
class FieldType,
typename LineType>
301template <
class FieldType,
typename LineType>
319 puts(
"GridOperator::getpreparedGrid() WARNING: Using default base implementation, returning new Grid");
320 return myBundle->newGrid();
325 puts(
"GridOperator::advanceGrid() WARNING: Using default implementation, returning new Grid");
326 return myBundle->newGrid();
331 puts(
"GridOperator::advanceGrid() WARNING: Using default implementation, returning new Grid");
337 puts(
"GridOperator::storeGrid() WARNING: Using default implementation, doing Nothing");
342 puts(
"GridOperator::finalizeGrid() WARNING: Using default implementation, doing Nothing");
347 puts(
"GridOperator::getIntegrationSize() WARNING: Using default implementation, returning ZERO");
359template <
class FieldType,
typename LineType,
int InterpolType>
396 size_t getNPoints() {
return nPoints;}
399 double&time,
unsigned long&start,
unsigned long&
size)
410 AI.initDop853(
size );
432 for(
unsigned p = start; p < start +
size; p++)
437 printf(
"Working on point %d, about to get into Euler...start = %d, size = %d\n", p,
int(start),
int(
size));
460 time = AI.getNextTime();
463 printf(
"CoarseIntegrator::Time at the end of advance = %.18f\n", time);
466 start = AI.nextStartIndexPerCoarseCall( start,
size );
495 check = check && AI.extractLocalData(
CurrentFields, p, time );
499 printf(
"CoarseIntegrator::extractLocalGridData() exit, check: %d\n", check);
fflush(
stdout);
510template<
typename FieldType,
typename LineType>
513 string name() {
return "Unknown"; }
518template <
typename FieldType,
typename LineType>
522enum { NumberOfInputFields = 1 };
551 , Fish<
Field>(
"inputfield")
555 typedef typename FieldType::Chart_t Chart_t;
559 bool update(
VRequest&R,
double precision)
override;
585 double time,
int Level,
658 static string createChildname(
const string&
inputfield)
682 template<
class IntegratorType>
683 int doMainLoop(IntegratorType&
IntT,
686 const string& grid_name,
694 unsigned long integration_width = GridOperator.getIntegrationSize( StartGrid );
707 puts(
"fill local data and store grid in case of being the initial front");
711 printf(
"Emitter Grid:: Time at which emitter grid is stored %.18f\n", time);
717 GridOperator.storeGrid( grid_name,
CurrentGrid, time );
720 puts(
"maybe create a copy for the new grid");
725 printf(
"<<<... After NewGrid=GridOperator.advanceGrid(CurrentGrid)...>>>\n");
fflush(
stdout);
728 puts(
"do one integration step of the whole front");
730 integration_width = GridOperator.getIntegrationSize(
CurrentGrid);
735 puts(
"refine the grid");
738 printf(
"<<<<<<<<<<<< timestep = %.8f >>>>>>>>>>>>\n", time);
fflush(
stdout);
743 puts(
"fill local data in front");
751 GridOperator.storeGrid( grid_name,
NewGrid, time );
762 puts(
"do a final operation on the grid");
764 GridOperator.finalizeGrid( grid_name,
NewGrid, time );
767 puts(
"exit main loop");
769 return IntT.getNPoints();
779template<
typename FieldType,
typename LineType>
780bool IntegralHeart<FieldType,LineType>::update(
VRequest&
Context,
double precision)
785 printf(
"IntegralLines::update() -->%s<--: enter\n", Name().c_str() );
fflush(
stdout);
789 puts(
"IntegralLines::update() 1. Get input field information");
fflush(
stdout);
793 if(!
FieldSelection.theSourceBundle) {
return errorMsg(
Context,
"No bundle found in integrate field"); }
794 if(!InputToIntegrateField) {
return errorMsg(
Context,
"No integratable field in input bundle"); }
811EmitterFieldData
EFD( EmitterGS, EmitterFS, time );
825UpdateCheckData
UCD( EmitterGrid,
FieldSelection, GS, InputToIntegrateField, time, grid_name);
828 puts(
"IntegralLines::update() 3.5 no update needed");
839 if (!ToIntegratefieldBBox)
return setStatusError(
Context,
"No bounding box available.\n");
841AutoEmitterData
AED( EmitterGrid, ToIntegratefieldBBox, 23,
FieldSelection.theSourceBundle);
854 setStatusInfo(
Context,
"Setting up index search");
869double min_line_length = 0.0;
876 step_size *= ToIntegratefieldBBox->radius();
880 if( min_line_length < 0.0) min_line_length = 0.0;
888 cout <<
"size: " <<
EFD.Size <<
", seeds: " <<
AED.nSeeds <<
endl;
893 printf(
"IntegralHeart::update() nEmPoints: %d, nPointsEst: %d\n",nEmPoints,
nPointsEst);
905 puts(
"IntegralHeart::update(): no grid operator data created!");
920 puts(
"IntegralLines::update() 6. Do the actual Integration");
fflush(
stdout);
921 setStatusInfo(
Context,
"Integrating ...");
936 printf(
"\nTotal time slices = %d and Time value = %f %f\n",
totalSteps, time,
gridTime);
955 step_size, options(
"dop853"), nPoints, min_line_length, time );
965 step_size, options(
"dop853"), nPoints, min_line_length, time );
974 step_size, options(
"dop853"), nPoints, min_line_length, time );
992 CurviCellsPerUniCell <<
Context << LocalPointFinder->MaxListSize;
1000 myIntegralLines <<
Context << GS;
1002 printf(
"time: %f\n", time);
1061 VActionNotifier::StatusInfo(
"Integration computation complete");
valarray< size_t > size() const
_Expr< _ValFunClos< _ValArray, _Tp >, _Tp > apply(_Tp __func(_Tp)) const
basic_string< char > string
basic_ostream< _CharT, _Traits > & endl(basic_ostream< _CharT, _Traits > &__os)
constexpr auto size(const _Container &__cont) noexcept(noexcept(__cont.size())) -> decltype(__cont.size())
void insert(_InputIterator __first, _InputIterator __last)
size_type size() const noexcept
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
A Field is a collection of CreativeArrayBase reference pointers which are accessed via FragmentID obj...
Definition Field.hpp:245
A grid identifier.
Definition GridID.hpp:29
Iterator callback object for iteration within time slices.
Definition Slice.hpp:16
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
Use this class to compute a local cell index and fragment ID (if neccessary) of any coordinate field ...
Definition LocalFromWorldPoint.hpp:71
Definition IntegralHeart.hpp:231
bool doEuler(FieldCollection< FieldType, LineType > &lastFront, unsigned index, FieldCollection< FieldType, LineType > &newFront, double time, unsigned integration_width)
Do a one step integration.
Definition IntegralHeart.hpp:259
Definition IntegralHeart.hpp:361
Definition IntegralHeart.hpp:145
Definition IntegralHeart.hpp:92
Definition IntegralHeart.hpp:303
Definition IntegralHeart.hpp:520
Definition IntegralFace.hpp:37
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
Definition IndexListViaSelectionString.hpp:30
Definition IntegralHeart.hpp:195
Definition IntegralHeart.hpp:176
Definition IntegralHeart.hpp:294
Definition IntegralHeart.hpp:534
Definition IntegralHeart.hpp:512
bool setStatusInfo(const RefPtr< ValuePool > &Context, const string &what) const