IntegralFace.hpp

00001 #ifndef __FISH_CEPHALUS_LINEINTEGRATOR_HPP
00002 #define __FISH_CEPHALUS_LINEINTEGRATOR_HPP
00003 
00004 #include <ocean/eagle/PhysicalSpace.hpp>
00005 #include <ocean/shrimp/VObjectStatus.hpp>
00006 #include <ocean/shrimp/VEnum.hpp>
00007 
00008 #include <fish/fiber/baseop/ExpandBBox.hpp>
00009 #include <grid/types/LineSet.hpp>
00010 
00011 #include <bone/FishField.hpp>
00012 #include <bone/FishSaver.hpp>
00013 
00014 namespace Wizt
00015 {
00016 
00017         using namespace Fiber;
00018 
00019 
00020 
00021 class   IntegralFace : public virtual VObject,
00022                          public virtual Fish<Field>,
00023                          public FishGridSavable,
00024                          public StatusIndicator
00025 {
00026 public:
00027         typedef Eagle::PhysicalSpace::tvector tvector;
00028 
00029         typedef MemArray<3, double>                    ScalarArray_t;
00030         typedef MemArray<3, Eagle::point3>             CoordsArray_t;
00031         typedef MemArray<1, Eagle::point3>             CoordsArray1D_t;
00032         typedef MemArray<1, tvector>                   VecsArray1D_t;
00033         typedef MemArray<1, std::string>               FragmentIDs_t;
00034         typedef MemArray<1, BoundingBox>               FragmentBounds_t;
00035 
00036         // Equip Modul with all neccessary in and outputs and steering parameters
00037 
00038         // Either the input grid or the input field should be connected.
00039         // If it is sufficient to have a Grid object for defining the start points of the 
00040         // Lines connect to grid.
00041         // Otherwise connect to the field. The start positions are then extracted from the 
00042         // Grid underlying the Field.
00043         TypedSlot<Grid>         StartGrid; 
00044         TypedSlot<Field>        StartField;
00045 
00046         TypedSlot<double>       MinLineLength;             
00047         TypedSlot<double>       MaxSteps;
00048         TypedSlot<double>       StepSize;
00049 
00050         TypedSlot<double>       ScaleFac,
00051                                 UniMapperScalator;      
00052 
00053         TypedSlot<Enum>         Ipol;
00054         TypedSlot<Enum>         IncludeData;
00055         TypedSlot<Enum>         IncludeMagnitude;
00056         TypedSlot<Enum>         UseDop853;
00057 
00058 
00059         TypedSlot<int>          InternalEmissionSeedPoints;
00060 
00061         VOutput<Grid>           myIntegralLines;        
00062 
00063         VOutput<int>            CurviCellsPerUniCell;
00064 
00066         IntegralFace(const string&name, int p, const RefPtr<VCreationPreferences>&VP);
00067 
00068         ~IntegralFace();
00069 
00070         bool errorMsg(VRequest&Context,const string&text) const
00071         {
00072                 string tmp = "IntegratlLine::" + text; 
00073 
00074                         puts( tmp.c_str() );fflush(stdout); 
00075                         return setStatusError(Context, text);
00076         }
00077 
00078         bool infoMsg(VRequest&Context,const string&text) const
00079         {
00080                 string tmp = "IntegratlLine::" + text; 
00081 
00082                         puts( tmp.c_str() );fflush(stdout); 
00083                         return setStatusInfo(Context, text);
00084         }
00085         
00086         struct EmitterFieldData
00087         {
00088                 GridSelector&  EmitterGS;
00089                 FieldSelector& EmitterFS;
00090 
00091                 EmitterFieldData( GridSelector&EmitterGSP, FieldSelector&EmitterFSP )
00092                 : EmitterGS(EmitterGSP)
00093                 , EmitterFS(EmitterFSP)
00094                 {}
00095         };      
00096         
00097         RefPtr<Field> getEmitterField( VRequest& Context, const EmitterFieldData&EFD  );
00098 
00099 
00100         struct UpdateCheckData
00101         {
00102                 RefPtr<Field>& EmitterCoordinates;
00103                 FieldSelector& FieldSelection;
00104                 GridSelector&  GS;
00105                 RefPtr<Field>& InputToIntegrateField;
00106                 double time;
00107                 string grid_name;
00108                 
00109                 UpdateCheckData(RefPtr<Field>& EmitterCoordinatesP, FieldSelector& FieldSelectionP, GridSelector&  GSP, 
00110                                 RefPtr<Field>& InputToIntegrateFieldP, double timeP, string& grid_nameP)
00111                 : EmitterCoordinates(EmitterCoordinatesP)
00112                 , FieldSelection(FieldSelectionP)
00113                 , GS(GSP)
00114                 , InputToIntegrateField(InputToIntegrateFieldP)
00115                 , time(timeP)
00116                 , grid_name(grid_nameP)
00117                 {}
00118         };
00119 
00120         bool    needUpdate( VRequest&Context, UpdateCheckData&UCD );
00121         
00122 
00123         struct AutoEmitterData
00124         {
00125                 RefPtr<Field>& EmitterCoordinates;
00126                 RefPtr<BoundingBox>& ToIntegratefieldBBox;
00127                 int nSeeds;
00128 
00129                 AutoEmitterData( RefPtr<Field>& EmitterCoordinatesP, RefPtr<BoundingBox>& ToIntegratefieldBBoxP, const int nSeedsP )
00130                 : EmitterCoordinates(EmitterCoordinatesP)
00131                 , ToIntegratefieldBBox(ToIntegratefieldBBoxP)
00132                 , nSeeds(nSeedsP)
00133                 {}
00134         };
00135 
00136         void    setDefaultEmissionPoints( VRequest& Context, AutoEmitterData& AED );
00137 };
00138 
00139 }
00140 
00141 
00142 #endif // __FISH_CEPHALUS_LINEINTEGRATOR_HPP