VISH  0.2
Classes | Public Member Functions | Static Public Member Functions | Public Attributes
Wizt::VOperatorCache Struct Reference

The Operator Cache is used to memorize the result of some update() operation, and to provide it to other routines knowing the same value pool context. More...

#include </home/werner/origo/vish/ocean/plankton/VOperatorCache.hpp>

List of all members.

Classes

Public Member Functions

Static Public Member Functions

Public Attributes


Detailed Description

The Operator Cache is used to memorize the result of some update() operation, and to provide it to other routines knowing the same value pool context.

Provided we want to memorize a vector of doubles, then we simply instantiatee the OperatorCache template over this data type:

   typedef OperatorCache<std::vector<double> > OC_t; 

Now in the update() function we may get an operator cache given some Intercube object - for instance some field from the FiberLib2 library - (which relates to some driving input data) and a self() pointer:

   bool VObject::update(VRequest&R, double precision)
   {
   RefPtr<Field> Vectors;
   RefPtr<OC_t>&OC = OC_t::retrieve( *Vectors ) [ self() ]; 
        if (!OC) OC = new OC_t(); 
        }

The OperatorCache contains a set of variable values, i.e. a ValueSet. The purpose is to associate the OperatorCache with such a set of values. If any of these values has changed since the last update() call, then the OperatorCache needs to be filled with data from a new computation. A ValueSet that contains the parameters of such a compuation is easily created by providing an evaluation context (via the &-operator) and then add VSlot's (via the += and comma operator). The unchanged() member function checks if any differences among the values stored with the OperatorCache and the current values had occured:

   RefPtr<ValueSet> Changeables = new ValueSet(); 

        Changeables & R += nLines, X, Y, Z, Length, DistributionWidth; 

        if (OC->unchanged( Changeables ) )
        {
                return true;
        } 

If there had been changes, they are implicitely assigned by the unchanged() member function and the following code is supposed to compute new data.

Redesign to take care of local variable values implicitely.

Examples:

ComputeMultiStreamLines.cpp.


Member Function Documentation

static Cache& Wizt::VOperatorCache::retrieve ( Intercube IC) [inline, static]

Create a Cache object that is associated with an arbitrary Intercube.

If the Intercube goes away, to will this Cache object. If the given Intercube doesn't have a Cache object yet, one will be created.

A typical application example is a time-dependend field, where each time slice of the field is an Intercube, such that an operator cache can be associated with it.

bool Wizt::VOperatorCache::unchanged ( const RefPtr< ValueSet > &  VS) [inline]

Compare and assign a set of variable values.

Note:
A repeated call of this function will always return true.

The documentation for this struct was generated from the following file: