Sundance::EquationSet Class Reference

Source: SundanceEquationSet.cpp. More...

Inheritance diagram for Sundance::EquationSet:

Sundance::ParameterControlledObjectWithVerbosity< EquationSet > Sundance::ObjectWithClassVerbosity< EquationSet > Playa::ObjectWithVerbosity

List of all members.

Public Member Functions

Constructors
 EquationSet (const Expr &eqns, const Expr &bcs, const Expr &params, const Expr &paramValues, const Array< Expr > &fields, const Array< Expr > &fieldValues)
 Set up a functional to be integrated, where all field variables are fixed to specified values.
 EquationSet (const Expr &eqns, const Expr &bcs, const Array< Expr > &testFunctions, const Array< Expr > &unks, const Array< Expr > &unkLinearizationPts, const Expr &unkParams, const Expr &unkParamEvalPts, const Expr &params, const Expr &paramValues, const Array< Expr > &fixedFields, const Array< Expr > &fixedFieldValues)
 Set up equations written in weak form with test functions.
 EquationSet (const Expr &eqns, const Expr &bcs, const Array< Expr > &vars, const Array< Expr > &varLinearizationPts, const Expr &params, const Expr &paramValues, const Array< Expr > &fixedFields, const Array< Expr > &fixedFieldValues)
 EquationSet (const Expr &eqns, const Expr &bcs, const Array< Expr > &vars, const Array< Expr > &varLinearizationPts, const Array< Expr > &unks, const Array< Expr > &unkLinearizationPts, const Expr &params, const Expr &paramValues, const Array< Expr > &fixedFields, const Array< Expr > &fixedFieldValues)
 Set up calculation of first and second variations of a functional.
 EquationSet (const RCP< FunctionSupportResolver > &fsr, const Array< Expr > &varLinearizationPts, const Array< Expr > &unkLinearizationPts, const Expr &paramValues, const Array< Expr > &fixedFieldValues)
Finding integration regions for the equation set
int numRegions () const
 Returns the number of regions on which pieces of the equation or BCs are defined.
const RCP< CellFilterStub > & region (int d) const
 Returns the d-th region for this equation set.
int indexForRegion (const OrderedHandle< CellFilterStub > &region) const
 Returns the index of the given region.
bool isBCRegion (int d) const
 Indicate whether the given region has an essential BC expression.
const Set< OrderedHandle
< CellFilterStub > > & 
regionsForTestFunc (int unreducedTestID) const
 Return the set of regions on which the specified test func appears.
const Set< OrderedHandle
< CellFilterStub > > & 
regionsForUnkFunc (int unreducedUnkID) const
 Return the set of regions on which the specified unknown func appears.
const Array< RegionQuadCombo > & regionQuadCombos () const
 Returns the list of distinct subregion-quadrature combinations appearing in the equation set.
const Array< RegionQuadCombo > & bcRegionQuadCombos () const
 Returns the list of distinct subregion-quadrature combinations appearing in the boundary conditions.
bool hasVarUnkPairs (const OrderedHandle< CellFilterStub > &domain) const
 Indicates whether any var-unk pairs appear in the given domain.
bool hasBCVarUnkPairs (const OrderedHandle< CellFilterStub > &domain) const
 Indicates whether any BC var-unk pairs appear in the given domain.
const RCP< Set< OrderedPair
< int, int > > > & 
varUnkPairs (const OrderedHandle< CellFilterStub > &domain) const
 Returns the (var, unk) pairs appearing on the given domain.
const RCP< Set< OrderedPair
< int, int > > > & 
bcVarUnkPairs (const OrderedHandle< CellFilterStub > &domain) const
 Returns the (var, unk) pairs appearing on the given domain.
const Exprexpr (const RegionQuadCombo &r) const
 Returns the integrand on the rqc r.
const ExprbcExpr (const RegionQuadCombo &r) const
 Returns the BC integrand on rqc r.
bool hasActiveWatchFlag () const
 Indicates whether any watch flags are active.
int maxWatchFlagSetting (const std::string &param) const
 Finds the maximum setting of the named watch type (e.g., "fill") across all terms in the equation.
const RCP
< FunctionSupportResolver > & 
fsr () const
Creation of evaluation context objects
EvalContext rqcToContext (ComputationType compType, const RegionQuadCombo &r) const
 Map RQC to the context for the derivs of the given compType.
EvalContext bcRqcToContext (ComputationType compType, const RegionQuadCombo &r) const
 Map BC RQC to the context for the derivs of the given compType.
Identification of RQCs to skip for given compType
bool skipRqc (ComputationType compType, const RegionQuadCombo &r) const
 Map RQC to the context for the derivs of the given compType.
bool skipBCRqc (ComputationType compType, const RegionQuadCombo &r) const
 Map BC RQC to the context for the derivs of the given compType.
Getting information about functions
int numVarBlocks () const
 Returns the number of variational function blocks.
int numUnkBlocks () const
 Returns the number of unknown function blocks.
int numUnkParams () const
 Returns the number of unknown parameters.
int numFixedParams () const
 Returns the number of fixed parameters.
int numVars (int block) const
 Returns the number of variational functions in this block.
int numUnks (int block) const
 Returns the number of unk functions in this block.
int numVarIDs (int block) const
 Returns the number of variational function IDs in this block.
int numUnkIDs (int block) const
 Returns the number of unk function IDs in this block.
RCP< const CommonFuncDataStubvarFuncData (int b, int i) const
 Returns the i-th variational function in block b.
RCP< const CommonFuncDataStubunkFuncData (int b, int i) const
 Returns the i-th unknown function in block b.
const ExprunkParam (int i) const
 Returns the i-th unknown parameter.
const ExprfixedParam (int i) const
 Returns the i-th unknown parameter.
bool hasVarID (int fid) const
 Determine whether a given func ID is listed as a variational function in this equation set.
bool hasUnkID (int fid) const
 Determine whether a given func ID is listed as a unk function in this equation set.
bool hasUnkParamID (int fid) const
 Determine whether a given func ID is listed as a unk parameter in this equation set.
bool hasFixedParamID (int fid) const
 Determine whether a given func ID is listed as a fixed parameter in this equation set.
int blockForVarID (int varID) const
 get the block number for the variational function having the specified unreduced funcID
int blockForUnkID (int unkID) const
 get the block number for the unknown function having the specified unreduced funcID
Finding the functions that appear on regions
const Set< int > & varsOnRegion (int d) const
 Returns the variational functions that appear explicitly on the d-th region.
const Set< int > & unksOnRegion (int d) const
 Returns the unknown functions that appear explicitly on the d-th region.
const Set< int > & bcVarsOnRegion (int d) const
 Returns the variational functions that appear in BCs on the d-th region.
const Set< int > & bcUnksOnRegion (int d) const
 Returns the unknown functions that appear in BCs on the d-th region.
const Array< Set< int > > & reducedVarsOnRegion (const OrderedHandle< CellFilterStub > &r) const
 Returns the reduced variational functions that appear explicitly on the d-th region.
const Array< Set< int > > & reducedUnksOnRegion (const OrderedHandle< CellFilterStub > &r) const
 Returns the reduced unknown functions that appear explicitly on the d-th region.
Transforming between unreduced and reduced function IDs
int reducedVarID (int varID) const
 get the reduced ID for the variational function having the specified unreduced funcID
int reducedUnkID (int unkID) const
 get the reduced ID for the unknown function having the given funcID
int reducedUnkParamID (int unkID) const
 get the reduced ID for the unk parameter having the given funcID
int reducedFixedParamID (int unkID) const
 get the reduced ID for the fixed parameter having the given funcID
int unreducedVarID (int block, int reducedVarID) const
 get the unreduced funcID for a variational function as specified by a reduced ID and block index
int unreducedUnkID (int block, int reducedUnkID) const
 get the unreduced funcID for an unknown function as specified by a reduced ID and block index
int unreducedUnkParamID (int reducedUnkParamID) const
 get the unreduced funcID for an unknown parameter as specified by a reduced ID and block index
int unreducedFixedParamID (int reducedFixedParamID) const
 get the unreduced funcID for a fixed parameter as specified by a reduced ID and block index
Information about which calculations can be done
bool isFunctionalCalculator () const
bool isSensitivityCalculator () const
bool hasComputationType (ComputationType compType) const
 Indicate whether this equation set will do the given computation type.
const Set< ComputationType > & computationTypes () const
 Return the types of computations this object can perform.
Information about which functional derivatives will be computed
const DerivSetnonzeroFunctionalDerivs (ComputationType compType, const RegionQuadCombo &r) const
 Returns the set of nonzero functional derivatives appearing in the equation set at the given subregion-quadrature combination.
const DerivSetnonzeroBCFunctionalDerivs (ComputationType compType, const RegionQuadCombo &r) const
 Returns the set of nonzero functional derivatives appearing in the boundary conditions at the given subregion-quadrature combination.

Private Member Functions

Expr flattenSpectral (const Expr &input) const
 Flatten a spectral expression into a list of its coefficients.
Array< ExprflattenSpectral (const Array< Expr > &input) const
 Flatten a spectral expression into a list of its coefficients.
void init (const Array< Expr > &varLinearizationPts, const Array< Expr > &unkLinearizationPts, const Expr &unkParamEvalPts, const Expr &fixedParamValues, const Array< Expr > &fixedFieldValues)
 Common initialization function called by all constructors.
void addToVarUnkPairs (const OrderedHandle< CellFilterStub > &domain, const Set< int > &vars, const Set< int > &unks, const DerivSet &nonzeros, bool isBC, int verb)

Static Private Member Functions

static Expr toList (const Array< Expr > &e)
 Helper that converts an array of expr to a list expression.

Private Attributes

RCP< FunctionSupportResolverfsr_
 The FunctionSupportResolver deals with associating functions with subdomains.
Map< OrderedHandle
< CellFilterStub >, RCP< Set
< OrderedPair< int, int > > > > 
varUnkPairsOnRegions_
 Map from cell filter to pairs of (varID, unkID) appearing on those cells.
Map< OrderedHandle
< CellFilterStub >, RCP< Set
< OrderedPair< int, int > > > > 
bcVarUnkPairsOnRegions_
 Map from cell filter to pairs of (varID, unkID) appearing on those cells.
Array< RegionQuadComboregionQuadCombos_
Array< RegionQuadCombobcRegionQuadCombos_
Map< RegionQuadCombo, ExprregionQuadComboExprs_
Map< RegionQuadCombo, ExprbcRegionQuadComboExprs_
Map< ComputationType, Map
< RegionQuadCombo, DerivSet > > 
regionQuadComboNonzeroDerivs_
 List of the sets of nonzero functional derivatives at each regionQuadCombo.
Map< ComputationType, Map
< RegionQuadCombo, DerivSet > > 
bcRegionQuadComboNonzeroDerivs_
 List of the sets of nonzero functional derivatives at each regionQuadCombo.
Map< ComputationType, Map
< RegionQuadCombo, EvalContext > > 
rqcToContext_
 List of the contexts for each regionQuadCombo.
Map< ComputationType, Map
< RegionQuadCombo, EvalContext > > 
bcRqcToContext_
 List of the contexts for each BC regionQuadCombo.
Map< ComputationType, Set
< RegionQuadCombo > > 
rqcToSkip_
 List the RQCs that should be skipped for each computation type.
Map< ComputationType, Set
< RegionQuadCombo > > 
bcRqcToSkip_
 List the BC RQCs that should be skipped for each computation type.
Array< ExprunkLinearizationPts_
 The point in function space about which the equations are linearized.
Expr unkParamEvalPts_
 unknown parameter evaluation points for this equation set
Expr fixedParamEvalPts_
 fixed parameter evaluation points for this equation set
Set< ComputationTypecompTypes_
 Set of the computation types supported here.
bool isNonlinear_
 Flag indicating whether this equation set is nonlinear.
bool isVariationalProblem_
 Flag indicating whether this equation set is a variational problem.
bool isFunctionalCalculator_
 Flag indicating whether this equation set is a functional calculator.
bool isSensitivityProblem_
 Flag indicating whether this equation set is a sensitivity problem.

Related Functions

(Note that these are not member functions.)

enum  ComputationType {
  MatrixAndVector, VectorOnly, FunctionalOnly, FunctionalAndGradient,
  Sensitivities
}
Expr Integral (const Handle< CellFilterStub > &domain, const Expr &integrand, const WatchFlag &watch=WatchFlag())
Expr Integral (const Handle< CellFilterStub > &domain, const Expr &integrand, const Handle< QuadratureFamilyStub > &quad, const WatchFlag &watch=WatchFlag())
Expr Integral (const Handle< CellFilterStub > &domain, const Expr &integrand, const Handle< QuadratureFamilyStub > &quad, const ParametrizedCurve &curve, const WatchFlag &watch=WatchFlag())


Detailed Description

Source: SundanceEquationSet.cpp.

Header: SundanceEquationSet.hpp

EquationSet is an object in which the symbolic specification of a problem or functional, its BCs, its test and unknown functions, and the point about which it is to be linearized are all gathered. With this information we can compile lists of which functions are defined on which regions of the domain, which is what is required for the building of DOF maps. We can't build the DOF map here because in the Sundance core we know nothing of the mesh, so we provide accessors to the information collected by the EquationSet.

This is NOT normally a user-level object. However, EquationSet is one of the most important classes for the inner workings of Sundance, so it is critical for a developer to understand it. It is used internally in the operation of user-level classes such as LinearProblem, NonlinearProblem, and Functional.

There are several modes in which one might construct an equation set. The first is where one has written out a weak form in terms of test functions. The second is where one is taking variations of some functional.

Note that "EquationSet" is a bit of a misnomer. It was originally written to deal with setting up forward problems, but it has since been extended to encompass functionals and variations. The name persists for historical reasons; there is no particular need to change it.

Integrals (weak equations and functionals)

See also:
Integral

Specifying regions of integration

Weak equations or functionals are written in terms of integrals; the regions on which integration is done must be defined somehow. Because the symbolic core knows nothing of how geometry is represented in whatever frameworks it's interacting with, the region of integration can be represented only with stub classes.

Specifying quadrature

Specifying variables

Multiple variables: Lists and Blocks

In a multivariable problem it may be useful to group variables into blocks; for example, in a segregated Navier-Stokes preconditioner the linearized equations are set up as a block system with the velocities and the pressure put into different blocks:

\[ \left[ \left(u_x, u_y, u_z\right), \left(p\right)\right]^T \]

We use the following convention for specifying block structure: variables aggregated by Expr's listing operations are considered to be within a single block. The Teuchos Array object is then used to aggregate multiple blocks.

Specifying which variations are taken

The EquationSet class can be used to define a functional, and one can then take variations of that functional with respect to some subset of the unknown functions appearing in the functional. We'll refer to these as the variational functions. For each variational function it is necessary to specify an evaluation point, which is simply the value about which variations are taken.

This variational capability can be used to take gradients in an optimization problem, or to derive state or adjoint equations.

Specifying which fields are held fixed

Some variables may remain fixed when variations are taken. For example, in PDE-constrained optimization, the state equations are derived by taking variations of the Lagrangian with respect to the adjoint variables, holding the state and design variables constant.

Specifying points at which functions are evaluated

Every field variable given to an equation set must also be given an evaluation point. The evaluation point is another expression, which must be of one of two types: a discrete function (subtype of DiscreteFunctionStub) or a zero expression.

Updating evaluation points

It is important to understand how values of evaluation points are updated. This is NOT done by rebuilding the EquationSet object with new evaluation points. Rather, it is done by resetting the functions' internal data; because the EquationSet has stored shallow copies of the evaluation points, the EquationSet is updated automatically to follow any external changes.

internalSection

Reduced and unreduced function IDs

Every symbolic (i.e., test or unknown) function and unknown parameter has a unique integer ID known as its function ID, or funcID for short. This ID remains associated with the function, never changing, throughout the life of the function. These IDs need not be contiguous nor ordered (they are, however, guaranteed to be unique).

In building an EquationSet, we will also create other ID numbers for each function based on the position of each function within the lists of functions given as input arguments to the equation set ctor. These IDs are contiguous and ordered, with the ordering defined by position in the input argument list. We will call these "reduced IDs." The ID intrinsic to a function is called here its "unreduced ID." EquationSet provided methods for converting between reduced and unreduced IDs.

Note that a function that appears in several equation sets might have different reduced IDs in the different equation sets, but its unreduced ID will always be the same.

Definition at line 177 of file SundanceEquationSet.hpp.


Constructor & Destructor Documentation

EquationSet::EquationSet ( const Expr eqns,
const Expr bcs,
const Expr params,
const Expr paramValues,
const Array< Expr > &  fields,
const Array< Expr > &  fieldValues 
)

Set up a functional to be integrated, where all field variables are fixed to specified values.

This ctor should be used when setting up a functional for evaluation without differentiation.

Parameters:
eqns The expression defining which integrals are to be done to evaluate the functional
bcs The expression defining any BC-like terms that strongly replace the ordinary equations on certain subdomains. If no BC terms are appropriate for a problem, simply enter an empty expression for this argument.
params Any unknown parameters appearing in the functional. Multiple parameters should be entered as a List expression. If no parameters are present, enter an empty expression.
paramValues Values of the parameters en
fields The field variables (i.e., unknown functions) appearing in the functional.
fieldValues Evaluation points for the variables entered in the fields argument.

Definition at line 54 of file SundanceEquationSet.cpp.

References bcRegionQuadComboNonzeroDerivs_, bcRqcToContext_, compTypes_, fsr_, Sundance::FunctionalOnly, init(), Sundance::Map< Key, Value, Compare >::put(), Sundance::Set< Key, Compare >::put(), regionQuadComboNonzeroDerivs_, rqcToContext_, and unkParamEvalPts_.

EquationSet::EquationSet ( const Expr eqns,
const Expr bcs,
const Array< Expr > &  testFunctions,
const Array< Expr > &  unks,
const Array< Expr > &  unkLinearizationPts,
const Expr unkParams,
const Expr unkParamEvalPts,
const Expr params,
const Expr paramValues,
const Array< Expr > &  fixedFields,
const Array< Expr > &  fixedFieldValues 
)

Set up equations written in weak form with test functions.

This ctor should be used when setting up an ordinary forward problem.

Parameters:
eqns The expression defining the weak equations. This can be linear or nonlinear.
bcs The expression defining any BC-like terms that strongly replace the ordinary equations on certain subdomains. If no BC terms are appropriate for a problem, simply enter an empty expression for this argument.
testFunctions The test functions used in defining the weak problem. The evaluation points for these functions are zero, and need not be given as arguments. These should be subtypes of TestFunctionStub, or lists thereof.
unks The unknown functions for which the weak equation will be solved. These should be subtypes of UnknownFunctionStub, or lists thereof.
unkLinearizationPts The values of the unknown function about which the equations are linearized.
unkParams The unknown parameters for which the weak equation will be solved. These should of type UnknownParameter, or a list thereof.
unkParamEvalPts The values of the unknown parameters about which the equations are linearized.
params Any parameters whose values are held fixed (i.e, not solved for). These should be of type UnknownParameter, or a list thereof.
paramValues Values of the parameters entered in the params argument.
fixedFields Any field variables whose values are held fixed. These should be subtypes of UnknownFunctionStub, or lists thereof.
fixedFieldValues Values of the fixed field variables. argument.
Todo:
If unknown parameters are present, sensitivity equations should be set up as well. This is partially implemented but not finished.

Definition at line 106 of file SundanceEquationSet.cpp.

References bcRegionQuadComboNonzeroDerivs_, bcRqcToContext_, compTypes_, flattenSpectral(), fsr_, init(), Sundance::MatrixAndVector, Sundance::Map< Key, Value, Compare >::put(), Sundance::Set< Key, Compare >::put(), regionQuadComboNonzeroDerivs_, rqcToContext_, Sundance::Sensitivities, Sundance::Expr::size(), unkParamEvalPts_, and Sundance::VectorOnly.

EquationSet::EquationSet ( const Expr eqns,
const Expr bcs,
const Array< Expr > &  vars,
const Array< Expr > &  varLinearizationPts,
const Expr params,
const Expr paramValues,
const Array< Expr > &  fixedFields,
const Array< Expr > &  fixedFieldValues 
)

EquationSet::EquationSet ( const Expr eqns,
const Expr bcs,
const Array< Expr > &  vars,
const Array< Expr > &  varLinearizationPts,
const Array< Expr > &  unks,
const Array< Expr > &  unkLinearizationPts,
const Expr params,
const Expr paramValues,
const Array< Expr > &  fixedFields,
const Array< Expr > &  fixedFieldValues 
)

Set up calculation of first and second variations of a functional.

This ctor should be used when deriving the linearized form of a variational problem.

Definition at line 180 of file SundanceEquationSet.cpp.

References bcRegionQuadComboNonzeroDerivs_, bcRqcToContext_, compTypes_, flattenSpectral(), fsr_, init(), isVariationalProblem_, Sundance::MatrixAndVector, Sundance::Map< Key, Value, Compare >::put(), Sundance::Set< Key, Compare >::put(), regionQuadComboNonzeroDerivs_, rqcToContext_, unkParamEvalPts_, and Sundance::VectorOnly.

Sundance::EquationSet::EquationSet ( const RCP< FunctionSupportResolver > &  fsr,
const Array< Expr > &  varLinearizationPts,
const Array< Expr > &  unkLinearizationPts,
const Expr paramValues,
const Array< Expr > &  fixedFieldValues 
)


Member Function Documentation

void EquationSet::addToVarUnkPairs ( const OrderedHandle< CellFilterStub > &  domain,
const Set< int > &  vars,
const Set< int > &  unks,
const DerivSet nonzeros,
bool  isBC,
int  verb 
) [private]

const Expr& Sundance::EquationSet::bcExpr ( const RegionQuadCombo r  )  const [inline]

Returns the BC integrand on rqc r.

Definition at line 404 of file SundanceEquationSet.hpp.

References bcRegionQuadComboExprs_, and Sundance::Map< Key, Value, Compare >::get().

const Array<RegionQuadCombo>& Sundance::EquationSet::bcRegionQuadCombos (  )  const [inline]

Returns the list of distinct subregion-quadrature combinations appearing in the boundary conditions.

Definition at line 374 of file SundanceEquationSet.hpp.

References bcRegionQuadCombos_.

Referenced by hasActiveWatchFlag(), and maxWatchFlagSetting().

EvalContext EquationSet::bcRqcToContext ( ComputationType  compType,
const RegionQuadCombo r 
) const

Map BC RQC to the context for the derivs of the given compType.

Definition at line 1155 of file SundanceEquationSet.cpp.

References bcRqcToContext_, Sundance::Map< Key, Value, Compare >::containsKey(), and Sundance::Map< Key, Value, Compare >::get().

const Set< int > & EquationSet::bcUnksOnRegion ( int  d  )  const

Returns the unknown functions that appear in BCs on the d-th region.

We can use this information to tag certain columns as BC columns in the event we're doing symmetrized BC application

Definition at line 1360 of file SundanceEquationSet.cpp.

References fsr_.

const Set< int > & EquationSet::bcVarsOnRegion ( int  d  )  const

Returns the variational functions that appear in BCs on the d-th region.

We can use this information to tag certain rows as BC rows

Definition at line 1354 of file SundanceEquationSet.cpp.

References fsr_.

const RCP< Set< OrderedPair< int, int > > > & EquationSet::bcVarUnkPairs ( const OrderedHandle< CellFilterStub > &  domain  )  const

Returns the (var, unk) pairs appearing on the given domain.

This is required for determining the sparsity structure of the matrix

Definition at line 1119 of file SundanceEquationSet.cpp.

References bcVarUnkPairsOnRegions_, Sundance::Map< Key, Value, Compare >::containsKey(), and Sundance::Map< Key, Value, Compare >::get().

int EquationSet::blockForUnkID ( int  unkID  )  const

get the block number for the unknown function having the specified unreduced funcID

Definition at line 1248 of file SundanceEquationSet.cpp.

References fsr_.

Referenced by Sundance::GrouperBase::extractWeakForm(), and Sundance::TrivialGrouper::findGroups().

int EquationSet::blockForVarID ( int  varID  )  const

get the block number for the variational function having the specified unreduced funcID

Definition at line 1243 of file SundanceEquationSet.cpp.

References fsr_.

Referenced by Sundance::GrouperBase::extractWeakForm(), and Sundance::TrivialGrouper::findGroups().

const Set<ComputationType>& Sundance::EquationSet::computationTypes (  )  const [inline]

Return the types of computations this object can perform.

Definition at line 600 of file SundanceEquationSet.hpp.

References compTypes_.

const Expr& Sundance::EquationSet::expr ( const RegionQuadCombo r  )  const [inline]

Returns the integrand on the rqc r.

Definition at line 400 of file SundanceEquationSet.hpp.

References Sundance::Map< Key, Value, Compare >::get(), and regionQuadComboExprs_.

const Expr& Sundance::EquationSet::fixedParam ( int  i  )  const

Returns the i-th unknown parameter.

Array< Expr > EquationSet::flattenSpectral ( const Array< Expr > &  input  )  const [private]

Flatten a spectral expression into a list of its coefficients.

Definition at line 1073 of file SundanceEquationSet.cpp.

References flattenSpectral().

Expr EquationSet::flattenSpectral ( const Expr input  )  const [private]

Flatten a spectral expression into a list of its coefficients.

Definition at line 1084 of file SundanceEquationSet.cpp.

References Sundance::Expr::flatten(), Playa::Handle< PointerType >::ptr(), and Sundance::Expr::size().

Referenced by EquationSet(), and flattenSpectral().

const RCP<FunctionSupportResolver>& Sundance::EquationSet::fsr (  )  const [inline]

Definition at line 415 of file SundanceEquationSet.hpp.

References fsr_.

bool EquationSet::hasActiveWatchFlag (  )  const

Indicates whether any watch flags are active.

Definition at line 1042 of file SundanceEquationSet.cpp.

References bcRegionQuadCombos(), and regionQuadCombos().

Referenced by maxWatchFlagSetting().

bool Sundance::EquationSet::hasBCVarUnkPairs ( const OrderedHandle< CellFilterStub > &  domain  )  const [inline]

Indicates whether any BC var-unk pairs appear in the given domain.

Definition at line 383 of file SundanceEquationSet.hpp.

References bcVarUnkPairsOnRegions_, and Sundance::Map< Key, Value, Compare >::containsKey().

bool Sundance::EquationSet::hasComputationType ( ComputationType  compType  )  const [inline]

Indicate whether this equation set will do the given computation type.

Definition at line 596 of file SundanceEquationSet.hpp.

References compTypes_, and Sundance::Set< Key, Compare >::contains().

bool EquationSet::hasFixedParamID ( int  fid  )  const

Determine whether a given func ID is listed as a fixed parameter in this equation set.

Definition at line 1337 of file SundanceEquationSet.cpp.

References fsr_.

Referenced by Sundance::GrouperBase::extractWeakForm().

bool EquationSet::hasUnkID ( int  fid  )  const

Determine whether a given func ID is listed as a unk function in this equation set.

Definition at line 1327 of file SundanceEquationSet.cpp.

References fsr_.

Referenced by Sundance::TrivialGrouper::findGroups().

bool EquationSet::hasUnkParamID ( int  fid  )  const

Determine whether a given func ID is listed as a unk parameter in this equation set.

Definition at line 1332 of file SundanceEquationSet.cpp.

References fsr_.

bool EquationSet::hasVarID ( int  fid  )  const

Determine whether a given func ID is listed as a variational function in this equation set.

Definition at line 1322 of file SundanceEquationSet.cpp.

References fsr_.

Referenced by Sundance::GrouperBase::extractWeakForm(), and Sundance::TrivialGrouper::findGroups().

bool Sundance::EquationSet::hasVarUnkPairs ( const OrderedHandle< CellFilterStub > &  domain  )  const [inline]

Indicates whether any var-unk pairs appear in the given domain.

Definition at line 378 of file SundanceEquationSet.hpp.

References Sundance::Map< Key, Value, Compare >::containsKey(), and varUnkPairsOnRegions_.

int EquationSet::indexForRegion ( const OrderedHandle< CellFilterStub > &  region  )  const

Returns the index of the given region.

Definition at line 1263 of file SundanceEquationSet.cpp.

References fsr_.

void EquationSet::init ( const Array< Expr > &  varLinearizationPts,
const Array< Expr > &  unkLinearizationPts,
const Expr unkParamEvalPts,
const Expr fixedParamValues,
const Array< Expr > &  fixedFieldValues 
) [private]

Common initialization function called by all constructors.

Definition at line 307 of file SundanceEquationSet.cpp.

References addToVarUnkPairs(), bcRegionQuadComboExprs_, bcRegionQuadComboNonzeroDerivs_, bcRegionQuadCombos_, bcRqcToContext_, bcRqcToSkip_, Sundance::Set< Key, Compare >::begin(), compTypes_, Sundance::Set< Key, Compare >::contains(), Sundance::RegionQuadCombo::domain(), Sundance::Set< Key, Compare >::elements(), Sundance::Set< Key, Compare >::end(), Sundance::SumOfIntegrals::eqnSetSetupVerb(), Sundance::Expr::flatten(), fsr_, Sundance::FunctionalAndGradient, Sundance::FunctionalOnly, Sundance::SumOfIntegrals::hasWatchedTerm(), Sundance::WatchFlag::isActive(), isVariationalProblem_, Sundance::List(), Sundance::MatrixAndVector, Playa::max(), Sundance::EvalContext::nextID(), Sundance::WatchFlag::param(), Sundance::Map< Key, Value, Compare >::put(), Sundance::Set< Key, Compare >::put(), Sundance::RegionQuadCombo::quad(), regionQuadComboExprs_, regionQuadComboNonzeroDerivs_, regionQuadCombos_, rqcToContext_, Sundance::SumOfIntegrals::rqcToExprMap(), rqcToSkip_, Sundance::Sensitivities, Sundance::EvalContext::setEvalSetupVerbosity(), Sundance::EvalContext::setSetupVerbosity(), Sundance::SymbPreprocessor::setupFunctional(), Sundance::SymbPreprocessor::setupFwdProblem(), Sundance::SymbPreprocessor::setupGradient(), Sundance::SymbPreprocessor::setupSensitivities(), Sundance::SymbPreprocessor::setupVariations(), Sundance::Set< Key, Compare >::size(), SUNDANCE_BANNER1, SUNDANCE_MSG1, SUNDANCE_MSG2, toList(), Sundance::VectorOnly, Playa::ObjectWithVerbosity::verb(), and Sundance::RegionQuadCombo::watch().

Referenced by EquationSet().

bool EquationSet::isBCRegion ( int  d  )  const

Indicate whether the given region has an essential BC expression.

Definition at line 1133 of file SundanceEquationSet.cpp.

References fsr_.

bool Sundance::EquationSet::isFunctionalCalculator (  )  const [inline]

Definition at line 589 of file SundanceEquationSet.hpp.

References isFunctionalCalculator_.

bool Sundance::EquationSet::isSensitivityCalculator (  )  const [inline]

Definition at line 592 of file SundanceEquationSet.hpp.

References isSensitivityProblem_.

int EquationSet::maxWatchFlagSetting ( const std::string &  param  )  const

Finds the maximum setting of the named watch type (e.g., "fill") across all terms in the equation.

Definition at line 1056 of file SundanceEquationSet.cpp.

References bcRegionQuadCombos(), hasActiveWatchFlag(), and regionQuadCombos().

const DerivSet & EquationSet::nonzeroBCFunctionalDerivs ( ComputationType  compType,
const RegionQuadCombo r 
) const

Returns the set of nonzero functional derivatives appearing in the boundary conditions at the given subregion-quadrature combination.

Definition at line 1203 of file SundanceEquationSet.cpp.

References bcRegionQuadComboNonzeroDerivs_, Sundance::Map< Key, Value, Compare >::containsKey(), and Sundance::Map< Key, Value, Compare >::get().

const DerivSet & EquationSet::nonzeroFunctionalDerivs ( ComputationType  compType,
const RegionQuadCombo r 
) const

Returns the set of nonzero functional derivatives appearing in the equation set at the given subregion-quadrature combination.

Definition at line 1193 of file SundanceEquationSet.cpp.

References Sundance::Map< Key, Value, Compare >::containsKey(), Sundance::Map< Key, Value, Compare >::get(), and regionQuadComboNonzeroDerivs_.

int EquationSet::numFixedParams (  )  const

Returns the number of fixed parameters.

Definition at line 1288 of file SundanceEquationSet.cpp.

References fsr_.

int EquationSet::numRegions (  )  const

Returns the number of regions on which pieces of the equation or BCs are defined.

Definition at line 1268 of file SundanceEquationSet.cpp.

References fsr_.

int EquationSet::numUnkBlocks (  )  const

Returns the number of unknown function blocks.

Definition at line 1280 of file SundanceEquationSet.cpp.

References fsr_.

int EquationSet::numUnkIDs ( int  block  )  const

Returns the number of unk function IDs in this block.

See the comment in FSR.hpp for an explanation of the difference between this and numVars().

Definition at line 1304 of file SundanceEquationSet.cpp.

References fsr_.

int EquationSet::numUnkParams (  )  const

Returns the number of unknown parameters.

Definition at line 1284 of file SundanceEquationSet.cpp.

References fsr_.

int EquationSet::numUnks ( int  block  )  const

Returns the number of unk functions in this block.

Definition at line 1296 of file SundanceEquationSet.cpp.

References fsr_.

int EquationSet::numVarBlocks (  )  const

Returns the number of variational function blocks.

Definition at line 1276 of file SundanceEquationSet.cpp.

References fsr_.

int EquationSet::numVarIDs ( int  block  )  const

Returns the number of variational function IDs in this block.

See the comment in FSR.hpp for an explanation of the difference between this and numVars().

Definition at line 1300 of file SundanceEquationSet.cpp.

References fsr_.

int EquationSet::numVars ( int  block  )  const

Returns the number of variational functions in this block.

Definition at line 1292 of file SundanceEquationSet.cpp.

References fsr_.

int EquationSet::reducedFixedParamID ( int  unkID  )  const

get the reduced ID for the fixed parameter having the given funcID

Definition at line 1231 of file SundanceEquationSet.cpp.

References fsr_.

Referenced by Sundance::GrouperBase::extractWeakForm().

int EquationSet::reducedUnkID ( int  unkID  )  const

get the reduced ID for the unknown function having the given funcID

Definition at line 1220 of file SundanceEquationSet.cpp.

References fsr_.

Referenced by Sundance::GrouperBase::extractWeakForm(), and Sundance::TrivialGrouper::findGroups().

int EquationSet::reducedUnkParamID ( int  unkID  )  const

get the reduced ID for the unk parameter having the given funcID

Definition at line 1226 of file SundanceEquationSet.cpp.

References fsr_.

const Array< Set< int > > & EquationSet::reducedUnksOnRegion ( const OrderedHandle< CellFilterStub > &  r  )  const

Returns the reduced unknown functions that appear explicitly on the d-th region.

Definition at line 1370 of file SundanceEquationSet.cpp.

References fsr_.

int EquationSet::reducedVarID ( int  varID  )  const

get the reduced ID for the variational function having the specified unreduced funcID

Definition at line 1215 of file SundanceEquationSet.cpp.

References fsr_.

Referenced by Sundance::GrouperBase::extractWeakForm(), and Sundance::TrivialGrouper::findGroups().

const Array< Set< int > > & EquationSet::reducedVarsOnRegion ( const OrderedHandle< CellFilterStub > &  r  )  const

Returns the reduced variational functions that appear explicitly on the d-th region.

Definition at line 1365 of file SundanceEquationSet.cpp.

References fsr_.

const RCP< CellFilterStub > & EquationSet::region ( int  d  )  const

Returns the d-th region for this equation set.

Definition at line 1270 of file SundanceEquationSet.cpp.

References fsr_.

const Array<RegionQuadCombo>& Sundance::EquationSet::regionQuadCombos (  )  const [inline]

Returns the list of distinct subregion-quadrature combinations appearing in the equation set.

Definition at line 369 of file SundanceEquationSet.hpp.

References regionQuadCombos_.

Referenced by hasActiveWatchFlag(), and maxWatchFlagSetting().

const Set< OrderedHandle< CellFilterStub > > & EquationSet::regionsForTestFunc ( int  unreducedTestID  )  const

Return the set of regions on which the specified test func appears.

Definition at line 1253 of file SundanceEquationSet.cpp.

References fsr_.

const Set< OrderedHandle< CellFilterStub > > & EquationSet::regionsForUnkFunc ( int  unreducedUnkID  )  const

Return the set of regions on which the specified unknown func appears.

Definition at line 1258 of file SundanceEquationSet.cpp.

References fsr_.

EvalContext EquationSet::rqcToContext ( ComputationType  compType,
const RegionQuadCombo r 
) const

Map RQC to the context for the derivs of the given compType.

Definition at line 1139 of file SundanceEquationSet.cpp.

References Sundance::Map< Key, Value, Compare >::containsKey(), Sundance::Map< Key, Value, Compare >::get(), and rqcToContext_.

bool EquationSet::skipBCRqc ( ComputationType  compType,
const RegionQuadCombo r 
) const

Map BC RQC to the context for the derivs of the given compType.

Definition at line 1182 of file SundanceEquationSet.cpp.

References bcRqcToSkip_, Sundance::Map< Key, Value, Compare >::containsKey(), and Sundance::Map< Key, Value, Compare >::get().

bool EquationSet::skipRqc ( ComputationType  compType,
const RegionQuadCombo r 
) const

Map RQC to the context for the derivs of the given compType.

Definition at line 1171 of file SundanceEquationSet.cpp.

References Sundance::Map< Key, Value, Compare >::containsKey(), Sundance::Map< Key, Value, Compare >::get(), and rqcToSkip_.

Expr EquationSet::toList ( const Array< Expr > &  e  )  [static, private]

Helper that converts an array of expr to a list expression.

Definition at line 1237 of file SundanceEquationSet.cpp.

Referenced by init().

RCP< const CommonFuncDataStub > EquationSet::unkFuncData ( int  b,
int  i 
) const

Returns the i-th unknown function in block b.

Definition at line 1313 of file SundanceEquationSet.cpp.

References fsr_.

const Expr & EquationSet::unkParam ( int  i  )  const

Returns the i-th unknown parameter.

Definition at line 1317 of file SundanceEquationSet.cpp.

References fsr_.

const Set< int > & EquationSet::unksOnRegion ( int  d  )  const

Returns the unknown functions that appear explicitly on the d-th region.

Definition at line 1348 of file SundanceEquationSet.cpp.

References fsr_.

int EquationSet::unreducedFixedParamID ( int  reducedFixedParamID  )  const

get the unreduced funcID for a fixed parameter as specified by a reduced ID and block index

get the unreduced funcID for a fixed parameter as specified by a reduced ID

Definition at line 1393 of file SundanceEquationSet.cpp.

References fsr_.

int EquationSet::unreducedUnkID ( int  block,
int  reducedUnkID 
) const

get the unreduced funcID for an unknown function as specified by a reduced ID and block index

Definition at line 1381 of file SundanceEquationSet.cpp.

References fsr_.

int EquationSet::unreducedUnkParamID ( int  reducedUnkParamID  )  const

get the unreduced funcID for an unknown parameter as specified by a reduced ID and block index

get the unreduced funcID for an unknown parameter as specified by a reduced ID

Definition at line 1387 of file SundanceEquationSet.cpp.

References fsr_.

int EquationSet::unreducedVarID ( int  block,
int  reducedVarID 
) const

get the unreduced funcID for a variational function as specified by a reduced ID and block index

Definition at line 1376 of file SundanceEquationSet.cpp.

References fsr_.

RCP< const CommonFuncDataStub > EquationSet::varFuncData ( int  b,
int  i 
) const

Returns the i-th variational function in block b.

Definition at line 1308 of file SundanceEquationSet.cpp.

References fsr_.

const Set< int > & EquationSet::varsOnRegion ( int  d  )  const

Returns the variational functions that appear explicitly on the d-th region.

Definition at line 1343 of file SundanceEquationSet.cpp.

References fsr_.

const RCP<Set<OrderedPair<int, int> > >& Sundance::EquationSet::varUnkPairs ( const OrderedHandle< CellFilterStub > &  domain  )  const [inline]

Returns the (var, unk) pairs appearing on the given domain.

This is required for determining the sparsity structure of the matrix

Definition at line 389 of file SundanceEquationSet.hpp.

References Sundance::Map< Key, Value, Compare >::get(), and varUnkPairsOnRegions_.


Friends And Related Function Documentation

enum ComputationType [related]

Specifier of what sort of calculation is to be done with an equation set

Enumerator:
MatrixAndVector 
VectorOnly 
FunctionalOnly 
FunctionalAndGradient 
Sensitivities 

Definition at line 44 of file SundanceComputationType.hpp.

Expr Integral ( const Handle< CellFilterStub > &  domain,
const Expr integrand,
const Handle< QuadratureFamilyStub > &  quad,
const ParametrizedCurve &  curve,
const WatchFlag watch = WatchFlag() 
) [related]

Expr Integral ( const Handle< CellFilterStub > &  domain,
const Expr integrand,
const Handle< QuadratureFamilyStub > &  quad,
const WatchFlag watch = WatchFlag() 
) [related]

Expr Integral ( const Handle< CellFilterStub > &  domain,
const Expr integrand,
const WatchFlag watch = WatchFlag() 
) [related]


Member Data Documentation

Definition at line 677 of file SundanceEquationSet.hpp.

Referenced by bcExpr(), and init().

List of the sets of nonzero functional derivatives at each regionQuadCombo.

Definition at line 685 of file SundanceEquationSet.hpp.

Referenced by EquationSet(), init(), and nonzeroBCFunctionalDerivs().

Definition at line 671 of file SundanceEquationSet.hpp.

Referenced by bcRegionQuadCombos(), and init().

List of the contexts for each BC regionQuadCombo.

Definition at line 693 of file SundanceEquationSet.hpp.

Referenced by bcRqcToContext(), EquationSet(), and init().

List the BC RQCs that should be skipped for each computation type.

Definition at line 701 of file SundanceEquationSet.hpp.

Referenced by init(), and skipBCRqc().

Map<OrderedHandle<CellFilterStub>, RCP<Set<OrderedPair<int, int> > > > Sundance::EquationSet::bcVarUnkPairsOnRegions_ [private]

Map from cell filter to pairs of (varID, unkID) appearing on those cells.

This is needed to construct the sparsity pattern of the matrix.

Definition at line 665 of file SundanceEquationSet.hpp.

Referenced by bcVarUnkPairs(), and hasBCVarUnkPairs().

Set of the computation types supported here.

Definition at line 715 of file SundanceEquationSet.hpp.

Referenced by computationTypes(), EquationSet(), hasComputationType(), and init().

fixed parameter evaluation points for this equation set

Definition at line 712 of file SundanceEquationSet.hpp.

Flag indicating whether this equation set is a functional calculator.

Definition at line 727 of file SundanceEquationSet.hpp.

Referenced by isFunctionalCalculator().

Flag indicating whether this equation set is nonlinear.

Definition at line 719 of file SundanceEquationSet.hpp.

Flag indicating whether this equation set is a sensitivity problem.

Definition at line 731 of file SundanceEquationSet.hpp.

Referenced by isSensitivityCalculator().

Flag indicating whether this equation set is a variational problem.

Definition at line 723 of file SundanceEquationSet.hpp.

Referenced by EquationSet(), and init().

Definition at line 674 of file SundanceEquationSet.hpp.

Referenced by expr(), and init().

List of the sets of nonzero functional derivatives at each regionQuadCombo.

Definition at line 681 of file SundanceEquationSet.hpp.

Referenced by EquationSet(), init(), and nonzeroFunctionalDerivs().

Definition at line 668 of file SundanceEquationSet.hpp.

Referenced by init(), and regionQuadCombos().

List of the contexts for each regionQuadCombo.

Definition at line 689 of file SundanceEquationSet.hpp.

Referenced by EquationSet(), init(), and rqcToContext().

List the RQCs that should be skipped for each computation type.

This is needed in cases such as when a domain has matrix terms but no vector terms.

Definition at line 698 of file SundanceEquationSet.hpp.

Referenced by init(), and skipRqc().

The point in function space about which the equations are linearized.

Definition at line 706 of file SundanceEquationSet.hpp.

Referenced by EquationSet().

unknown parameter evaluation points for this equation set

Definition at line 709 of file SundanceEquationSet.hpp.

Referenced by EquationSet().

Map<OrderedHandle<CellFilterStub>, RCP<Set<OrderedPair<int, int> > > > Sundance::EquationSet::varUnkPairsOnRegions_ [private]

Map from cell filter to pairs of (varID, unkID) appearing on those cells.

This is needed to construct the sparsity pattern of the matrix.

Definition at line 660 of file SundanceEquationSet.hpp.

Referenced by hasVarUnkPairs(), and varUnkPairs().

Site Contact