cee::ug::ResultInfo

class ResultInfo

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 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

Public Functions

ResultInfo()

Constructs an empty object.

Default id is -1 (invalid).

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.

ResultInfo(ResultType type, int resultId, const Str &resultName, ResultMapping resMapping, ResultType baseResultType, int baseResultId, DeriveOperation deriveOperation)

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

ResultInfo(ResultType type, int resultId, const Str &resultName, ResultMapping resMapping, std::vector<CustomResultArgument> &customResultArguments, 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

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.

ResultInfo(const ResultInfo &other)

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

ResultInfo &operator=(const ResultInfo &rhs)

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

bool operator==(const ResultInfo &rhs) const

Returns true if this object is equal to rhs.

bool operator!=(const ResultInfo &rhs) const

Returns true if this object is not equal to rhs.

ResultType type() const

Returns the result type.

int id() const

Returns the result id.

Returns -1 if this result info object is invalid.

Str name() const

Returns the result name.

void setName(const Str &name)

Sets the result name.

Str unit() const

Returns the unit of the result.

void setUnit(const Str &unit)

Sets the unit of the result.

The unit will be shown on the color legend and be available in the result info.

Str 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 EnvisionDesktop. This is opposed to the id of the result, which might change between version due to internal refactoring.

void 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 EnvisionDesktop. This is opposed to the id of the result, which might change between version due to internal refactoring.

ResultMapping resultMapping() const

Returns the result mapping.

ResultType baseResultType() const

Returns the type of the result this one derives from.

int baseResultId() const

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

DeriveOperation deriveOperation() const

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

StrainType strainType() const

Gets the result strain type.

void setStrainType(StrainType type)

Sets the result strain type.

bool isValid() const

Returns true if this object is a valid result info.

bool isCustom() const

Returns true if this result is a custom result.

Str resultCalculatorId() const

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

Str nature() const

Returns the result nature.

void setNature(const Str &nature)

Sets the result nature.

const std::vector<int> &sectionIds() const

Returns the result’s section id.

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

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

Sets the result’s section id.

Str attribute(const Str &name) const

Returns the value of the given attribute.

std::vector<Str> attributeNames() const

Returns the names of all the attributes of this result.

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

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

std::vector<CustomResultArgument> customResultArguments() const

Returns the custom result arguments.

const CustomResultGenerator *customResultGenerator() const

Returns the CustomResultGenerator.

void setId(int id)

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

Public Static Functions

static Str deriveOperationName(DeriveOperation deriveOperation)

Returns the string associated to the given derive operation.

static int nextId(ResultType resultType)

Returns the next id for the given result type.