# cee::imp::cae::StateLinearCombination

class `StateLinearCombination` : public RefCountedObject

  This class handles the building and storing of a linear combination of states.

  Once built and written to a VTFx file, it provides states that are a weighted linear combination of a the DataSource of a given UnstructGridModel.

  First, use the constructor to define source UnstructGridModel and the source state ids used in the linear combination, as well as the reference values of the combined states to create.

  The linear combination is then defined by setting the weights of each of the source states in each combined state. This is done in setSourceStateWeights().

  As soon as all the data is provided, a call to build() will generate the new states in a build folder. The location of this build folder can be specified using setBuildFolderLocation()

  All source states that are combined must have the same geometries

  Public Functions

  `StateLinearCombination`(cee::ug::UnstructGridModel *sourceModel, const std::vector<int> &sourceStateIds, const std::vector<double> &combinedStateReferenceValues)

    Constructor.

    Specifies the source UnstructGridModel, the ids of the states in this model that will be used in the linear combination and finally, the reference values of the combined states that will be generated.

  void `setSourceStateWeights`(int sourceStateId, const std::vector<double> &weights)

    Sets the weights of the given state in each of the combined states to be generated.

  bool `build`()

    Builds the combined states. Data is stored for performance in the output folder.

  void `setBuildFolderLocation`(const cee::Str &location)

    Sets the location where the temporary build folder will be created.

  bool `deleteBuildFolder`()

    Deletes the temporary build folder, releasing memory.

    Only do this if the data is safely store in a VTFx file with a call to write()

  void `setUseParallelComputation`(bool use)

    Activates/deactivates the use of parallel computation of combined states.

    Activating usage when parallel is not supported will cause an assert.

  bool `write`(const cee::Str &vtfxFile)

    Builds the data source by linearly combining states of the source UnstructGridModel.

    Data is stored in the given folder

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your multilingual generative AI assistant for documentation. Ask me anything about HOOPS Envision for Desktop in your own language, or choose a sample question below to start a conversation:

What is HOOPS Envision for Desktop?
What are the latest release notes for HOOPS Envision for Desktop?
How do I start evaluating HOOPS Envision for Desktop?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...