InsideListExpressionLeaf Class Reference

#include <InsideListExpression.hpp>

Inheritance diagram for InsideListExpressionLeaf:

Inheritance graph
[legend]
Collaboration diagram for InsideListExpressionLeaf:

Collaboration graph
[legend]

List of all members.

Public Types

enum  NodeType { NodeAnd, NodeOr, NodeNot, NodeLeaf }
enum  Type {
  boolean, boundary, boundaryCondition, boundaryConditionList,
  domain, field, fieldlist, function,
  ifstreamexpression, integrated, integratedOperator, insideExpression,
  insideListExpression, istreamexpression, istreamExpressionList, linearExp,
  mesh, multiLinearExp, multiLinearExpSum, multiLinearForm,
  multiLinearFormSum, ofstreamexpression, option, ostreamexpression,
  ostreamExpressionList, pdeEquation, pdeOperator, pdeOperatorSum,
  pdeProblem, problem, real, scene,
  solver, solverOptions, string, subOption,
  subOptionList, testFunctionList, unknown, unknownList,
  variationalFormula, variationalBilinearOperator, variationalLinearOperator, variationalDirichlet,
  vector3
}

Public Member Functions

ReferenceCounting< Objectobjects (const Scene &S)
void subExecute ()
void addReferences (InsideListExpression::ReferenceList &references)
 InsideListExpressionLeaf (ReferenceCounting< InsideExpression > leaf)
 InsideListExpressionLeaf (const InsideListExpressionLeaf &I)
 ~InsideListExpressionLeaf ()
void execute ()
void checkReferencesUniqueness ()
const Expression::Typetype () const
 return the type.

Protected Types

typedef std::map< TinyVector
< 3, real_t >, size_t > 
ReferenceList

Protected Member Functions

virtual std::istream & _get (std::istream &is)
 Read *this to the input is.

Static Protected Member Functions

static Expression::Type getType (ReferenceCounting< Expression > e1, ReferenceCounting< Expression > e2)

Private Member Functions

std::ostream & put (std::ostream &os) const

Private Attributes

ReferenceCounting
< InsideExpression
__leaf

Friends

std::ostream & operator<< (std::ostream &os, const Expression &e)
 this function allows to output expressions.
std::istream & operator>> (std::istream &is, Expression &e)
 this function allows to read expressions from streams


Detailed Description

Definition at line 412 of file InsideListExpression.hpp.


Member Typedef Documentation

typedef std::map<TinyVector<3, real_t>, size_t> InsideListExpression::ReferenceList [protected, inherited]

Definition at line 46 of file InsideListExpression.hpp.


Member Enumeration Documentation

Enumerator:
NodeAnd 
NodeOr 
NodeNot 
NodeLeaf 

Definition at line 49 of file InsideListExpression.hpp.

00049                 {
00050     NodeAnd,
00051     NodeOr,
00052     NodeNot,
00053     NodeLeaf
00054   };

enum Expression::Type [inherited]

Enumerator:
boolean 
boundary 
boundaryCondition 
boundaryConditionList 
domain 
field 
fieldlist 
function 
ifstreamexpression 
integrated 
integratedOperator 
insideExpression 
insideListExpression 
istreamexpression 
istreamExpressionList 
linearExp 
mesh 
multiLinearExp 
multiLinearExpSum 
multiLinearForm 
multiLinearFormSum 
ofstreamexpression 
option 
ostreamexpression 
ostreamExpressionList 
pdeEquation 
pdeOperator 
pdeOperatorSum 
pdeProblem 
problem 
real 
scene 
solver 
solverOptions 
string 
subOption 
subOptionList 
testFunctionList 
unknown 
unknownList 
variationalFormula 
variationalBilinearOperator 
variationalLinearOperator 
variationalDirichlet 
vector3 

Reimplemented in IFStreamExpression, OFStreamExpression, and UnknownExpression.

Definition at line 42 of file Expression.hpp.

00042              {
00043     boolean,
00044     boundary,
00045     boundaryCondition,
00046     boundaryConditionList,
00047 
00048     domain,
00049 
00050     field,
00051     fieldlist,
00052     function,
00053 
00054     ifstreamexpression,
00055     integrated,
00056     integratedOperator,
00057     insideExpression,
00058     insideListExpression,
00059     istreamexpression,
00060     istreamExpressionList,
00061 
00062     linearExp,
00063 
00064     mesh,
00065     multiLinearExp,
00066     multiLinearExpSum,
00067     multiLinearForm,
00068     multiLinearFormSum,
00069 
00070     ofstreamexpression,
00071     option,
00072     ostreamexpression,
00073     ostreamExpressionList,
00074 
00075     pdeEquation,
00076     pdeOperator,
00077     pdeOperatorSum,
00078     pdeProblem,
00079     problem,
00080 
00081     real,
00082 
00083     scene,
00084     solver,
00085     solverOptions,
00086     string,
00087     subOption,
00088     subOptionList,
00089 
00090     testFunctionList,
00091 
00092     unknown,
00093     unknownList,
00094 
00095     variationalFormula,
00096     variationalBilinearOperator,
00097     variationalLinearOperator,
00098     variationalDirichlet,
00099     vector3
00100   };


Constructor & Destructor Documentation

InsideListExpressionLeaf::InsideListExpressionLeaf ( ReferenceCounting< InsideExpression leaf  )  [inline]

Constructor

Parameters:
leaf 

Definition at line 461 of file InsideListExpression.hpp.

00462     : InsideListExpression(InsideListExpression::NodeLeaf),
00463       __leaf(leaf)
00464   {
00465     ;
00466   }

InsideListExpressionLeaf::InsideListExpressionLeaf ( const InsideListExpressionLeaf I  )  [inline]

Copy constructor

Parameters:
I 

Definition at line 474 of file InsideListExpression.hpp.

00475     : InsideListExpression(I),
00476       __leaf(I.__leaf)
00477   {
00478     ;
00479   }

InsideListExpressionLeaf::~InsideListExpressionLeaf (  )  [inline]

Destructor

Definition at line 485 of file InsideListExpression.hpp.

00486   {
00487     ;
00488   }


Member Function Documentation

std::ostream& InsideListExpressionLeaf::put ( std::ostream &  os  )  const [inline, private, virtual]

Overloading of Expression::put()

Parameters:
os 

Implements Expression.

Definition at line 425 of file InsideListExpression.hpp.

References __leaf.

00426   {
00427     os << *__leaf;
00428     return os;
00429   }

ReferenceCounting< Object > InsideListExpressionLeaf::objects ( const Scene S  )  [virtual]

Evaluates the domain shape

Returns:
a shape.

Implements InsideListExpression.

Definition at line 54 of file InsideListExpression.cpp.

References ffout(), Scene::nbObjects(), ErrorHandler::normal, Scene::object(), Union::push_back(), Object::setReference(), and stringify().

00055 {
00056   Union* merge = new Union();
00057 
00058   TinyVector<3> reference = (*__leaf).reference();
00059 
00060   size_t numberOfLeafObjects = 0;
00061   for (size_t i = 0; i<S.nbObjects(); ++i) {
00062     if(S.object(i)->hasReference()) {
00063       if (S.object(i)->reference() == reference) {
00064         merge->push_back(S.object(i));
00065         numberOfLeafObjects++;
00066       }
00067     } else {
00068       ffout(0) << "Object " << i << ':' << S.object(i) << "\nhas no reference\n\n";
00069     }
00070   }
00071 
00072   if (numberOfLeafObjects==0) {
00073     throw ErrorHandler(__FILE__,__LINE__,
00074                        "no object has reference "+stringify(reference)+" in scene",
00075                        ErrorHandler::normal);
00076   }
00077 
00078   ConstReferenceCounting<Shape> leaves;
00079   if(numberOfLeafObjects == 1) { // leaf is just one object
00080     leaves = (*(*merge).begin())->shape();
00081   } else { // leaves are an union
00082     leaves = merge;
00083   }
00084 
00085   Object* o;
00086   if ((*__leaf).inside()) {
00087     o = new Object(leaves);
00088   } else {
00089     o = new Object(new Not(new Object(leaves)));
00090   }
00091 
00092   o->setReference(reference);
00093   return o;
00094 }

Here is the call graph for this function:

void InsideListExpressionLeaf::subExecute (  )  [inline, virtual]

Overloading of InsideListeExpression::subExecute()

Implements InsideListExpression.

Definition at line 438 of file InsideListExpression.hpp.

00439   {
00440     (*__leaf).execute();
00441   }

void InsideListExpressionLeaf::addReferences ( InsideListExpression::ReferenceList references  )  [inline, virtual]

Fills a list which counts POV-Ray references

Parameters:
references the references and their number of instance

Implements InsideListExpression.

Definition at line 450 of file InsideListExpression.hpp.

00451   {
00452     references[(*__leaf).reference()]++;
00453   }

void InsideListExpression::execute (  )  [inline, virtual, inherited]

overloading of Expression::execute()

Implements Expression.

Definition at line 65 of file InsideListExpression.hpp.

References InsideListExpression::checkReferencesUniqueness(), and InsideListExpression::subExecute().

00066   {
00067     this->subExecute();
00068     this->checkReferencesUniqueness();
00069   }

Here is the call graph for this function:

void InsideListExpression::checkReferencesUniqueness (  )  [inline, inherited]

Checks that all given references are given only once

Definition at line 81 of file InsideListExpression.hpp.

References InsideListExpression::addReferences(), ErrorHandler::normal, and stringify().

Referenced by InsideListExpression::execute().

00082   {
00083     InsideListExpression::ReferenceList references;
00084     this->addReferences(references);
00085     for (ReferenceList::const_iterator i = references.begin();
00086          i != references.end(); ++i) {
00087       if ((*i).second > 1) {
00088         std::string errorMsg
00089           = "POV-Ray reference "+stringify((*i).first)+" is used "
00090                  +stringify((*i).second)+" times in the domain definition\n"
00091             "only once is allowed";
00092         throw ErrorHandler(__FILE__,__LINE__,
00093                            errorMsg,
00094                            ErrorHandler::normal);
00095       }
00096     }
00097   }

Here is the call graph for this function:

static Expression::Type Expression::getType ( ReferenceCounting< Expression e1,
ReferenceCounting< Expression e2 
) [inline, static, protected, inherited]

Traits conversion of types.

Todo:
IMPLEMENT IT.

Definition at line 112 of file Expression.hpp.

References Expression::real.

00114   {
00115     return Expression::real;
00116   }

virtual std::istream& Expression::_get ( std::istream &  is  )  [inline, protected, virtual, inherited]

Read *this to the input is.

Reimplemented in IStreamExpressionList, and RealExpressionVariable.

Definition at line 122 of file Expression.hpp.

References ErrorHandler::normal.

00123   {
00124     throw ErrorHandler(__FILE__,__LINE__,
00125                        "operator >> is not supported for this expression",
00126                        ErrorHandler::normal);
00127     return is;
00128   }

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

return the type.

Reimplemented in FunctionExpression.

Definition at line 132 of file Expression.hpp.

References Expression::__type.

Referenced by MeshExpressionExtract::execute().

00133   {
00134     return __type;
00135   }


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const Expression e 
) [friend, inherited]

this function allows to output expressions.

Definition at line 143 of file Expression.hpp.

00144   {
00145     return e.put(os);
00146   }

std::istream& operator>> ( std::istream &  is,
Expression e 
) [friend, inherited]

this function allows to read expressions from streams

Definition at line 149 of file Expression.hpp.

00150   {
00151     return e._get(is);
00152   }


Member Data Documentation

Definition at line 417 of file InsideListExpression.hpp.

Referenced by put().


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

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