EigenValues.hpp

00001 
00002 //
00003 // $Id: EigenValues.hpp,v 1.1 2008/04/16 22:31:22 werner Exp $
00004 //
00006 #ifndef __FIBEROPERATIONS_EIGENVALUES_HPP
00007 #define __FIBEROPERATIONS_EIGENVALUES_HPP
00008 
00009 #include <field/MemBase.hpp>
00010 #include <fiberop/TensorProperties.hpp>
00011 #include <eagle/EigenVectors.hpp>
00012 #include <grid/Representation.hpp>
00013 #include <eagle/PhysicalSpace.hpp>
00014 #include "fiberopDllApi.h"
00015 
00016 
00017 namespace Fiber
00018 {
00019 
00021 struct  fiberop_API     EigenValueArrays
00022 {
00023         RefPtr<TypedArray<double> >     pMajorEval,
00024                                         pMedianEval,
00025                                         pMinorEval;
00026 
00027         EigenValueArrays(Representation&R, const string&Fieldname, const RefPtr<FragmentID>&f)
00028         {
00029                 pMajorEval  = R( Fieldname + "." FIBER_TENSORFIELDNAME_MAJOREIGENVALUE  , f );
00030                 pMedianEval = R( Fieldname + "." FIBER_TENSORFIELDNAME_MEDIANEIGENVALUE , f );
00031                 pMinorEval  = R( Fieldname + "." FIBER_TENSORFIELDNAME_MINOREIGENVALUE  , f );
00032         }
00033 };
00034 
00036 struct  fiberop_API     EigenArrays : EigenValueArrays 
00037 {
00038         typedef Eagle::tvector3 vec3; 
00039 
00041         string  problem;        
00042 
00043         RefPtr<TypedArray<vec3> > pMajorEvec, pMedianEvec, pMinorEvec; 
00044 
00048         EigenArrays(Representation&R, const string&Fieldname, const RefPtr<FragmentID>&f); 
00049 
00053         EigenArrays(Representation&R, const RefPtr<CreativeArrayBase>&TensorField, const string&Fieldname, const RefPtr<FragmentID>&f,
00054                     bool TemporaryFields = false, bool Discardable = true);
00055 
00060         void create(const RefPtr<MemBase>&Data);
00061 
00065         void setFields(Representation&R, const string&Fieldname, const RefPtr<FragmentID>&f, 
00066                        const RefPtr<MemBase>&DataSource,
00067                        bool Discardable = true);
00068 
00069 
00073         bool    HasEigenFields() const;
00074 
00075         operator bool() const
00076         {
00077                 return HasEigenFields();
00078         }
00079 };
00080 
00081 
00083 struct  fiberop_API     EigenValueIterators
00084 {
00085         const Iterator<double>  &MajorEval, &MedianEval, &MinorEval;
00086 
00087         EigenValueIterators(const EigenValueArrays&EV)
00088         : MajorEval ( *EV.pMajorEval ->creativeIterator() )
00089         , MedianEval( *EV.pMedianEval->creativeIterator() )
00090         , MinorEval ( *EV.pMinorEval ->creativeIterator() )
00091         {}
00092 };
00093 
00095 struct  fiberop_API     EigenIterators : EigenValueIterators
00096 {
00097         typedef Eagle::tvector3 vec3;
00098 
00099         const Iterator<vec3>&MajorEvec, &MedianEvec, &MinorEvec;
00100 
00101         EigenIterators(const EigenArrays&EA)
00102         : EigenValueIterators(EA)
00103         , MajorEvec  ( *EA.pMajorEvec ->creativeIterator()  )
00104         , MedianEvec ( *EA.pMedianEvec->creativeIterator() )
00105         , MinorEvec  ( *EA.pMinorEvec ->creativeIterator()  )
00106         {} 
00107 
00108         void compute(const Iterator<Eagle::metric33>&M, double precision = 1E-8);
00109 };
00110 
00111 
00112 
00113 
00114 
00115 
00116 
00117 
00118 
00119 
00120 
00121 struct  fiberop_API     WestinShapeFactors
00122 {
00123         RefPtr<TypedArray<double> > pLinear, pPlanar, pSpherical, pTrace; 
00124 
00125         WestinShapeFactors(Representation&R, const string&Fieldname, const RefPtr<FragmentID>&f); 
00126 
00127         WestinShapeFactors(const EigenValueArrays&EA, Representation&R, 
00128                            const string&Fieldname, const RefPtr<FragmentID>&f,
00129                            bool TemporaryFields = false);
00130 
00131         bool HasShapeFactors() const
00132         {
00133                 if (pLinear && pPlanar && pSpherical && pTrace)
00134                         return true; 
00135                 else
00136                         return false;
00137         }
00138 
00139         operator bool() const
00140         {
00141                 return HasShapeFactors();
00142         }
00143 
00144         bool    compute(const EigenValueArrays&EA);
00145 
00146         void setFields(Representation&R, const string&Fieldname, const RefPtr<FragmentID>&f, 
00147                        const RefPtr<MemBase>&DataSource,
00148                        bool Discardable = true);
00149 
00150 };
00151 
00152 
00153 } // namespace Fiber
00154 
00155 #endif //__FIBEROPERATIONS_EIGENVALUES_HPP
00156