# cee::ug::DataPartDisplacement

class `DataPartDisplacement` : public RefCountedObject

  Displacement results for a part.

  A displacement result value is a three dimensional vector giving a magnitude and a direction for the displacement of a node. DataPartDisplacement contains an array of vectors specifying the displacements for all nodes in a part.

  A DataPartDisplacement contains the result values corresponding to a DataPart. This means that the number of result values in each displacement part must match the number of nodes in the corresponding part. DataPartDisplacement is a child of a DataResultDisplacement in the same way as a DataPart is a child of a DataGeometry. The DataResultDisplacement must have the same number of child parts as the DataGeometry.

  Note! The class is reference counted and can be shared between multiple results. Remember that since this object is reference counted it should never be created on the stack.

  Values are inserted using setValue(), setValues() or setValuesFloat(). Get the number of values with count() and query a specific value using value() with an index.

  Note! The values are the absolute node positions, not just the relative offset to the undisplaced node position.

  Example

  Example of how to add a displacement result to a geometry consisting of only one triangle.

  Create the DataResultDisplacement object with a unique id.

      int dispResultId = 1;
      cee::PtrRef<cee::ug::DataResultDisplacement> dispResult = new cee::ug::DataResultDisplacement(dispResultId);

  The result array must have one value for each node coordinate in the triangle. Remember that the array must be resized before inserting the results.

      cee::PtrRef<cee::ug::DataPartDisplacement> dispPart = new cee::ug::DataPartDisplacement();
      dispPart->resize(3);
      dispPart->setValue(0, cee::Vec3d(1.0, 0.0, 0.0));
      dispPart->setValue(1, cee::Vec3d(0.0, 0.0, 0.0));
      dispPart->setValue(2, cee::Vec3d(0.0, 1.0, 0.0));

  Number of parts in the DataResultDisplacement must match number of parts in the geometry. Displacement values must also fit the corresponding part in the geometry. Here the part is a single triangle with three nodes, hence a results array with three vectors will fit.

  Add the displacement part to the result displacement.

      dispResult->addPart(dispPart.get());

  For each geometry in a state there is a result group binding the geometry and results.

  Add the result displacement to the state (DataState) for the corresponding geometry (DataGeometry) geo

      state->results(geo.get())->addDisplacement(dispResult.get());

  See the complete source code at: UnstructGrid: A Simple Model with Results

  Tutorials

  See also

  DataPart and DataResultDisplacement

  UnstructGrid: A Simple Model with Results

  Public Functions

  `DataPartDisplacement`()

    Constructs an empty object.

  size_t `count`() const

    Returns number of displaced nodes in this DataPartDisplacement.

  Vec3d `value`(size_t index) const

    Returns the absolute node position for the node at the given index.

    Note! The value is the absolute node position, not a relative value to the undisplaced node position

  const double *`rawValuePointer`() const

    Returns a raw pointer to the absolute node positions.

  double *`rawValuePointer`()

    Returns a modifiable raw pointer to the absolute node positions.

  void `resize`(size_t count)

    Sets the number of values in the object.

    The current values in the object will be kept up to the given count (if shrinking).

  void `setValue`(size_t index, const Vec3d &value)

    Sets the absolute node position for the displaced node.

    Note! The value is the absolute node position, not a relative value to the undisplaced node position

    Warning

    The specified index must be a valid index. Either call one of the setValues() methods or call resize() prior to calling this method.

  void `setValues`(const std::vector<Vec3d> &values)

    Sets the absolute node positions for the displaced nodes.

    Note! The values are the absolute node positions, not relative values to the undisplaced node positions

  void `setValues`(const double values[], size_t vectorCount)

    Sets the absolute node positions for the displaced nodes.

    Note! The values are the absolute node positions, not relative values to the undisplaced node positions

    See also

    resize()

  void `setValuesFloat`(const float values[], size_t vectorCount)

    Sets the absolute node positions for the displaced nodes.

    Note! The values are the absolute node positions, not relative values to the undisplaced node positions

    Note! That this is only provided for convenience, and that the nodes will internally be stored as doubles

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