cee::ug::ResultInfo Class Reference

Simple class containing metadata info for a result. More...

Public Member Functions

 ResultInfo ()
 Constructs an empty object. More...
 
 ResultInfo (ResultType type, int resultId, const Str &resultName, ResultMapping resMapping)
 Constructs a new object with the given result type and id, result name and result mapping. More...
 
 ResultInfo (ResultType type, int resultId, const Str &resultName, ResultMapping resMapping, ResultType baseResultType, int baseResultId, DeriveOperation deriveOperation)
 Constructs a new ResultInfo. More...
 
 ResultInfo (ResultType type, int resultId, const Str &resultName, ResultMapping resMapping, std::vector< CustomResultArgument > &customResultArguments, const CustomResultGenerator *customResultGenerator)
 Constructs a new custom result info. More...
 
 ResultInfo (ResultType type, const Str &resultName, ResultMapping resMapping, std::vector< CustomResultArgument > &customResultArguments, const CustomResultGenerator *customResultGenerator)
 Constructs a new custom result info. Same as previous constructor, except the result id is automatically assigned. More...
 
 ResultInfo (const ResultInfo &other)
 Constructs a new result info that is a copy of other. More...
 
ResultInfooperator= (const ResultInfo &rhs)
 Assigns rhs to this result info and returns a reference to this result info. More...
 
bool operator== (const ResultInfo &rhs) const
 Returns true if this object is equal to rhs. More...
 
bool operator!= (const ResultInfo &rhs) const
 Returns true if this object is not equal to rhs. More...
 
ResultType type () const
 Returns the result type. More...
 
int id () const
 Returns the result id. More...
 
Str name () const
 Returns the result name. More...
 
void setName (const Str &name)
 Sets the result name. More...
 
Str idString () const
 Returns the result id string. More...
 
void setIdString (const Str &idString)
 Sets the result id string. More...
 
ResultMapping resultMapping () const
 Returns the result mapping. More...
 
ResultType baseResultType () const
 Returns the type of the result this one derives from. More...
 
int baseResultId () const
 Returns the id of the result this one derives from, or -1 if this result is not derived. More...
 
DeriveOperation deriveOperation () const
 Returns the operation used to derive this result from its base result. More...
 
StrainType strainType () const
 Gets the result strain type. More...
 
void setStrainType (StrainType type)
 Sets the result strain type. More...
 
bool isValid () const
 Returns true if this object is a valid result info. More...
 
bool isCustom () const
 Returns true if this result is a custom result. More...
 
Str resultCalculatorId () const
 Returns the calculator idString of the result calculator producing this result Empty if not produced by a result calculator. More...
 
Str nature () const
 Returns the result nature. More...
 
void setNature (const Str &nature)
 Sets the result nature. More...
 
const std::vector< int > & sectionIds () const
 Returns the result's section id. More...
 
void setSectionIds (const std::vector< int > &ids)
 Sets the result's section id. More...
 
Str attribute (const Str &name) const
 Return the value of the given attribute. More...
 
std::vector< StrattributeNames () const
 Returns the names of all the attributes of this result. More...
 
void setCustomResultGenerator (const CustomResultGenerator *generator, const std::vector< CustomResultArgument > &arguments)
 Sets the function and result arguments required to compute the custom result. More...
 
std::vector< CustomResultArgument > customResultArguments () const
 Returns the custom result arguments. More...
 
const CustomResultGeneratorcustomResultGenerator () const
 Returns the CustomResultGenerator. More...
 
void setId (int id)
 Sets the result info id. Private method used by DataSourceDirectory. More...
 

Static Public Member Functions

static Str deriveOperationName (DeriveOperation deriveOperation)
 Returns the string associated to the given derive operation. More...
 
static int nextId (ResultType resultType)
 Returns the next id for the given result type. More...
 

Detailed Description

Simple class containing metadata info for a result.

The ResultInfo class is used for metadata info for scalar, vector and displacement results.

A result info contains:

  • Result type (scalar, vector, ...)
  • Result id
  • Result name
  • Result mapping type
  • Result nature (force, velocity, stress, ..)

Results that a are computed from others are known as derived, and the result used to compute them is their base result. In this case, a result info provides:

  • The result type of the base result
  • The id of the base result
  • The operation used to derive the result (x-component, magnitude, von Mises, ...)

(Result mapping will not have any effect on displacement results.)

Default result id is -1 which indicates an invalid id.

Metadata for a model is accessed from the data source directory.

Example

Example on getting the result id for the first scalar result using the metadata directory.

std::vector<cee::ug::ResultInfo> scalarResultInfos = source->directory()->scalarResultInfos();
if (scalarResultInfos.size() > 0)
{
int scalarId = scalarResultInfos[0].id();
}

See the complete source code at: UnstructGrid: Load model from file and set up model specification

See also
DataSourceDirectory

Constructor & Destructor Documentation

cee::ug::ResultInfo::ResultInfo ( )

Constructs an empty object.

Default id is -1 (invalid).

cee::ug::ResultInfo::ResultInfo ( ResultType  type,
int  resultId,
const Str resultName,
ResultMapping  resMapping 
)

Constructs a new object with the given result type and id, result name and result mapping.

Use this constructor for results that do not derive from others.

cee::ug::ResultInfo::ResultInfo ( ResultType  type,
int  resultId,
const Str resultName,
ResultMapping  resMapping,
ResultType  baseResultType,
int  baseResultId,
DeriveOperation  operation 
)

Constructs a new ResultInfo.

With the given result type and id, result name, result mapping, base result type and id and the operation used to derive this result from its base

cee::ug::ResultInfo::ResultInfo ( ResultType  type,
int  resultId,
const Str resultName,
ResultMapping  resMapping,
std::vector< CustomResultArgument > &  arguments,
const CustomResultGenerator customResultGenerator 
)

Constructs a new custom result info.

Values of the result will be computed by sending the given CustomResultArgument vector to the given CustomResultFunction

cee::ug::ResultInfo::ResultInfo ( ResultType  type,
const Str resultName,
ResultMapping  resMapping,
std::vector< CustomResultArgument > &  customResultArguments,
const CustomResultGenerator customResultGenerator 
)

Constructs a new custom result info. Same as previous constructor, except the result id is automatically assigned.

cee::ug::ResultInfo::ResultInfo ( const ResultInfo other)

Constructs a new result info that is a copy of other.

Member Function Documentation

Str cee::ug::ResultInfo::attribute ( const Str name) const

Return the value of the given attribute.

std::vector< Str > cee::ug::ResultInfo::attributeNames ( ) const

Returns the names of all the attributes of this result.

int cee::ug::ResultInfo::baseResultId ( ) const

Returns the id of the result this one derives from, or -1 if this result is not derived.

ResultType cee::ug::ResultInfo::baseResultType ( ) const

Returns the type of the result this one derives from.

std::vector< CustomResultArgument > cee::ug::ResultInfo::customResultArguments ( ) const

Returns the custom result arguments.

const CustomResultGenerator * cee::ug::ResultInfo::customResultGenerator ( ) const

Returns the CustomResultGenerator.

DeriveOperation cee::ug::ResultInfo::deriveOperation ( ) const

Returns the operation used to derive this result from its base result.

Str cee::ug::ResultInfo::deriveOperationName ( DeriveOperation  deriveOperation)
static

Returns the string associated to the given derive operation.

int cee::ug::ResultInfo::id ( ) const

Returns the result id.

Returns -1 if this result info object is invalid.

Str cee::ug::ResultInfo::idString ( ) const

Returns the result id string.

The Result id string is a persistent identifier for the result, and will stay constant between versions of CDC. This is opposed to the id of the result, which might change between version due to internal refactoring.

bool cee::ug::ResultInfo::isCustom ( ) const

Returns true if this result is a custom result.

bool cee::ug::ResultInfo::isValid ( ) const

Returns true if this object is a valid result info.

Str cee::ug::ResultInfo::name ( ) const

Returns the result name.

Str cee::ug::ResultInfo::nature ( ) const

Returns the result nature.

int cee::ug::ResultInfo::nextId ( ResultType  resultType)
static

Returns the next id for the given result type.

bool cee::ug::ResultInfo::operator!= ( const ResultInfo rhs) const

Returns true if this object is not equal to rhs.

ResultInfo & cee::ug::ResultInfo::operator= ( const ResultInfo rhs)

Assigns rhs to this result info and returns a reference to this result info.

bool cee::ug::ResultInfo::operator== ( const ResultInfo rhs) const

Returns true if this object is equal to rhs.

Str cee::ug::ResultInfo::resultCalculatorId ( ) const

Returns the calculator idString of the result calculator producing this result Empty if not produced by a result calculator.

cee::ug::ResultMapping cee::ug::ResultInfo::resultMapping ( ) const

Returns the result mapping.

const std::vector< int > & cee::ug::ResultInfo::sectionIds ( ) const

Returns the result's section id.

Returns -1 if this result is not located on a section

void cee::ug::ResultInfo::setCustomResultGenerator ( const CustomResultGenerator generator,
const std::vector< CustomResultArgument > &  arguments 
)

Sets the function and result arguments required to compute the custom result.

void cee::ug::ResultInfo::setId ( int  id)

Sets the result info id. Private method used by DataSourceDirectory.

void cee::ug::ResultInfo::setIdString ( const Str idString)

Sets the result id string.

The result id string is a persistent identifier for the result, and will stay constant between versions of CDC. This is opposed to the id of the result, which might change between version due to internal refactoring.

void cee::ug::ResultInfo::setName ( const Str name)

Sets the result name.

void cee::ug::ResultInfo::setNature ( const Str nature)

Sets the result nature.

void cee::ug::ResultInfo::setSectionIds ( const std::vector< int > &  ids)

Sets the result's section id.

void cee::ug::ResultInfo::setStrainType ( StrainType  type)

Sets the result strain type.

StrainType cee::ug::ResultInfo::strainType ( ) const

Gets the result strain type.

ResultType cee::ug::ResultInfo::type ( ) const

Returns the result type.