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 #ifndef SUNDANCE_STDPRODUCTTRANSFORMATION_H
00032 #define SUNDANCE_STDPRODUCTTRANSFORMATION_H
00033 
00034 #include "SundanceDefs.hpp"
00035 #include "SundanceProductTransformationSequence.hpp"
00036 
00037 namespace Sundance
00038 {
00039 using namespace Sundance;
00040 using namespace Teuchos;
00041 using namespace Sundance;
00042 
00043 
00044 
00045 
00046 
00047 
00048 
00049 class StdProductTransformations : public ProductTransformationSequence
00050 {
00051 public:
00052   StdProductTransformations();
00053 
00054   virtual ~StdProductTransformations(){;}
00055 };
00056     
00057 
00058 
00059 
00060 
00061 
00062 
00063 
00064 
00065 
00066 class RemoveZeroFromProduct : public ProductTransformation
00067 {
00068 public:
00069 
00070   RemoveZeroFromProduct() : ProductTransformation() {;}
00071 
00072 
00073   virtual ~RemoveZeroFromProduct(){;}
00074 
00075 
00076   virtual bool doTransform(const RCP<ScalarExpr>& left, 
00077     const RCP<ScalarExpr>& right,
00078     RCP<ScalarExpr>& rtn) const ;
00079 };
00080 
00081     
00082 
00083 
00084 
00085 
00086 
00087 
00088 
00089 
00090 
00091 class RemoveOneFromProduct : public ProductTransformation
00092 {
00093 public:
00094 
00095   RemoveOneFromProduct() : ProductTransformation() {;}
00096 
00097 
00098   virtual ~RemoveOneFromProduct(){;}
00099 
00100 
00101   virtual bool doTransform(const RCP<ScalarExpr>& left, 
00102     const RCP<ScalarExpr>& right,
00103     RCP<ScalarExpr>& rtn) const ;
00104 };
00105 
00106 
00107 
00108 
00109 
00110 
00111 
00112 
00113 
00114 
00115 class RemoveMinusOneFromProduct : public ProductTransformation
00116 {
00117 public:
00118 
00119   RemoveMinusOneFromProduct() : ProductTransformation() {;}
00120 
00121 
00122   virtual ~RemoveMinusOneFromProduct(){;}
00123 
00124 
00125   virtual bool doTransform(const RCP<ScalarExpr>& left, 
00126     const RCP<ScalarExpr>& right,
00127     RCP<ScalarExpr>& rtn) const ;
00128 };
00129 
00130 
00131 
00132 
00133 class MultiplyConstants : public ProductTransformation
00134 {
00135 public:
00136 
00137   MultiplyConstants() : ProductTransformation() {;}
00138 
00139 
00140   virtual ~MultiplyConstants(){;}
00141 
00142 
00143   virtual bool doTransform(const RCP<ScalarExpr>& left, 
00144     const RCP<ScalarExpr>& right,
00145     RCP<ScalarExpr>& rtn) const ;
00146 };
00147 
00148 
00149 
00150 
00151 
00152 
00153 
00154 class MoveConstantsToLeftOfProduct : public ProductTransformation
00155 {
00156 public:
00157 
00158   MoveConstantsToLeftOfProduct() : ProductTransformation() {;}
00159 
00160 
00161   virtual ~MoveConstantsToLeftOfProduct(){;}
00162 
00163 
00164   virtual bool doTransform(const RCP<ScalarExpr>& left, 
00165     const RCP<ScalarExpr>& right,
00166     RCP<ScalarExpr>& rtn) const ;
00167 };
00168 
00169 
00170 
00171 
00172 
00173 
00174 
00175 
00176 
00177 
00178 
00179 
00180 
00181 
00182 class MoveUnaryMinusOutsideProduct : public ProductTransformation
00183 {
00184 public:
00185 
00186   MoveUnaryMinusOutsideProduct() : ProductTransformation() {;}
00187 
00188 
00189   virtual ~MoveUnaryMinusOutsideProduct(){;}
00190 
00191 
00192   virtual bool doTransform(const RCP<ScalarExpr>& left, 
00193     const RCP<ScalarExpr>& right,
00194     RCP<ScalarExpr>& rtn) const ;
00195 };
00196 
00197 
00198 
00199 
00200 
00201 
00202 
00203 
00204 class AssociateHungryDiffOpWithOperand : public ProductTransformation
00205 {
00206 public:
00207 
00208   AssociateHungryDiffOpWithOperand() : ProductTransformation() {;}
00209 
00210 
00211   virtual ~AssociateHungryDiffOpWithOperand(){;}
00212 
00213 
00214   virtual bool doTransform(const RCP<ScalarExpr>& left, 
00215     const RCP<ScalarExpr>& right,
00216     RCP<ScalarExpr>& rtn) const ;
00217 };
00218 
00219 
00220 
00221 
00222 
00223 
00224 
00225 
00226 
00227 
00228 class KillDiffOpOnConstant : public ProductTransformation
00229 {
00230 public:
00231 
00232   KillDiffOpOnConstant() : ProductTransformation() {;}
00233 
00234 
00235   virtual ~KillDiffOpOnConstant(){;}
00236 
00237 
00238   virtual bool doTransform(const RCP<ScalarExpr>& left, 
00239     const RCP<ScalarExpr>& right,
00240     RCP<ScalarExpr>& rtn) const ;
00241 };
00242 
00243 
00244 
00245 
00246 
00247 
00248 
00249 class BringConstantOutsideDiffOp : public ProductTransformation
00250 {
00251 public:
00252 
00253   BringConstantOutsideDiffOp() : ProductTransformation() {;}
00254 
00255 
00256   virtual ~BringConstantOutsideDiffOp(){;}
00257 
00258 
00259   virtual bool doTransform(const RCP<ScalarExpr>& left, 
00260     const RCP<ScalarExpr>& right,
00261     RCP<ScalarExpr>& rtn) const ;
00262 };
00263     
00264 
00265 
00266 
00267 
00268 
00269 
00270 class DistributeSumOfDiffOps : public ProductTransformation
00271 {
00272 public:
00273 
00274   DistributeSumOfDiffOps() : ProductTransformation() {;}
00275 
00276 
00277   virtual ~DistributeSumOfDiffOps(){;}
00278 
00279 
00280   virtual bool doTransform(const RCP<ScalarExpr>& left, 
00281     const RCP<ScalarExpr>& right,
00282     RCP<ScalarExpr>& rtn) const ;
00283 };
00284 
00285 
00286 
00287 
00288 class ApplySimpleDiffOp : public ProductTransformation
00289 {
00290 public:
00291 
00292   ApplySimpleDiffOp() : ProductTransformation() {;}
00293 
00294 
00295   virtual ~ApplySimpleDiffOp(){;}
00296 
00297 
00298   virtual bool doTransform(const RCP<ScalarExpr>& left, 
00299     const RCP<ScalarExpr>& right,
00300     RCP<ScalarExpr>& rtn) const ;
00301 };
00302 
00303 
00304 
00305 
00306 
00307 
00308 
00309 
00310 
00311 
00312 
00313 
00314 class RearrangeRightProductWithConstant : public ProductTransformation
00315 {
00316 public:
00317 
00318   RearrangeRightProductWithConstant() : ProductTransformation() {;}
00319 
00320 
00321   virtual ~RearrangeRightProductWithConstant(){;}
00322 
00323 
00324   virtual bool doTransform(const RCP<ScalarExpr>& left, 
00325     const RCP<ScalarExpr>& right,
00326     RCP<ScalarExpr>& rtn) const ;
00327 };
00328 
00329 
00330 
00331 
00332 
00333 
00334 
00335 
00336 
00337 
00338 
00339 class RearrangeLeftProductWithConstant : public ProductTransformation
00340 {
00341 public:
00342 
00343   RearrangeLeftProductWithConstant() : ProductTransformation() {;}
00344 
00345 
00346   virtual ~RearrangeLeftProductWithConstant(){;}
00347 
00348 
00349   virtual bool doTransform(const RCP<ScalarExpr>& left, 
00350     const RCP<ScalarExpr>& right,
00351     RCP<ScalarExpr>& rtn) const ;
00352 };
00353 
00354 
00355 
00356 
00357 
00358 
00359 
00360 
00361 class TakeConstantUnderIntegralSign : public ProductTransformation
00362 {
00363 public:
00364 
00365   TakeConstantUnderIntegralSign() : ProductTransformation() {;}
00366 
00367 
00368   virtual ~TakeConstantUnderIntegralSign(){;}
00369 
00370 
00371   virtual bool doTransform(const RCP<ScalarExpr>& left, 
00372     const RCP<ScalarExpr>& right,
00373     RCP<ScalarExpr>& rtn) const ;
00374 };
00375 }
00376 
00377 #endif