InstructionAffectation< FunctionExpression, FunctionVariable > Class Template Reference

#include <Instruction.hpp>

Inheritance diagram for InstructionAffectation< FunctionExpression, FunctionVariable >:

Inheritance graph
[legend]
Collaboration diagram for InstructionAffectation< FunctionExpression, FunctionVariable >:

Collaboration graph
[legend]

List of all members.

Public Types

enum  Type {
  list, ifStatement, doWhileStatement, whileStatement,
  forStatement, exitStatement, coarseMesh, declaration,
  affectation, increment, input, decrement,
  evaluation, blockBegin, blockEnd, output,
  Using, exec, cat, plot,
  save, none
}

Public Member Functions

void execute ()
 InstructionAffectation (const std::string &variableName, ReferenceCounting< FunctionExpression > e)
 InstructionAffectation (const InstructionAffectation< FunctionExpression, FunctionVariable > &I)
 ~InstructionAffectation ()
const Instruction::Typetype () const

Protected Attributes

const Instruction::Type __type

Private Attributes

std::string __variableName
ReferenceCounting
< FunctionExpression
__expression


Detailed Description

template<>
class InstructionAffectation< FunctionExpression, FunctionVariable >

Definition at line 753 of file Instruction.hpp.


Member Enumeration Documentation

enum Instruction::Type [inherited]

Enumerator:
list 
ifStatement 
doWhileStatement 
whileStatement 
forStatement 
exitStatement 
coarseMesh 
declaration 
affectation 
increment 
input 
decrement 
evaluation 
blockBegin 
blockEnd 
output 
Using 
exec 
cat 
plot 
save 
none 

Definition at line 49 of file Instruction.hpp.

00049             {
00050     list,
00051     ifStatement,
00052     doWhileStatement,
00053     whileStatement,
00054     forStatement,
00055     exitStatement,
00056     coarseMesh,
00057 
00058     declaration,
00059     affectation,
00060     increment,
00061     input,
00062     decrement,
00063     evaluation,
00064 
00065     blockBegin,
00066     blockEnd,
00067 
00068     output,
00069     Using,
00070     exec,
00071     cat,
00072     plot,
00073     save,
00074     none
00075   };


Constructor & Destructor Documentation

Definition at line 763 of file Instruction.hpp.

00765     : Instruction(Instruction::affectation),
00766       __variableName(variableName),
00767       __expression(e)
00768   {
00769     ;
00770   }

Definition at line 772 of file Instruction.hpp.

00774     : Instruction(I),
00775       __variableName(I.__variableName),
00776       __expression(I.__expression)
00777   {
00778     ;
00779   }

Definition at line 781 of file Instruction.hpp.

00782   {
00783     ;
00784   }


Member Function Documentation

void InstructionAffectation< FunctionExpression, FunctionVariable >::execute (  )  [virtual]

Implements Instruction.

Definition at line 227 of file Instruction.cpp.

References InstructionAffectation< DataType, VarType >::__expression, InstructionAffectation< DataType, VarType >::__variableName, FEMFunctionBase::baseMesh(), FEMFunctionBuilder::build(), FEMFunctionBase::discretizationType(), FunctionVariable::expression(), ScalarFunctionBase::femfunction, VariableRepository::findVariable(), FEMFunctionBuilder::getBuiltScalarFunction(), StaticBase< Information >::instance(), StaticBase< VariableRepository >::instance(), SpectralFunction::mesh(), Information::setMesh(), ScalarFunctionBase::spectral, ScalarFunctionBase::type(), and Information::unsetMesh().

00228 {
00229   FunctionVariable* functionVariable
00230     = VariableRepository::instance().findVariable<FunctionVariable>(__variableName);
00231 
00232   ConstReferenceCounting<FunctionExpression> f = functionVariable->expression();
00233 
00234   const ScalarFunctionBase& scalarFunction = *f->function();
00235 
00236   switch(scalarFunction.type()) {
00237   case ScalarFunctionBase::femfunction: {
00238     const FEMFunctionBase& femFunction = dynamic_cast<const FEMFunctionBase&>(scalarFunction);
00239 
00240     Information::instance().setMesh(femFunction.baseMesh());
00241 
00242     __expression->execute();
00243 
00244     FEMFunctionBuilder builder;
00245     builder.build(femFunction.discretizationType(),
00246                   femFunction.baseMesh(),
00247                   *__expression->function());
00248 
00249     (*functionVariable)
00250       = new FunctionExpressionValue(builder.getBuiltScalarFunction(), false);
00251 
00252     Information::instance().unsetMesh();
00253     break;
00254   }
00255   case ScalarFunctionBase::spectral: {
00256     const SpectralFunction& spectralFunction
00257       = dynamic_cast<const SpectralFunction&>(scalarFunction);
00258     const Mesh* mesh = spectralFunction.mesh();
00259     Information::instance().setMesh(mesh);
00260 
00261     __expression->execute();
00262 
00263     (*functionVariable)
00264       = new FunctionExpressionValue(new SpectralFunction(spectralFunction.mesh(),
00265                                                          *__expression->function()),
00266                                     false);
00267     Information::instance().unsetMesh();
00268     break;
00269   }
00270   default: {
00271     __expression->execute();
00272     (*functionVariable) = __expression->value();
00273   }
00274   }
00275 }

Here is the call graph for this function:

const Instruction::Type& Instruction::type (  )  const [inline, inherited]

Definition at line 81 of file Instruction.hpp.

References Instruction::__type.

00082   {
00083     return __type;
00084   }


Member Data Documentation

Definition at line 757 of file Instruction.hpp.

Definition at line 758 of file Instruction.hpp.

const Instruction::Type Instruction::__type [protected, inherited]

Definition at line 78 of file Instruction.hpp.

Referenced by Instruction::type().


The documentation for this class was generated from the following files:

Generated on Wed Nov 19 00:07:56 2008 for FreeFEM3D (aka ff3d) by  doxygen 1.5.6