Skip to content

C++ D3plot

PucklaJ edited this page Feb 29, 2024 · 5 revisions

D3plot - C++

Back to Home

dro::D3plot

This holds all data needed to read d3plot files.

index_for_id

static size_t index_for_id(const Array<d3_word> &ids, d3_word id);

Returns the index of id in the array ids. If it cannot be found then UINT64_MAX will be returned. The ids array needs to sorted in ascending order.

  • ids The sorted array in which to look for id
  • id The id to look for

Constructor

D3plot(const std::filesystem::path &root_file_name);

Open a d3plot file family by giving the root file name Example: d3plot of d3plot01, d3plot02, d3plot03, etc.

  • root_file_name The file path to the first file of the d3plot file family (Usually d3plot)

read_node_ids

Array<d3_word> read_node_ids();

Read all ids of the nodes.

read_solid_element_ids

Array<d3_word> read_solid_element_ids();

Read all ids of the solid elements.

read_beam_element_ids

Array<d3_word> read_beam_element_ids();

Read all ids of the beam elements.

read_shell_element_ids

Array<d3_word> read_shell_element_ids();

Read all ids of the shell elements.

read_thick_shell_element_ids

Array<d3_word> read_thick_shell_element_ids();

Read all ids of the thick shell elements.

read_all_element_ids

Array<d3_word> read_all_element_ids();

Read all ids of the solid, beam, shell and thick shell elements.

read_part_ids

Array<d3_word> read_part_ids();

Read all ids of the parts.

read_part_titles

std::vector<SizedString> read_part_titles();

Returns a vector containing all part titles as sized strings.

read_node_coordinates

Array<dVec3> read_node_coordinates(size_t state = 0);

Read the node coordinates of all nodes of a given state (time step)

  • state The time step from which to read the coordinates. If left empty the initial coordinates are returned

read_all_node_coordinates

std::vector<Array<dVec3>> read_all_node_coordinates();

Reads all node coordinates of all time steps and returns them as one big array.

read_node_velocity

Array<dVec3> read_node_velocity(size_t state);

Read the node velocity of all nodes of a given state (time step).

  • state The time step from which to read the velocity

read_all_node_velocity

std::vector<Array<dVec3>> read_all_node_velocity();

Reads all node velocities of all time steps and returns them as one big array.

read_node_acceleration

Array<dVec3> read_node_acceleration(size_t state);

Read the node acceleration of all nodes of a given state (time step).

  • state The time step from which to read the acceleration

read_all_node_acceleration

std::vector<Array<dVec3>> read_all_node_acceleration();

Read all node accelerations of all time steps and returns the as one big array.

read_node_coordinates_32

Array<fVec3> read_node_coordinates_32(size_t state = 0);

Read the node coordinates of all nodes of a given state (time step)

  • state The time step from which to read the coordinates. If left empty the initial coordinates are returned

read_all_node_coordinates_32

std::vector<Array<fVec3>> read_all_node_coordinates_32();

Reads all node coordinates of all time steps and returns them as one big array.

read_node_velocity_32

Array<fVec3> read_node_velocity_32(size_t state);

Read the node velocity of all nodes of a given state (time step).

  • state The time step from which to read the velocity

read_all_node_velocity_32

std::vector<Array<fVec3>> read_all_node_velocity_32();

Reads all node velocities of all time steps and returns them as one big array.

read_node_acceleration_32

Array<fVec3> read_node_acceleration_32(size_t state);

Read the node acceleration of all nodes of a given state (time step).

  • state The time step from which to read the acceleration

read_all_node_acceleration_32

std::vector<Array<fVec3>> read_all_node_acceleration_32();

Read all node accelerations of all time steps and returns the as one big array.

read_time

double read_time(size_t state);

Read the time of a given state (time step) in milliseconds.

  • state The time step from which to read the time

read_all_time

Array<double> read_all_time();

Reads all time of every state (time step) in milliseconds.

read_time_32

float read_time_32(size_t state);

Read the time of a given state (time step) in milliseconds.

  • state The time step from which to read the time

read_all_time_32

Array<float> read_all_time_32();

Reads all time of every state (time step) in milliseconds.

read_solids_state

Array<d3plot_solid> read_solids_state(size_t state);

Returns stress, strain (if NEIPH >= 6) for a given state.

  • state The time step from which to read the solids state

read_thick_shells_state

Array<D3plotThickShell> read_thick_shells_state(size_t state);

Returns stress, strain (if ISTRN == 1) for a given state.

  • state The time step from which to read the thick shells state

read_beams_state

Array<d3plot_beam> read_beams_state(size_t state);

Returns Axial Force, S shear resultant, T shear resultant, S bending moment, T bending moment and Torsional resultant of all beams for a given state.

  • state The time step from which to read the beams state

read_shells_state

Array<D3plotShell> read_shells_state(size_t state);

Returns stress, strain (if ISTRN == 1) and some other variables (see docs pg. 36) of all shells for a given state.

  • state The time step from which to read the beams state

read_solid_elements

Array<d3plot_solid_con> read_solid_elements();

Returns the node connectivity + material number of all 8 node solid elements.

read_thick_shell_elements

Array<d3plot_thick_shell_con> read_thick_shell_elements();

Returns the node connectivity + material number of all 8 node thick shell elements.

read_beam_elements

Array<d3plot_beam_con> read_beam_elements();

Returns the node connectivity + orientation node + material number of all beam elements.

read_shell_elements

Array<d3plot_shell_con> read_shell_elements();

Returns the node connectivity + material number of all shell elements.

read_title

SizedString read_title();

Returns a string holding the Title of the d3plot file.

read_run_time

std::chrono::system_clock::time_point read_run_time();

Returns the time at which the simulation has been run as calender time.

read_part

D3plotPart read_part(size_t part_index);

Returns all elements (solid, thick shell, beam, shell) of a part. The part_index can retrieved by iterating over the array returned by read_part_ids.

  • part_index The index of the part into the part ids array returned by read_part_ids

read_part_by_id

D3plotPart read_part_by_id(size_t part_id, const Array<d3_word> &part_ids = Array<d3_word>());

The same as read_part, but instead of an index into the parts, this functions takes an id. You can supply this function with the part ids returned by read_part_ids. If you do not do this, they will be read in this function call. Which means that if you intend to call this function multiple times, it is best to preload the part ids.

  • part_id The id of the part as defined in the keyword file
  • part_ids The array returned by read_part_ids. Can be set to increase performance

num_time_steps

size_t num_time_steps() const;

Returns the number of states (time steps).

get_handle

d3plot_file &get_handle();
const d3plot_file &get_handle() const;

Returns the underlying C d3plot_file.

dro::D3plotPart

A class used to access data of a certain part in a d3plot file (family).

Constructor

D3plotPart(const d3plot_part &part);
D3plotPart(D3plotPart &&rhs);
D3plotPart &operator=(D3plotPart &&rhs);

Only move semantics are enabled.

get_solid_elements

Array<d3_word> get_solid_elements();

Returns all solid element ids of the part.

get_thick_shell_elements

Array<d3_word> get_thick_shell_elements();

Returns all thick shell element ids of the part.

get_beam_elements

Array<d3_word> get_beam_elements();

Returns all beam element ids of the part.

get_shell_elements

Array<d3_word> get_shell_elements();

Returns all shell element ids of the part.

get_solid_element_indices

Array<size_t> get_solid_element_indices();

Returns all solid element indices (into the array returned by dro::D3plot::read_solid_element_ids) of the part.

get_thick_shell_element_indices

Array<size_t> get_thick_shell_element_indices();

Returns all thick shell element indices (into the array returned by dro::D3plot::read_thick_shell_element_ids) of the part.

get_beam_element_indices

Array<size_t> get_beam_element_indices();

Returns all beam element indices (into the array returned by dro::D3plot::read_beam_element_ids) of the part.

get_shell_element_indices

Array<size_t> get_shell_element_indices();

Returns all shell element indices (into the array returned by dro::D3plot::read_shell_element_ids) of the part.

get_node_ids

Array<d3_word> get_node_ids(
      D3plot &plot_file, const Array<d3_word> *solid_ids = nullptr,
      const Array<d3_word> *beam_ids = nullptr,
      const Array<d3_word> *shell_ids = nullptr,
      const Array<d3_word> *thick_shell_ids = nullptr,
      const Array<d3_word> *node_ids = nullptr,
      const Array<d3plot_solid_con> *solid_cons = nullptr,
      const Array<d3plot_beam_con> *beam_cons = nullptr,
      const Array<d3plot_shell_con> *shell_cons = nullptr,
      const Array<d3plot_thick_shell_con> *thick_shell_cons = nullptr) const;

Returns all node ids of the part. All ids and connectivities of all different elements can be provided to improve performance, since they would not need to be loaded.

  • plot_file The dro::D3plot from which to load not provided data
  • solid_ids The array returned by dro::D3plot::read_solid_element_ids
  • beam_ids The array returned by dro::D3plot::read_beam_element_ids
  • shell_ids The array returned by dro::D3plot::read_shell_element_ids
  • thick_shell_ids The array returned by the dro::D3plot::read_thick_shell_element_ids
  • node_ids The array returned by dro::D3plot::read_node_ids
  • solid_cons The array returned by dro::D3plot::read_solid_elements
  • beam_cons The array returned by dro::D3plot::read_beam_elements
  • shell_cons The array returned by dro::D3plot::read_shell_elements
  • thick_shell_cons The array returned by dro::D3plot::read_thick_shell_elements

get_node_indices

Array<d3_word> get_node_indices(
      D3plot &plot_file, const Array<d3_word> *solid_ids = nullptr,
      const Array<d3_word> *beam_ids = nullptr,
      const Array<d3_word> *shell_ids = nullptr,
      const Array<d3_word> *thick_shell_ids = nullptr,
      const Array<d3plot_solid_con> *solid_cons = nullptr,
      const Array<d3plot_beam_con> *beam_cons = nullptr,
      const Array<d3plot_shell_con> *shell_cons = nullptr,
      const Array<d3plot_thick_shell_con> *thick_shell_cons = nullptr) const;

Returns all node indices of the part. All ids and connectivities of all different elements can be provided to improve performance, since they would not need to be loaded. This returns indices into the node ids array returned by dro::D3plot::read_node_ids.

  • plot_file The dro::D3plot from which to load not provided data
  • solid_ids The array returned by dro::D3plot::read_solid_element_ids
  • beam_ids The array returned by dro::D3plot::read_beam_element_ids
  • shell_ids The array returned by dro::D3plot::read_shell_element_ids
  • thick_shell_ids The array returned by the dro::D3plot::read_thick_shell_element_ids
  • solid_cons The array returned by dro::D3plot::read_solid_elements
  • beam_cons The array returned by dro::D3plot::read_beam_elements
  • shell_cons The array returned by dro::D3plot::read_shell_elements
  • thick_shell_cons The array returned by dro::D3plot::read_thick_shell_elements

get_num_nodes

size_t get_num_nodes(
      D3plot &plot_file, const Array<d3_word> *solid_ids = nullptr,
      const Array<d3_word> *beam_ids = nullptr,
      const Array<d3_word> *shell_ids = nullptr,
      const Array<d3_word> *thick_shell_ids = nullptr,
      const Array<d3plot_solid_con> *solid_cons = nullptr,
      const Array<d3plot_beam_con> *beam_cons = nullptr,
      const Array<d3plot_shell_con> *shell_cons = nullptr,
      const Array<d3plot_thick_shell_con> *thick_shell_cons = nullptr) const;

Returns the number of nodes of a part. Internally it just calls get_node_indices and returns the number of node indices.

  • plot_file The dro::D3plot from which to load not provided data
  • solid_ids The array returned by dro::D3plot::read_solid_element_ids
  • beam_ids The array returned by dro::D3plot::read_beam_element_ids
  • shell_ids The array returned by dro::D3plot::read_shell_element_ids
  • thick_shell_ids The array returned by the dro::D3plot::read_thick_shell_element_ids
  • solid_cons The array returned by dro::D3plot::read_solid_elements
  • beam_cons The array returned by dro::D3plot::read_beam_elements
  • shell_cons The array returned by dro::D3plot::read_shell_elements
  • thick_shell_cons The array returned by dro::D3plot::read_thick_shell_elements

get_num_elements

size_t get_num_elements() const;

Returns the number of all elements of a part.

get_all_element_ids

Array<d3_word> get_all_element_ids() const;

Returns an array containing all element ids.

dro::D3plotShell

get_history_variables

const Array<double> get_mid_history_variables() const noexcept;
const Array<double> get_inner_history_variables() const noexcept;
const Array<double> get_outer_history_variables() const noexcept;
const Array<double> get_mean_history_variables() const noexcept;
const Array<double> get_add_ip_history_variables(size_t add_idx) const noexcept;

Returns the history variables of either integration point. get_mean_history_variables returns an average over all integration points. get_add_ip_history_variables returns the history variables of a specific additional integration point.

  • add_idx Index of the integration point (Excluding mid, inner and outer)

get_add_ips

const Array<d3plot_surface> get_add_ips() const noexcept;

Returns an array containing all additional integration points.

get_mean

D3plotSurface get_mean() const noexcept;

Returns the average values of all integration points.

dro::D3plotThickShell

get_history_variables

const Array<double> get_mid_history_variables() const noexcept;
const Array<double> get_inner_history_variables() const noexcept;
const Array<double> get_outer_history_variables() const noexcept;
const Array<double> get_mean_history_variables() const noexcept;
const Array<double> get_add_ip_history_variables(size_t add_idx) const noexcept;

Returns the history variables of either integration point. get_mean_history_variables returns an average over all integration points. get_add_ip_history_variables returns the history variables of a specific additional integration point.

  • add_idx Index of the integration point (Excluding mid, inner and outer)

get_add_ips

const Array<d3plot_surface> get_add_ips() const noexcept;

Returns an array containing all additional integration points.

get_mean

D3plotSurface get_mean() const noexcept;

Returns the average values of all integration points.

Back to Home

Clone this wiki locally