00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 #ifndef SUNDANCE_SUMOFINTEGRALS_H
00033 #define SUNDANCE_SUMOFINTEGRALS_H
00034 
00035 #include "SundanceDefs.hpp"
00036 #include "SundanceExpr.hpp"
00037 #include "SundanceScalarExpr.hpp"
00038 #include "SundanceQuadratureFamilyStub.hpp"
00039 #include "SundanceCellFilterStub.hpp"
00040 #include "SundanceOrderedHandle.hpp"
00041 #include "Teuchos_Array.hpp"
00042 #include "SundanceMap.hpp"
00043 #include "SundanceWatchFlag.hpp"
00044 #include "SundanceRegionQuadCombo.hpp"
00045 #include "SundanceParametrizedCurve.hpp"
00046 
00047 
00048 namespace Sundance
00049 {
00050 using namespace Sundance;
00051 using namespace Teuchos;
00052 
00053 using Sundance::Map;
00054 
00055 class SpatiallyConstantExpr;
00056 
00057 
00058 
00059 
00060 
00061 
00062 
00063 
00064 
00065 
00066 
00067 
00068 
00069 class SumOfIntegrals : public ScalarExpr
00070 {
00071 public:
00072 
00073   SumOfIntegrals(const RCP<CellFilterStub>& region,
00074     const Expr& expr,
00075     const RCP<QuadratureFamilyStub>& quad,
00076     const WatchFlag& watch);
00077 
00078 
00079   SumOfIntegrals(const RCP<CellFilterStub>& region,
00080     const Expr& expr,
00081     const RCP<QuadratureFamilyStub>& quad,
00082     const ParametrizedCurve& curve,
00083     const WatchFlag& watch);
00084 
00085 
00086   virtual ~SumOfIntegrals(){;}
00087 
00088 
00089   void addTerm(const RCP<CellFilterStub>& region,
00090     const Expr& expr,
00091     const RCP<QuadratureFamilyStub>& quad,
00092     const ParametrizedCurve& paramCurve,
00093     const WatchFlag& watch,
00094     int sign) ;
00095 
00096 
00097   void merge(const SumOfIntegrals* other, int sign) ;
00098 
00099 
00100   void multiplyByConstant(const SpatiallyConstantExpr* expr) ;
00101 
00102 
00103   void changeSign() ;
00104 
00105 
00106   int numRQC() const {return rqcToExprMap_.size();}
00107 
00108 
00109   const Sundance::Map<RegionQuadCombo, Expr>& rqcToExprMap() const
00110     {return rqcToExprMap_;}
00111 
00112 
00113 
00114   Set<int> funcsOnRegion(const OrderedHandle<CellFilterStub>& d, 
00115     const Set<int>& funcsSet) const ;
00116 
00117 
00118 
00119   bool integralHasTestFunctions(const OrderedHandle<CellFilterStub>& d) const ;
00120 
00121 
00122 
00123   RCP<CellFilterStub> nullRegion() const ;
00124 
00125 
00126 
00127   virtual bool isIndependentOf(const Expr& u) const ;
00128 
00129 
00130 
00131   virtual bool isLinearForm(const Expr& u) const ;
00132 
00133 
00134 
00135   virtual bool isQuadraticForm(const Expr& u) const ;
00136 
00137 
00138 
00139 
00140   virtual bool isLinearInTests() const ;
00141 
00142 
00143 
00144   virtual bool everyTermHasTestFunctions() const ;
00145 
00146 
00147 
00148   virtual bool hasTestFunctions() const ;
00149   
00150 
00151 
00152 
00153   virtual std::ostream& toText(std::ostream& os, bool paren) const ;
00154 
00155 
00156 
00157   virtual XMLObject toXML() const ;
00158 
00159 
00160   virtual RCP<ExprBase> getRcp() {return rcp(this);}
00161 
00162 
00163   virtual bool lessThan(const ScalarExpr* other) const ;
00164 
00165 
00166   bool hasWatchedTerm() const ;
00167 
00168 
00169   int eqnSetSetupVerb() const ;
00170   
00171 
00172 protected:
00173 
00174   Expr filterSpectral(const Expr& ex) const ;
00175 private:
00176 
00177   Sundance::Map<RegionQuadCombo, Expr> rqcToExprMap_;
00178 };
00179 }
00180 
00181 #endif