ASPECT
utilities.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014 - 2024 by the authors of the ASPECT code.
3 
4  This file is part of ASPECT.
5 
6  ASPECT is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2, or (at your option)
9  any later version.
10 
11  ASPECT is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with ASPECT; see the file LICENSE. If not see
18  <http://www.gnu.org/licenses/>.
19 */
20 
21 
22 #ifndef _aspect_utilities_h
23 #define _aspect_utilities_h
24 
25 #include <aspect/global.h>
26 
27 #include <array>
28 #include <random>
29 #include <deal.II/base/point.h>
30 #include <deal.II/base/conditional_ostream.h>
31 #include <deal.II/base/table_indices.h>
32 #include <deal.II/base/function_lib.h>
33 #include <deal.II/dofs/dof_handler.h>
34 #include <deal.II/fe/component_mask.h>
35 
37 #include <aspect/structured_data.h>
38 
39 
40 
41 namespace aspect
42 {
43  template <int dim> class SimulatorAccess;
44 
45  namespace GeometryModel
46  {
47  template <int dim> class Interface;
48  }
49 
54  namespace Utilities
55  {
56  using namespace dealii;
57  using namespace ::Utilities;
58 
59 
73  template <typename T>
74  std::vector<T>
75  possibly_extend_from_1_to_N (const std::vector<T> &values,
76  const unsigned int N,
77  const std::string &id_text);
78 
79  namespace MapParsing
80  {
85  struct Options
86  {
87  /* A list of valid key names that are allowed
88  * to appear in the map. If this list is empty
89  * it is assumed to be equal to the list of
90  * required keys. If this list is longer than
91  * list_of_required_keys, every key that is
92  * allowed but not required will be ignored when
93  * parsing the map.
94  */
95  std::vector<std::string> list_of_allowed_keys;
96 
97  /* A list of valid key names that are required
98  * to appear in the map. Only these keys will be
99  * parsed into the map structure and the order of
100  * these keys determines the order of entries
101  * in the output vector.
102  */
103  std::vector<std::string> list_of_required_keys;
104 
105  /*
106  * A name that identifies the type of input property (e.g. 'density', 'viscosity')
107  * that is being parsed by this function. This name is used in generating
108  * error messages if the map does not conform to the expected format.
109  */
110  std::string property_name;
111 
112  /*
113  * If true, allow multiple values
114  * for each key. If false only allow a single value per key. In either
115  * case each key is only allowed to appear once. Multiple values
116  * for a key are delimited by a "|" character, as in
117  * "key1: value1|value2|value3, key2: value1|value2".
118  */
120 
121  /*
122  * Whether to allow for some keys in list_of_required_keys to be
123  * not set to any values, i.e. they do not appear at all.
124  * This also allows a completely empty map.
125  */
127 
128  /*
129  * Whether to store the number of values
130  * per key in n_values_per_key while creating
131  * the map. This vector can be later accessed
132  * and used (for example) to check that subsequent calls to
133  * parse other input parameters have the same
134  * structure.
135  */
137 
138  /*
139  * Whether to check the number of values
140  * per key in the map against values stored
141  * in n_values_per_key. This allows to
142  * check that subsequent calls to
143  * parse other input parameters have the same
144  * structure.
145  */
147 
148  /*
149  * A vector of unsigned
150  * integers that is used by store_values_per_key and
151  * check_values_per_key to either store the current map
152  * structure or check the map structure against an existing
153  * map. This parameter is only used if either of these
154  * two parameters are set to true
155  */
156  std::vector<unsigned int> n_values_per_key;
157 
162  Options() = delete;
163 
174  Options(const std::vector<std::string> &list_of_required_keys,
175  const std::string &property_name)
176  :
177  list_of_allowed_keys(list_of_required_keys),
178  list_of_required_keys(list_of_required_keys),
179  property_name(property_name),
180  allow_multiple_values_per_key(false),
181  allow_missing_keys(false),
182  store_values_per_key(false),
183  check_values_per_key(false),
184  n_values_per_key()
185  {}
186  };
187 
213  std::vector<double>
214  parse_map_to_double_array(const std::string &input_string,
215  Options &options);
216  }
217 
291  DEAL_II_DEPRECATED
292  std::vector<double>
293  parse_map_to_double_array (const std::string &key_value_map,
294  const std::vector<std::string> &list_of_keys,
295  const bool expects_background_field,
296  const std::string &property_name,
297  const bool allow_multiple_values_per_key = false,
298  const std::unique_ptr<std::vector<unsigned int>> &n_values_per_key = nullptr,
299  const bool allow_missing_keys = false);
300 
314  template <typename T>
315  Table<2,T>
316  parse_input_table (const std::string &input_string,
317  const unsigned int n_rows,
318  const unsigned int n_columns,
319  const std::string &property_name);
320 
333  template <int dim>
334  std::vector<std::string>
335  expand_dimensional_variable_names (const std::vector<std::string> &var_declarations);
336 
343  template <int dim>
344  IndexSet extract_locally_active_dofs_with_component(const DoFHandler<dim> &dof_handler,
345  const ComponentMask &component_mask);
346 
356  template <int dim>
357  std::vector<Point<dim>> get_unit_support_points(const SimulatorAccess<dim> &simulator_access);
358 
359 
360 
366  template <int dim>
367  bool
368  point_is_in_triangulation(const Mapping<dim> &mapping,
369  const parallel::distributed::Triangulation<dim> &triangulation,
370  const Point<dim> &point,
371  const MPI_Comm mpi_communicator);
372 
373 
374  namespace Coordinates
375  {
376 
382  template <int dim>
383  std::array<double,dim>
384  WGS84_coordinates(const ::Point<dim> &position);
385 
396  template <int dim>
397  std::array<double,dim>
398  cartesian_to_spherical_coordinates(const ::Point<dim> &position);
399 
405  template <int dim>
406  ::Point<dim>
407  spherical_to_cartesian_coordinates(const std::array<double,dim> &scoord);
408 
414  template <int dim>
415  Tensor<1,dim>
416  spherical_to_cartesian_vector(const Tensor<1,dim> &spherical_vector,
417  const ::Point<dim> &position);
418 
419 
425  template <int dim>
426  std::array<double,3>
427  cartesian_to_ellipsoidal_coordinates(const ::Point<3> &position,
428  const double semi_major_axis_a,
429  const double eccentricity);
430 
435  template <int dim>
436  ::Point<3>
437  ellipsoidal_to_cartesian_coordinates(const std::array<double,3> &phi_theta_d,
438  const double semi_major_axis_a,
439  const double eccentricity);
440 
441 
448  string_to_coordinate_system (const std::string &);
449  }
450 
451 
456  template <int dim>
457  bool
458  polygon_contains_point(const std::vector<Point<2>> &point_list,
459  const ::Point<2> &point);
460 
466  template <int dim>
467  double
468  signed_distance_to_polygon(const std::vector<Point<2>> &point_list,
469  const ::Point<2> &point);
470 
471 
478  double
479  distance_to_line(const std::array<::Point<2>,2> &point_list,
480  const ::Point<2> &point);
481 
489  template <int dim>
490  std::array<Tensor<1,dim>,dim-1>
491  orthogonal_vectors (const Tensor<1,dim> &v);
492 
497  Tensor<2,3>
498  rotation_matrix_from_axis (const Tensor<1,3> &rotation_axis,
499  const double rotation_angle);
500 
507  Tensor<2,3>
508  compute_rotation_matrix_for_slice (const Tensor<1,3> &point_one,
509  const Tensor<1,3> &point_two);
510 
547  std::pair<double,double> real_spherical_harmonic( unsigned int l, // degree
548  unsigned int m, // order
549  double theta, // colatitude (radians)
550  double phi ); // longitude (radians)
551 
555  struct ThousandSep : std::numpunct<char>
556  {
557  protected:
558  char do_thousands_sep() const override
559  {
560  return ',';
561  }
562 
563  std::string do_grouping() const override
564  {
565  return "\003"; // groups of 3 digits (this string is in octal format)
566  }
567 
568  };
569 
582  bool fexists(const std::string &filename);
583 
597  bool fexists(const std::string &filename,
598  const MPI_Comm comm);
599 
605  bool filename_is_url(const std::string &filename);
606 
626  std::string
627  read_and_distribute_file_content(const std::string &filename,
628  const MPI_Comm comm);
629 
642  void
643  collect_and_write_file_content(const std::string &filename,
644  const std::string &file_content,
645  const MPI_Comm comm);
646 
660  int
661  mkdirp(std::string pathname, const mode_t mode = 0755);
662 
673  void create_directory(const std::string &pathname,
674  const MPI_Comm comm,
675  const bool silent);
676 
681  namespace tk
682  {
686  class spline
687  {
688  public:
698  void set_points(const std::vector<double> &x,
699  const std::vector<double> &y,
700  const bool cubic_spline = true,
701  const bool monotone_spline = false);
705  double operator() (double x) const;
706 
707  private:
711  std::vector<double> m_x;
712 
719  std::vector<double> m_a, m_b, m_c, m_y;
720  };
721  }
722 
730  inline
731  void
732  extract_composition_values_at_q_point (const std::vector<std::vector<double>> &composition_values,
733  const unsigned int q,
734  std::vector<double> &composition_values_at_q_point);
735 
740  std::string
741  expand_ASPECT_SOURCE_DIR (const std::string &location);
742 
747  std::string parenthesize_if_nonempty (const std::string &s);
748 
752  bool
753  string_to_bool(const std::string &s);
754 
758  std::vector<bool>
759  string_to_bool(const std::vector<std::string> &s);
760 
764  unsigned int
765  string_to_unsigned_int(const std::string &s);
766 
770  std::vector<unsigned int>
771  string_to_unsigned_int(const std::vector<std::string> &s);
772 
777  bool has_unique_entries (const std::vector<std::string> &strings);
778 
779 
780 
802  double weighted_p_norm_average (const std::vector<double> &weights,
803  const std::vector<double> &values,
804  const double p);
805 
806 
832  template <typename T>
833  T derivative_of_weighted_p_norm_average (const double averaged_parameter,
834  const std::vector<double> &weights,
835  const std::vector<double> &values,
836  const std::vector<T> &derivatives,
837  const double p);
869  template <int dim>
870  double compute_spd_factor(const double eta,
871  const SymmetricTensor<2,dim> &strain_rate,
872  const SymmetricTensor<2,dim> &dviscosities_dstrain_rate,
873  const double SPD_safety_factor);
874 
878  template <int dim>
879  Point<dim> convert_array_to_point(const std::array<double,dim> &array);
880 
884  template <int dim>
885  std::array<double,dim> convert_point_to_array(const Point<dim> &point);
886 
894  class Operator
895  {
896  public:
901  {
907  replace_if_valid
908  };
909 
914  Operator();
915 
919  Operator(const operation op);
920 
925  double operator() (const double x, const double y) const;
926 
931  bool operator== (const operation op) const;
932 
933  private:
938  };
939 
944  std::vector<Operator> create_model_operator_list(const std::vector<std::string> &operator_names);
945 
949  const std::string get_model_operator_options();
950 
956  template <int dim>
957  SymmetricTensor<2,dim> nth_basis_for_symmetric_tensors (const unsigned int k);
958 
962  template <int dim>
964  {
965  public:
969  NaturalCoordinate(Point<dim> &position,
970  const GeometryModel::Interface<dim> &geometry_model);
971 
976  NaturalCoordinate(const std::array<double, dim> &coord,
977  const Utilities::Coordinates::CoordinateSystem &coord_system);
978 
983  std::array<double,dim> &get_coordinates();
984 
989  const std::array<double,dim> &get_coordinates() const;
990 
995  std::array<double,dim-1> get_surface_coordinates() const;
996 
1001  double get_depth_coordinate() const;
1002 
1003  private:
1009 
1013  std::array<double,dim> coordinates;
1014  };
1015 
1016 
1035  template <int dim, typename VectorType>
1036  void
1037  project_cellwise(const Mapping<dim> &mapping,
1038  const DoFHandler<dim> &dof_handler,
1039  const unsigned int component_index,
1040  const Quadrature<dim> &quadrature,
1041  const std::function<void(
1042  const typename DoFHandler<dim>::active_cell_iterator &,
1043  const std::vector<Point<dim>> &,
1044  std::vector<double> &)> &function,
1045  VectorType &vec_result);
1046 
1070  void throw_linear_solver_failure_exception(const std::string &solver_name,
1071  const std::string &function_name,
1072  const std::vector<SolverControl> &solver_controls,
1073  const std::exception &exc,
1074  const MPI_Comm mpi_communicator,
1075  const std::string &output_filename = "");
1076 
1084  template <int dim>
1086  {
1087  public:
1097  VectorFunctionFromVelocityFunctionObject (const unsigned int n_components,
1098  const std::function<Tensor<1,dim> (const Point<dim> &)> &function_object);
1099 
1107  double value (const Point<dim> &p,
1108  const unsigned int component = 0) const override;
1109 
1119  void vector_value (const Point<dim> &p,
1120  Vector<double> &values) const override;
1121 
1122  private:
1127  const std::function<Tensor<1,dim> (const Point<dim> &)> function_object;
1128  };
1129 
1136  template <typename T>
1137  inline
1138  std::vector<std::size_t>
1139  compute_sorting_permutation(const std::vector<T> &vector);
1140 
1148  template <typename T>
1149  inline
1150  std::vector<T>
1152  const std::vector<T> &vector,
1153  const std::vector<std::size_t> &permutation_vector);
1154 
1167  std::vector<Tensor<2,3>>
1168  rotation_matrices_random_draw_volume_weighting(const std::vector<double> &volume_fractions,
1169  const std::vector<Tensor<2,3>> &rotation_matrices,
1170  const unsigned int n_output_matrices,
1171  std::mt19937 &random_number_generator);
1172 
1176  double wrap_angle(const double angle);
1177 
1182  std::array<double,3> zxz_euler_angles_from_rotation_matrix(const Tensor<2,3> &rotation_matrix);
1183 
1188  Tensor<2,3> zxz_euler_angles_to_rotation_matrix(const double phi1,
1189  const double theta,
1190  const double phi2);
1191 
1192  }
1193 }
1194 
1195 
1196 // inline implementations:
1197 #ifndef DOXYGEN
1198 namespace aspect
1199 {
1200  namespace Utilities
1201  {
1202 
1203  template <typename T>
1204  inline
1205  std::vector<T>
1206  possibly_extend_from_1_to_N (const std::vector<T> &values,
1207  const unsigned int N,
1208  const std::string &id_text)
1209  {
1210  if (values.size() == 1)
1211  {
1212  return std::vector<T> (N, values[0]);
1213  }
1214  else if (values.size() == N)
1215  {
1216  return values;
1217  }
1218  else
1219  {
1220  // Non-specified behavior
1221  AssertThrow(false,
1222  ExcMessage("Length of " + id_text + " list must be " +
1223  "either one or " + Utilities::to_string(N) +
1224  ". Currently it is " + Utilities::to_string(values.size()) + "."));
1225  }
1226 
1227  // This should never happen, but return an empty vector so the compiler
1228  // will be happy
1229  return std::vector<T> ();
1230  }
1231 
1232  inline
1233  void
1234  extract_composition_values_at_q_point (const std::vector<std::vector<double>> &composition_values,
1235  const unsigned int q,
1236  std::vector<double> &composition_values_at_q_point)
1237  {
1238  Assert(q<composition_values.size(), ExcInternalError());
1239  Assert(composition_values_at_q_point.size() > 0,
1240  ExcInternalError());
1241 
1242  for (unsigned int k=0; k < composition_values_at_q_point.size(); ++k)
1243  {
1244  Assert(composition_values[k].size() == composition_values_at_q_point.size(),
1245  ExcInternalError());
1246  composition_values_at_q_point[k] = composition_values[k][q];
1247  }
1248  }
1249 
1250  template <typename T>
1251  inline
1252  std::vector<std::size_t>
1253  compute_sorting_permutation(const std::vector<T> &vector)
1254  {
1255  std::vector<std::size_t> p(vector.size());
1256  std::iota(p.begin(), p.end(), 0);
1257  std::sort(p.begin(), p.end(),
1258  [&](std::size_t i, std::size_t j)
1259  {
1260  return vector[i] < vector[j];
1261  });
1262  return p;
1263  }
1264 
1265  template <typename T>
1266  inline
1267  std::vector<T>
1269  const std::vector<T> &vector,
1270  const std::vector<std::size_t> &permutation_vector)
1271  {
1272  std::vector<T> sorted_vec(vector.size());
1273  std::transform(permutation_vector.begin(), permutation_vector.end(), sorted_vec.begin(),
1274  [&](std::size_t i)
1275  {
1276  return vector[i];
1277  });
1278  return sorted_vec;
1279  }
1280 
1284  namespace Tensors
1285  {
1291  template <int dim, class Iterator>
1292  inline
1293  SymmetricTensor<2,dim>
1294  to_symmetric_tensor(const Iterator begin,
1295  const Iterator end)
1296  {
1297  AssertDimension(std::distance(begin, end), (SymmetricTensor<2,dim>::n_independent_components));
1298  (void) end;
1299 
1300  SymmetricTensor<2,dim> output;
1301 
1302  Iterator next = begin;
1303  for (unsigned int i=0; i < SymmetricTensor<2,dim>::n_independent_components; ++i, ++next)
1304  output[SymmetricTensor<2,dim>::unrolled_to_component_indices(i)] = *next;
1305 
1306  return output;
1307  }
1308 
1313  template <int dim, class Iterator>
1314  inline
1315  void
1316  unroll_symmetric_tensor_into_array(const SymmetricTensor<2,dim> &tensor,
1317  const Iterator begin,
1318  const Iterator end)
1319  {
1320  AssertDimension(std::distance(begin, end), (SymmetricTensor<2,dim>::n_independent_components));
1321  (void) end;
1322 
1323  Iterator next = begin;
1324  for (unsigned int i=0; i < SymmetricTensor<2,dim>::n_independent_components; ++i, ++next)
1325  *next = tensor[SymmetricTensor<2,dim>::unrolled_to_component_indices(i)];
1326  }
1327 
1331  SymmetricTensor<4,3>
1332  rotate_full_stiffness_tensor(const Tensor<2,3> &rotation_tensor, const SymmetricTensor<4,3> &input_tensor);
1333 
1338  SymmetricTensor<2,6>
1339  rotate_voigt_stiffness_matrix(const Tensor<2,3> &rotation_tensor, const SymmetricTensor<2,6> &input_tensor);
1340 
1345  SymmetricTensor<2,6>
1346  to_voigt_stiffness_matrix(const SymmetricTensor<4,3> &input_tensor);
1347 
1352  SymmetricTensor<4,3>
1353  to_full_stiffness_tensor(const SymmetricTensor<2,6> &input_tensor);
1354 
1359  Tensor<1,21>
1360  to_voigt_stiffness_vector(const SymmetricTensor<2,6> &input_tensor);
1361 
1366  SymmetricTensor<2,6>
1367  to_voigt_stiffness_matrix(const Tensor<1,21> &input_tensor);
1368 
1373  Tensor<1,21>
1374  to_voigt_stiffness_vector(const SymmetricTensor<4,3> &input);
1375 
1376 
1381  template <int dim>
1382  const Tensor<dim,dim> &levi_civita();
1383 
1384  // Declare the existence of a specialization:
1385  template <>
1386  const Tensor<3,3> &levi_civita<3>();
1387  }
1388 
1389  }
1390 }
1391 #endif
1392 
1393 #endif
T derivative_of_weighted_p_norm_average(const double averaged_parameter, const std::vector< double > &weights, const std::vector< double > &values, const std::vector< T > &derivatives, const double p)
std::string read_and_distribute_file_content(const std::string &filename, const MPI_Comm comm)
Point< dim > convert_array_to_point(const std::array< double, dim > &array)
std::vector< double > m_y
Definition: utilities.h:719
Tensor< 1, dim > spherical_to_cartesian_vector(const Tensor< 1, dim > &spherical_vector, const ::Point< dim > &position)
Tensor< 2, 3 > compute_rotation_matrix_for_slice(const Tensor< 1, 3 > &point_one, const Tensor< 1, 3 > &point_two)
std::vector< std::string > list_of_required_keys
Definition: utilities.h:103
double weighted_p_norm_average(const std::vector< double > &weights, const std::vector< double > &values, const double p)
double distance_to_line(const std::array<::Point< 2 >, 2 > &point_list, const ::Point< 2 > &point)
std::vector< std::string > expand_dimensional_variable_names(const std::vector< std::string > &var_declarations)
std::array< double, dim > coordinates
Definition: utilities.h:1013
void collect_and_write_file_content(const std::string &filename, const std::string &file_content, const MPI_Comm comm)
double compute_spd_factor(const double eta, const SymmetricTensor< 2, dim > &strain_rate, const SymmetricTensor< 2, dim > &dviscosities_dstrain_rate, const double SPD_safety_factor)
Table< 2, T > parse_input_table(const std::string &input_string, const unsigned int n_rows, const unsigned int n_columns, const std::string &property_name)
std::pair< double, double > real_spherical_harmonic(unsigned int l, unsigned int m, double theta, double phi)
std::vector< double > m_x
Definition: utilities.h:711
std::string expand_ASPECT_SOURCE_DIR(const std::string &location)
Tensor< 2, 3 > zxz_euler_angles_to_rotation_matrix(const double phi1, const double theta, const double phi2)
std::array< Tensor< 1, dim >, dim-1 > orthogonal_vectors(const Tensor< 1, dim > &v)
std::vector< Tensor< 2, 3 > > rotation_matrices_random_draw_volume_weighting(const std::vector< double > &volume_fractions, const std::vector< Tensor< 2, 3 >> &rotation_matrices, const unsigned int n_output_matrices, std::mt19937 &random_number_generator)
std::string to_string(const Newton::Parameters::Stabilization preconditioner_stabilization)
std::array< double, dim > WGS84_coordinates(const ::Point< dim > &position)
::Point< 3 > ellipsoidal_to_cartesian_coordinates(const std::array< double, 3 > &phi_theta_d, const double semi_major_axis_a, const double eccentricity)
void project_cellwise(const Mapping< dim > &mapping, const DoFHandler< dim > &dof_handler, const unsigned int component_index, const Quadrature< dim > &quadrature, const std::function< void(const typename DoFHandler< dim >::active_cell_iterator &, const std::vector< Point< dim >> &, std::vector< double > &)> &function, VectorType &vec_result)
bool point_is_in_triangulation(const Mapping< dim > &mapping, const parallel::distributed::Triangulation< dim > &triangulation, const Point< dim > &point, const MPI_Comm mpi_communicator)
void throw_linear_solver_failure_exception(const std::string &solver_name, const std::string &function_name, const std::vector< SolverControl > &solver_controls, const std::exception &exc, const MPI_Comm mpi_communicator, const std::string &output_filename="")
bool polygon_contains_point(const std::vector< Point< 2 >> &point_list, const ::Point< 2 > &point)
int mkdirp(std::string pathname, const mode_t mode=0755)
Utilities::Coordinates::CoordinateSystem coordinate_system
Definition: utilities.h:1008
void create_directory(const std::string &pathname, const MPI_Comm comm, const bool silent)
::Point< dim > spherical_to_cartesian_coordinates(const std::array< double, dim > &scoord)
std::string do_grouping() const override
Definition: utilities.h:563
std::vector< T > possibly_extend_from_1_to_N(const std::vector< T > &values, const unsigned int N, const std::string &id_text)
std::array< double, 3 > cartesian_to_ellipsoidal_coordinates(const ::Point< 3 > &position, const double semi_major_axis_a, const double eccentricity)
Options(const std::vector< std::string > &list_of_required_keys, const std::string &property_name)
Definition: utilities.h:174
std::array< double, dim > convert_point_to_array(const Point< dim > &point)
std::vector< bool > string_to_bool(const std::vector< std::string > &s)
std::vector< Point< dim > > get_unit_support_points(const SimulatorAccess< dim > &simulator_access)
std::vector< T > apply_permutation(const std::vector< T > &vector, const std::vector< std::size_t > &permutation_vector)
IndexSet extract_locally_active_dofs_with_component(const DoFHandler< dim > &dof_handler, const ComponentMask &component_mask)
std::vector< unsigned int > n_values_per_key
Definition: utilities.h:156
std::vector< unsigned int > string_to_unsigned_int(const std::vector< std::string > &s)
DEAL_II_DEPRECATED std::vector< double > parse_map_to_double_array(const std::string &key_value_map, const std::vector< std::string > &list_of_keys, const bool expects_background_field, const std::string &property_name, const bool allow_multiple_values_per_key=false, const std::unique_ptr< std::vector< unsigned int >> &n_values_per_key=nullptr, const bool allow_missing_keys=false)
double wrap_angle(const double angle)
bool fexists(const std::string &filename, const MPI_Comm comm)
std::vector< Operator > create_model_operator_list(const std::vector< std::string > &operator_names)
double signed_distance_to_polygon(const std::vector< Point< 2 >> &point_list, const ::Point< 2 > &point)
std::string parenthesize_if_nonempty(const std::string &s)
Definition: compat.h:59
std::array< double, 3 > zxz_euler_angles_from_rotation_matrix(const Tensor< 2, 3 > &rotation_matrix)
void extract_composition_values_at_q_point(const std::vector< std::vector< double >> &composition_values, const unsigned int q, std::vector< double > &composition_values_at_q_point)
const std::string get_model_operator_options()
char do_thousands_sep() const override
Definition: utilities.h:558
std::vector< std::string > list_of_allowed_keys
Definition: utilities.h:95
bool filename_is_url(const std::string &filename)
SymmetricTensor< 2, dim > nth_basis_for_symmetric_tensors(const unsigned int k)
std::vector< std::size_t > compute_sorting_permutation(const std::vector< T > &vector)
CoordinateSystem string_to_coordinate_system(const std::string &)
Definition: compat.h:42
std::array< double, dim > cartesian_to_spherical_coordinates(const ::Point< dim > &position)
bool has_unique_entries(const std::vector< std::string > &strings)
Tensor< 2, 3 > rotation_matrix_from_axis(const Tensor< 1, 3 > &rotation_axis, const double rotation_angle)