<aside> 💡 For each available result, an operator reading its data should be implemented. This can be a single parametrized operator recorded for each result.

</aside>

Untitled

Document it

The specification allows to document each operator. For consistency, the specification can be used through different reader plugins.

Here the example is done for a displacement operator:

struct CustomDisplacementProvider
	{
		// TO DO: rename "custom_solver" to the real solver name and "custom_extension" to the real file extension
		static std::string name() { return "custom_solver::custom_extension::U"; }

		static void run(ansys::dpf::OperatorMain& main);

		static ansys::dpf::OperatorSpecification specification()
		{
			ansys::dpf::OperatorSpecification spec;
			spec.setDocumentation("Read/compute nodal displacements from result streams.");
			spec.setInputPins(
				{
					ansys::dpf::PinDefinition(ansys::dpf::eStreamPin)
						.setName("streams_container")
						.setAcceptedTypes({ ansys::dpf::types::streams })
						.setDoc("result file container allowed to be kept open to cache data")
						.setOptional(true),
					ansys::dpf::PinDefinition(ansys::dpf::eDataSourcesPin)
						.setName("data_sources")
						.setAcceptedTypes({ ansys::dpf::types::data_sources })
						.setDoc("result file path container, used if no streams are set"),
					ansys::dpf::PinDefinition(ansys::dpf::eTimeScopPin)
						.setName("time_scoping")
						.setAcceptedTypes({ ansys::dpf::types::scoping, ansys::dpf::types::intVector })
						.setDoc("time/freq (use doubles or field), time/freq set ids (use ints or scoping) or time/freq step ids (use scoping with TimeFreq_steps location) required in output")
						.setOptional(true),
					ansys::dpf::PinDefinition(ansys::dpf::eMeshScopPin)
						.setName("mesh_scoping")
						.setAcceptedTypes({ ansys::dpf::types::scoping, ansys::dpf::types::scopings_container })
						.setDoc("nodes or elements scoping required in output. The scoping's location indicates whether nodes or elements are asked. Using scopings container enables to split the result fields container in domains")
						.setOptional(true),
				});

			spec.setOutputPins(
				{
					ansys::dpf::PinDefinition(0)
						.setName("displacement")
						.setAcceptedTypes({ ansys::dpf::types::fields_container })
						.setDoc("Displacement results"),
				});

			spec.setProperty(ansys::dpf::spec::exposure::sExposure, ansys::dpf::spec::exposure::sPrivate);

			return spec;
		}

Implementation

For the "run" method implementation, refer to here:

To be fully consistent with other DPF's plugin, results outputs customization must be enabled by supporting the main input pins. Time and mesh scoping enable the user to choose on which mesh entities (nodes or elements) and at which time or frequency sets the results are expected.

Supporting a ScopingsContainer instance as a mesh scoping allows the user to specify a custom spatial split of the results. A ScopingsContainer contains one node or element Scoping by spatial group required in output. This allows to get one result Field by body, by material or any kind of grouping.

Rightfully ordering the loops to get results over time and over space by respecting the time and mesh scopings inputs can be a bit tedious. Fill free to reuse the loops defined here: