9 json[
"basis"] = _dof.
basis().transpose();
26 std::stringstream msg;
27 msg <<
"Error reading DoF input: if either is present, 'axis_names' and "
28 "'basis' must both be present";
29 throw std::runtime_error(msg.str());
37 json[
"basis"].
get(row_vector_basis);
40 if (row_vector_basis.cols() !=
traits.dim()) {
41 throw std::runtime_error(
"Cannot construct DoFSet of type " +
42 traits.name() +
", basis vectors are of size " +
44 " but must be size " +
48 if (row_vector_basis.rows() >
traits.dim()) {
49 throw std::runtime_error(
"Cannot construct DoFSet of type " +
50 traits.name() +
", found " +
52 " basis vectors, but must be " +
56 std::vector<std::string> component_names;
57 json[
"axis_names"].
get(component_names);
59 if (row_vector_basis.rows() != component_names.size()) {
60 throw std::runtime_error(
61 "Cannot construct DoFSet of type " +
traits.name() +
", found " +
63 " basis vectors, but the number of 'axis_names' is " +
72 std::unordered_set<std::string> excluded_occupants;
73 json.
get_if(excluded_occupants,
"excluded_occupants");
Specifies traits of (possibly) anisotropic crystal properties.
bool contains(const std::string &name) const
Return true if JSON object contains 'name'.
Eigen::MatrixXd const & basis() const
Matrix that relates DoFSet variables to a conventional coordiante system.
const std::vector< std::string > & component_names() const
Returns the names of each of the component axes.
const std::unordered_set< std::string > & excluded_occupants() const
Return all occupants that the DoFSet should not be applied to.
std::string to_string(ENUM val)
Return string representation of enum class.
bool get_if(T &t, const std::string &key, Args &&... args) const
T get(Args &&... args) const
Get data from json, using one of several alternatives.
jsonParser & to_json(const ClexDescription &desc, jsonParser &json)
static ReturnType from_json(const jsonParser &json)
Default from_json is equivalent to.