MCPcopy Create free account
hub / github.com/FEniCS/dolfinx / shape_to_string

Function shape_to_string

cpp/dolfinx/io/xdmf_function.cpp:31–43  ·  view source on GitHub ↗

Convert a shape to the XDMF string description (Scalar, Vector, Tensor).

Source from the content-addressed store, hash-verified

29/// Convert a shape to the XDMF string description (Scalar, Vector,
30/// Tensor).
31std::string shape_to_string(std::span<const std::size_t> shape)
32{
33 if (shape.empty())
34 return "Scalar";
35 else if (shape.size() == 1 and shape[0] == 1)
36 return "Scalar";
37 else if (shape.size() == 1)
38 return "Vector";
39 else if (shape.size() == 2)
40 return "Tensor";
41 else
42 throw std::runtime_error("Unsupported value shape");
43}
44} // namespace
45
46//-----------------------------------------------------------------------------

Callers 1

add_functionMethod · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected