SundanceEquationSet.hpp
Go to the documentation of this file.
00001 /* @HEADER@ */
00002 // ************************************************************************
00003 // 
00004 //                              Sundance
00005 //                 Copyright (2005) Sandia Corporation
00006 // 
00007 // Copyright (year first published) Sandia Corporation.  Under the terms 
00008 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government 
00009 // retains certain rights in this software.
00010 // 
00011 // This library is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Lesser General Public License as
00013 // published by the Free Software Foundation; either version 2.1 of the
00014 // License, or (at your option) any later version.
00015 //  
00016 // This library is distributed in the hope that it will be useful, but
00017 // WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 // Lesser General Public License for more details.
00020 //                                                                                 
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License along with this library; if not, write to the Free Software
00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00024 // USA                                                                                
00025 // Questions? Contact Kevin Long (krlong@sandia.gov), 
00026 // Sandia National Laboratories, Livermore, California, USA
00027 // 
00028 // ************************************************************************
00029 /* @HEADER@ */
00030 
00031 #ifndef SUNDANCE_EQUATIONSET_H
00032 #define SUNDANCE_EQUATIONSET_H
00033 
00034 #include "SundanceDefs.hpp"
00035 #include "SundanceExpr.hpp"
00036 #include "SundanceDerivSet.hpp"
00037 #include "SundanceComputationType.hpp"
00038 #include "SundanceRegionQuadCombo.hpp"
00039 #include "SundanceEvalContext.hpp"
00040 #include "SundanceObjectWithVerbosity.hpp"
00041 
00042 
00043 namespace Sundance
00044 {
00045 using namespace Teuchos;
00046 
00047 class FunctionSupportResolver;
00048 class CommonFuncDataStub;
00049 
00050 
00051 /** 
00052  * Source: SundanceEquationSet.cpp
00053  *
00054  * Header: SundanceEquationSet.hpp
00055  *
00056  * EquationSet is an object in which the symbolic specification 
00057  * of a problem or functional, its BCs, its test 
00058  * and unknown functions, and the
00059  * point about which it is to be linearized are all gathered. 
00060  * With this information we can compile lists of which functions
00061  * are defined on which regions of the domain, which is what is 
00062  * required for the building of DOF maps. We can't build the
00063  * DOF map here because in the Sundance core we know nothing
00064  * of the mesh, so we provide accessors to the information collected
00065  * by the EquationSet.
00066  *
00067  * This is <em>NOT</em> normally a user-level object. However,
00068  * EquationSet is one of the most important classes for the
00069  * inner workings of Sundance, so it is critical for a developer
00070  * to understand it. It is used
00071  * internally in the operation of user-level classes such
00072  * as LinearProblem, NonlinearProblem, and Functional. 
00073  *
00074  * There are several modes in which one might construct an equation set.
00075  * The first is where one has written out a weak form in terms
00076  * of test functions. The second is where one is taking variations
00077  * of some functional. 
00078  *
00079  * Note that "EquationSet" is a bit of a misnomer. It was originally
00080  * written to deal with setting up forward problems, but it has since
00081  * been extended to encompass functionals and variations. The name
00082  * persists for historical reasons; there is no particular need to
00083  * change it.
00084  *
00085  * \section intSection Integrals (weak equations and functionals)
00086  *
00087  * \see Integral
00088  *
00089  * \subsection regionSection Specifying regions of integration
00090  *
00091  * Weak equations or functionals are written in terms of integrals;
00092  * the regions on which integration is done must be defined somehow.
00093  * Because the symbolic core knows nothing of how geometry is
00094  * represented in whatever frameworks it's interacting with, the
00095  * region of integration can be represented only with stub classes.
00096  *
00097  * \subsection quadSection Specifying quadrature
00098  *
00099  * \section varSection Specifying variables
00100  *
00101  * \subsection multipleVarSection Multiple variables: Lists and Blocks 
00102  *
00103  * In a multivariable problem it may be useful to group variables
00104  * into blocks; for example, in a segregated Navier-Stokes preconditioner
00105  * the linearized equations are set up as a block system with
00106  * the velocities and the pressure put into different blocks:
00107  * \f[
00108  \left[ \left(u_x, u_y, u_z\right), \left(p\right)\right]^T
00109  * \f]
00110  * We use the following convention for specifying block structure:
00111  * variables aggregated by Expr's listing operations are considered
00112  * to be within a single block. The Teuchos Array object is then
00113  * used to aggregate multiple blocks. 
00114  *
00115  * \subsection variationSection Specifying which variations are taken
00116  *
00117  * The EquationSet class can be used to define a functional, and
00118  * one can then take variations of that functional with respect to 
00119  * some subset of the unknown functions appearing in the functional.
00120  * We'll refer to these as the variational functions. For each
00121  * variational function it is necessary to specify an evaluation
00122  * point, which is simply the value about which variations are taken.
00123  *
00124  * This variational capability can be used to take gradients in
00125  * an optimization problem, or to derive state or adjoint equations. 
00126  *
00127  * \subsection fixedSection Specifying which fields are held fixed
00128  *
00129  * Some variables may remain fixed when variations are taken. For
00130  * example, in PDE-constrained optimization, the state equations
00131  * are derived by taking variations of the Lagrangian with respect
00132  * to the adjoint variables, holding the state and design variables
00133  * constant. 
00134  *
00135  * \subsection evalSection Specifying points at which functions are evaluated
00136  *
00137  * Every field variable given to an equation set must also be given
00138  * an evaluation point. The evaluation point is another expression,
00139  * which must be of one of two types: a discrete function (subtype
00140  * of DiscreteFunctionStub) or a zero expression. 
00141  *
00142  * \subsection updateSection Updating evaluation points
00143  *
00144  * It is important to understand how values of evaluation points
00145  * are updated. This is <em>NOT</em> done by rebuilding the
00146  * EquationSet object with new evaluation points. Rather, it is
00147  * done by resetting the functions' internal data; because the
00148  * EquationSet has stored shallow copies of the evaluation points,
00149  * the EquationSet is updated automatically to follow any external
00150  * changes.
00151  *
00152  * \section internalSection 
00153  *
00154  * \subsection funcIDSection Reduced and unreduced function IDs 
00155  *
00156  * Every symbolic (i.e., test or unknown) function and unknown parameter 
00157  * has a unique integer ID known as its function ID, or funcID for
00158  * short. This ID remains associated with the function, never
00159  * changing, throughout the life of the function. These IDs need
00160  * not be contiguous nor ordered (they are, however, guaranteed to
00161  * be unique). 
00162  * 
00163  * In building an EquationSet, we will also create other ID numbers
00164  * for each function based on the position of each function within
00165  * the lists of functions given as input arguments to the equation
00166  * set ctor. These IDs are contiguous and ordered, with the ordering
00167  * defined by position in the input argument list. We will call these
00168  * "reduced IDs." The ID intrinsic to a function is called here its
00169  * "unreduced ID." EquationSet provided methods for converting
00170  * between reduced and unreduced IDs. 
00171  *
00172  * Note that a function that appears in several equation sets
00173  * might have different reduced IDs in the different equation sets,
00174  * but its unreduced ID will always be the same.
00175  *
00176  */
00177 class EquationSet : public ParameterControlledObjectWithVerbosity<EquationSet>
00178 {
00179 public:
00180   /** \name Constructors */
00181   //@{
00182   /** Set up a functional to be integrated, where all 
00183    * field variables are fixed to specified values. This ctor should
00184    * be used when setting up a functional for evaluation without
00185    * differentiation.
00186    * 
00187    * @param eqns The expression defining which integrals are
00188    * to be done to evaluate the functional
00189    *
00190    * @param bcs The expression defining any BC-like terms that
00191    * strongly replace the ordinary equations on certain subdomains.
00192    * If no BC terms are appropriate for a problem, simply enter an
00193    * empty expression for this argument.
00194    *
00195    * @param params Any unknown parameters appearing in the functional.
00196    * Multiple parameters should be entered as a List expression.
00197    * If no parameters are present, enter an empty expression.
00198    *
00199    * @param paramValues Values of the parameters en
00200    *
00201    * @param fields The field variables (i.e., unknown functions)
00202    * appearing in the functional.
00203    *
00204    * @param fieldValues Evaluation points for
00205    * the variables entered in the fields
00206    * argument. 
00207    */
00208   EquationSet(const Expr& eqns, 
00209     const Expr& bcs,
00210     const Expr& params,
00211     const Expr& paramValues,
00212     const Array<Expr>& fields,
00213     const Array<Expr>& fieldValues);
00214 
00215   /** Set up equations written in weak form with test functions. This
00216    * ctor should be used when setting up an ordinary forward problem.
00217    * 
00218    * \param eqns The expression defining the weak equations. This
00219    * can be linear or nonlinear.
00220    *
00221    * \param bcs The expression defining any BC-like terms that
00222    * strongly replace the ordinary equations on certain subdomains.
00223    * If no BC terms are appropriate for a problem, simply enter an
00224    * empty expression for this argument.
00225    *
00226    * \param testFunctions The test functions used in defining the weak
00227    * problem. The evaluation points for these functions are zero, and
00228    * need not be given as arguments. These should be subtypes of
00229    * TestFunctionStub, or lists thereof.
00230    *
00231    * \param unks The unknown functions for which the weak equation
00232    * will be solved. These should be subtypes of
00233    * UnknownFunctionStub, or lists thereof.
00234    *
00235    * \param unkLinearizationPts The values of the unknown function
00236    * about which the equations are linearized.
00237    *
00238    * \param unkParams The unknown parameters for which the weak equation
00239    * will be solved. These should of type
00240    * UnknownParameter, or a list thereof.
00241    *
00242    * \param unkParamEvalPts The values of the unknown parameters
00243    * about which the equations are linearized.
00244    *
00245    * \param params Any parameters whose values are held fixed (i.e,
00246    * not solved for). These should be of type 
00247    * UnknownParameter, or a list thereof.
00248    *
00249    * \param paramValues Values of the parameters entered in the params
00250    * argument. 
00251    *
00252    * \param fixedFields  Any field variables whose values are held 
00253    * fixed. These should be subtypes of
00254    * UnknownFunctionStub, or lists thereof.
00255    *
00256    * \param fixedFieldValues Values of the fixed field variables.
00257    * argument. 
00258    * 
00259    * \todo If unknown parameters are present, sensitivity equations 
00260    * should be set up as well. This is partially implemented
00261    * but not finished.
00262    */
00263   EquationSet(const Expr& eqns, 
00264     const Expr& bcs,
00265     const Array<Expr>& testFunctions, 
00266     const Array<Expr>& unks,
00267     const Array<Expr>& unkLinearizationPts,
00268     const Expr& unkParams,
00269     const Expr& unkParamEvalPts, 
00270     const Expr& params,
00271     const Expr& paramValues,
00272     const Array<Expr>& fixedFields,
00273     const Array<Expr>& fixedFieldValues);
00274 
00275 
00276   /* Set up calculation of a functional and its first derivative wrt a 
00277    * specified set of functions, to evaluated at a specified
00278    * point. Other functions can be specified as fixed during the 
00279    * calculation of these derivatives. 
00280    * 
00281    * \param eqns The expression defining which integrals are
00282    * to be done to evaluate the functional.
00283    *
00284    * \param bcs The expression defining any BC-like terms that
00285    * strongly replace the ordinary equations on certain subdomains.
00286    * If no BC terms are appropriate for a problem, simply enter an
00287    * empty expression for this argument.
00288    *
00289    * \param vars The functions with which variations are
00290    * to be taken. These should be subtypes of
00291    * UnknownFunctionStub, or lists thereof.
00292    *
00293    * \param varLinearizationPts The values of the variational
00294    * functions at which variations are taken.
00295    *
00296    * \param params Any parameters whose values are held fixed (i.e,
00297    * not solved for). These should be of type 
00298    * UnknownParameter, or a list thereof.
00299    *
00300    * \param paramValues Values of the parameters entered in the params
00301    * argument. 
00302    *
00303    * \param fixedFields  Any field variables whose values are held 
00304    * fixed. These should be subtypes of
00305    * UnknownFunctionStub, or lists thereof.
00306    *
00307    * \param fixedFieldValues Values of the fixed field variables.
00308    * argument. 
00309    */
00310   EquationSet(const Expr& eqns, 
00311     const Expr& bcs,
00312     const Array<Expr>& vars,
00313     const Array<Expr>& varLinearizationPts, 
00314     const Expr& params,
00315     const Expr& paramValues,
00316     const Array<Expr>& fixedFields,
00317     const Array<Expr>& fixedFieldValues);
00318 
00319   /** Set up calculation of first and second variations of 
00320    * a functional. This ctor should be used when deriving the
00321    * linearized form of a variational problem. */
00322   EquationSet(const Expr& eqns, 
00323     const Expr& bcs,
00324     const Array<Expr>& vars, 
00325     const Array<Expr>& varLinearizationPts,
00326     const Array<Expr>& unks,
00327     const Array<Expr>& unkLinearizationPts, 
00328     const Expr& params,
00329     const Expr& paramValues,
00330     const Array<Expr>& fixedFields,
00331     const Array<Expr>& fixedFieldValues);
00332 
00333   /** */
00334   EquationSet(const RCP<FunctionSupportResolver>& fsr,
00335     const Array<Expr>& varLinearizationPts,
00336     const Array<Expr>& unkLinearizationPts, 
00337     const Expr& paramValues,
00338     const Array<Expr>& fixedFieldValues);
00339 
00340   //@}
00341 
00342   /** \name Finding integration regions for the equation set */
00343   //@{
00344   /** Returns the number of regions on which pieces of the equation
00345    * or BCs are defined. */
00346   int numRegions() const ;
00347       
00348   /** Returns the d-th region for this equation set */
00349   const RCP<CellFilterStub>& region(int d) const ;
00350 
00351   /** Returns the index of the given region */
00352   int indexForRegion(const OrderedHandle<CellFilterStub>& region) const ;
00353 
00354   /** Indicate whether the given region has an essential BC expression */
00355   bool isBCRegion(int d) const ;
00356 
00357   /** Return the set of regions on which the specified 
00358    * test func appears. */
00359   const Set<OrderedHandle<CellFilterStub> >& 
00360   regionsForTestFunc(int unreducedTestID) const ;
00361       
00362   /** Return the set of regions on which the specified 
00363    * unknown func appears */
00364   const Set<OrderedHandle<CellFilterStub> >& 
00365   regionsForUnkFunc(int unreducedUnkID) const ;
00366 
00367   /** Returns the list of distinct subregion-quadrature combinations
00368    * appearing in the equation set. */
00369   const Array<RegionQuadCombo>& regionQuadCombos() const 
00370     {return regionQuadCombos_;}
00371 
00372   /** Returns the list of distinct subregion-quadrature combinations
00373    * appearing in the boundary conditions */
00374   const Array<RegionQuadCombo>& bcRegionQuadCombos() const 
00375     {return bcRegionQuadCombos_;}
00376       
00377   /** Indicates whether any var-unk pairs appear in the given domain */
00378   bool hasVarUnkPairs(const OrderedHandle<CellFilterStub>& domain) const 
00379     {return varUnkPairsOnRegions_.containsKey(domain);}
00380 
00381 
00382   /** Indicates whether any BC var-unk pairs appear in the given domain */
00383   bool hasBCVarUnkPairs(const OrderedHandle<CellFilterStub>& domain) const 
00384     {return bcVarUnkPairsOnRegions_.containsKey(domain);}
00385 
00386   /** Returns the (var, unk) pairs appearing on the given domain.
00387    * This is required for determining the sparsity structure of the
00388    * matrix */
00389   const RCP<Set<OrderedPair<int, int> > >& varUnkPairs(const OrderedHandle<CellFilterStub>& domain) const 
00390     {return varUnkPairsOnRegions_.get(domain);}
00391       
00392 
00393   /** Returns the (var, unk) pairs appearing on the given domain.
00394    * This is required for determining the sparsity structure of the
00395    * matrix */
00396   const RCP<Set<OrderedPair<int, int> > >& bcVarUnkPairs(const OrderedHandle<CellFilterStub>& domain) const ;
00397 
00398 
00399   /** Returns the integrand on the rqc r. */
00400   const Expr& expr(const RegionQuadCombo& r) const 
00401     {return regionQuadComboExprs_.get(r);}
00402 
00403   /** Returns the BC integrand on rqc r. */
00404   const Expr& bcExpr(const RegionQuadCombo& r) const 
00405     {return bcRegionQuadComboExprs_.get(r);}
00406 
00407   /** Indicates whether any watch flags are active */
00408   bool hasActiveWatchFlag() const ;
00409 
00410   /** Finds the maximum setting of the named watch type (e.g., "fill") across
00411    * all terms in the equation */
00412   int maxWatchFlagSetting(const std::string& param) const ;
00413 
00414   /** */
00415   const RCP<FunctionSupportResolver>& fsr() const {return fsr_;}
00416 
00417   //@}
00418       
00419 
00420   /** \name Creation of evaluation context objects */
00421   //@{
00422   /** Map RQC to the context for the derivs of the given compType */
00423   EvalContext rqcToContext(ComputationType compType, 
00424     const RegionQuadCombo& r) const ;
00425 
00426 
00427   /** Map BC RQC to the context for the derivs of the given compType */
00428   EvalContext bcRqcToContext(ComputationType compType, 
00429     const RegionQuadCombo& r) const ; 
00430   //@}
00431 
00432   /** \name Identification of RQCs to skip for given compType */
00433   //@{
00434   /** Map RQC to the context for the derivs of the given compType */
00435   bool skipRqc(ComputationType compType, 
00436     const RegionQuadCombo& r) const ;
00437 
00438 
00439   /** Map BC RQC to the context for the derivs of the given compType */
00440   bool skipBCRqc(ComputationType compType, 
00441     const RegionQuadCombo& r) const ;
00442   
00443   //@}
00444 
00445 
00446   /** \name Getting information about functions */
00447   //@{
00448   /** Returns the number of variational function blocks */
00449   int numVarBlocks() const ;
00450 
00451   /** Returns the number of unknown function blocks */
00452   int numUnkBlocks() const ;
00453 
00454   /** Returns the number of unknown parameters */
00455   int numUnkParams() const ;
00456 
00457   /** Returns the number of fixed parameters */
00458   int numFixedParams() const ;
00459 
00460   /** Returns the number of variational functions in this block */
00461   int numVars(int block) const ;
00462 
00463   /** Returns the number of unk functions in this block */
00464   int numUnks(int block) const ;
00465 
00466   /** Returns the number of variational function IDs in this block.
00467    * See the comment in FSR.hpp for an explanation of the difference 
00468    * between this and numVars(). */
00469   int numVarIDs(int block) const ;
00470 
00471   /** Returns the number of unk function IDs in this block.
00472    * See the comment in FSR.hpp for an explanation of the difference 
00473    * between this and numVars().  */
00474   int numUnkIDs(int block) const ;
00475 
00476   /** Returns the i-th variational function in block b */
00477   RCP<const CommonFuncDataStub> varFuncData(int b, int i) const ;
00478 
00479   /** Returns the i-th unknown function in block b */
00480   RCP<const CommonFuncDataStub> unkFuncData(int b, int i) const ;
00481 
00482   /** Returns the i-th unknown parameter */
00483   const Expr& unkParam(int i) const ;
00484 
00485   /** Returns the i-th unknown parameter */
00486   const Expr& fixedParam(int i) const ;
00487 
00488   /** Determine whether a given func ID is listed as a 
00489    * variational function in this equation set */
00490   bool hasVarID(int fid) const ;
00491 
00492   /** Determine whether a given func ID is listed as a unk function 
00493    * in this equation set */
00494   bool hasUnkID(int fid) const ;
00495 
00496   /** Determine whether a given func ID is listed as a unk parameter 
00497    * in this equation set */
00498   bool hasUnkParamID(int fid) const ;
00499 
00500   /** Determine whether a given func ID is listed as a fixed parameter 
00501    * in this equation set */
00502   bool hasFixedParamID(int fid) const ;
00503 
00504   /** get the block number for the variational function having the
00505    * specified unreduced funcID */
00506   int blockForVarID(int varID) const ;
00507 
00508   /** get the block number for the unknown function having the
00509    * specified unreduced funcID */
00510   int blockForUnkID(int unkID) const ;
00511   //@}
00512 
00513 
00514   /** \name Finding the functions that appear on regions */
00515   //@{
00516   /** Returns the variational functions that appear explicitly
00517    * on the d-th region */
00518   const Set<int>& varsOnRegion(int d) const ;
00519 
00520   /** Returns the unknown functions that appear explicitly on the
00521    * d-th region. */
00522   const Set<int>& unksOnRegion(int d) const ;
00523 
00524   /** Returns the variational functions that 
00525    * appear in BCs on the d-th region.
00526    * We can use this information to tag certain rows as BC rows */
00527   const Set<int>& bcVarsOnRegion(int d) const ;
00528 
00529   /** Returns the unknown functions that appear in BCs on the d-th region.
00530    * We can use this information to tag certain columns as BC
00531    * columns in the event we're doing symmetrized BC application */
00532   const Set<int>& bcUnksOnRegion(int d) const ;
00533 
00534 
00535   /** Returns the reduced variational functions that appear explicitly
00536    * on the d-th region */
00537   const Array<Set<int> >& reducedVarsOnRegion(const OrderedHandle<CellFilterStub>& r) const ;
00538 
00539 
00540   /** Returns the reduced unknown functions that appear explicitly on the
00541    * d-th region. */
00542   const Array<Set<int> >& reducedUnksOnRegion(const OrderedHandle<CellFilterStub>& r) const ;
00543   //@}
00544 
00545       
00546 
00547 
00548   /** \name Transforming between unreduced and reduced function IDs */
00549   //@{
00550   /** get the reduced ID for the variational function having the
00551    * specified unreduced funcID */
00552   int reducedVarID(int varID) const ;
00553 
00554   /** get the reduced ID for the unknown 
00555    * function having the given funcID */
00556   int reducedUnkID(int unkID) const ;
00557 
00558   /** get the reduced ID for the unk parameter
00559    * having the given funcID */
00560   int reducedUnkParamID(int unkID) const ;
00561 
00562   /** get the reduced ID for the fixed parameter
00563    * having the given funcID */
00564   int reducedFixedParamID(int unkID) const ;
00565 
00566   /** get the unreduced funcID for a variational function
00567    * as specified by a reduced ID and block index */
00568   int unreducedVarID(int block, int reducedVarID) const ;
00569 
00570 
00571   /** get the unreduced funcID for an unknown function
00572    * as specified by a reduced ID and block index */
00573   int unreducedUnkID(int block, int reducedUnkID) const ;
00574 
00575   /** get the unreduced funcID for an unknown parameter
00576    * as specified by a reduced ID and block index */
00577   int unreducedUnkParamID(int reducedUnkParamID) const ;
00578 
00579   /** get the unreduced funcID for a fixed parameter
00580    * as specified by a reduced ID and block index */
00581   int unreducedFixedParamID(int reducedFixedParamID) const ;
00582 
00583   //@}
00584 
00585 
00586   /** \name Information about which calculations can be done */
00587   //@{
00588   /** */
00589   bool isFunctionalCalculator() const {return isFunctionalCalculator_;}
00590 
00591   /** */
00592   bool isSensitivityCalculator() const {return isSensitivityProblem_;}
00593       
00594   /** Indicate whether this equation set will do the
00595    * given computation type */
00596   bool hasComputationType(ComputationType compType) const 
00597     {return compTypes_.contains(compType);}
00598 
00599   /** Return the types of computations this object can perform */
00600   const Set<ComputationType>& computationTypes() const 
00601     {return compTypes_;}
00602   //@}
00603 
00604       
00605 
00606   /** \name Information about which functional derivatives will be computed */
00607   //@{
00608   /** Returns the set of nonzero functional derivatives appearing
00609    * in the equation set at the given subregion-quadrature combination */
00610   const DerivSet& nonzeroFunctionalDerivs(ComputationType compType,
00611     const RegionQuadCombo& r) const ;
00612 
00613   /** Returns the set of nonzero functional derivatives appearing
00614    * in the boundary conditions
00615    *  at the given subregion-quadrature combination */
00616   const DerivSet& nonzeroBCFunctionalDerivs(ComputationType compType,
00617     const RegionQuadCombo& r) const;
00618   //@}
00619 
00620 
00621 
00622 private:
00623 
00624   /**
00625    * Flatten a spectral expression into a list of its coefficients
00626    */
00627   Expr flattenSpectral(const Expr& input) const ;
00628   /**
00629    * Flatten a spectral expression into a list of its coefficients
00630    */
00631   Array<Expr> flattenSpectral(const Array<Expr>& input) const ;
00632 
00633   /** 
00634    * Common initialization function called by all constructors
00635    */
00636   void init(const Array<Expr>& varLinearizationPts,
00637     const Array<Expr>& unkLinearizationPts,
00638     const Expr& unkParamEvalPts, 
00639     const Expr& fixedParamValues,
00640     const Array<Expr>& fixedFieldValues);
00641 
00642   /** Helper that converts an array of expr to a list expression */
00643   static Expr toList(const Array<Expr>& e);
00644 
00645   /** */
00646   void addToVarUnkPairs(const OrderedHandle<CellFilterStub>& domain,
00647     const Set<int>& vars,
00648     const Set<int>& unks,
00649     const DerivSet& nonzeros, 
00650     bool isBC,
00651     int verb);
00652 
00653   /** The FunctionSupportResolver deals with associating functions with
00654    * subdomains */
00655   RCP<FunctionSupportResolver> fsr_;
00656 
00657   /** Map from cell filter to pairs of (varID, unkID) appearing
00658    * on those cells. This is needed to construct the sparsity pattern
00659    * of the matrix. */
00660   Map<OrderedHandle<CellFilterStub>, RCP<Set<OrderedPair<int, int> > > > varUnkPairsOnRegions_;
00661 
00662   /** Map from cell filter to pairs of (varID, unkID) appearing
00663    * on those cells. This is needed to construct the sparsity pattern
00664    * of the matrix. */
00665   Map<OrderedHandle<CellFilterStub>, RCP<Set<OrderedPair<int, int> > > > bcVarUnkPairsOnRegions_;
00666 
00667   /** */
00668   Array<RegionQuadCombo> regionQuadCombos_;
00669 
00670   /** */
00671   Array<RegionQuadCombo> bcRegionQuadCombos_;
00672 
00673   /** */
00674   Map<RegionQuadCombo, Expr> regionQuadComboExprs_;
00675 
00676   /** */
00677   Map<RegionQuadCombo, Expr> bcRegionQuadComboExprs_;
00678 
00679   /** List of the sets of nonzero functional derivatives at 
00680    * each regionQuadCombo */
00681   Map<ComputationType, Map<RegionQuadCombo, DerivSet> > regionQuadComboNonzeroDerivs_;
00682 
00683   /** List of the sets of nonzero functional derivatives at 
00684    * each regionQuadCombo */
00685   Map<ComputationType, Map<RegionQuadCombo, DerivSet> > bcRegionQuadComboNonzeroDerivs_;
00686 
00687   /** List of the contexts for
00688    * each regionQuadCombo */
00689   Map<ComputationType, Map<RegionQuadCombo, EvalContext> > rqcToContext_;
00690 
00691   /** List of the contexts for
00692    * each BC regionQuadCombo */
00693   Map<ComputationType, Map<RegionQuadCombo, EvalContext> > bcRqcToContext_;
00694 
00695   /** List the RQCs that should be skipped for each computation type. 
00696    * This is needed in cases such as when a domain has matrix terms
00697    * but no vector terms. */
00698   Map<ComputationType, Set<RegionQuadCombo> > rqcToSkip_;
00699 
00700   /** List the BC RQCs that should be skipped for each computation type. */
00701   Map<ComputationType, Set<RegionQuadCombo> > bcRqcToSkip_;
00702 
00703 
00704   /** The point in function space about which the equations
00705    * are linearized */
00706   Array<Expr> unkLinearizationPts_;
00707 
00708   /** unknown parameter evaluation points for this equation set */
00709   Expr unkParamEvalPts_;
00710 
00711   /** fixed parameter evaluation points for this equation set */
00712   Expr fixedParamEvalPts_;
00713 
00714   /** Set of the computation types supported here */
00715   Set<ComputationType> compTypes_;
00716 
00717       
00718   /** Flag indicating whether this equation set is nonlinear */
00719   bool isNonlinear_;
00720       
00721   /** Flag indicating whether this equation set is 
00722    * a variational problem */
00723   bool isVariationalProblem_;
00724 
00725   /** Flag indicating whether this equation set is a functional
00726    * calculator */
00727   bool isFunctionalCalculator_;
00728       
00729   /** Flag indicating whether this equation set is 
00730    * a sensitivity problem */
00731   bool isSensitivityProblem_;
00732 
00733 };
00734 }
00735 
00736 #endif

Site Contact