ASPECT
utilities.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014 - 2023 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  std::vector<double>
292  parse_map_to_double_array (const std::string &key_value_map,
293  const std::vector<std::string> &list_of_keys,
294  const bool expects_background_field,
295  const std::string &property_name,
296  const bool allow_multiple_values_per_key = false,
297  const std::unique_ptr<std::vector<unsigned int>> &n_values_per_key = nullptr,
298  const bool allow_missing_keys = false);
299 
313  template <typename T>
314  Table<2,T>
315  parse_input_table (const std::string &input_string,
316  const unsigned int n_rows,
317  const unsigned int n_columns,
318  const std::string &property_name);
319 
332  template <int dim>
333  std::vector<std::string>
334  expand_dimensional_variable_names (const std::vector<std::string> &var_declarations);
335 
342  template <int dim>
343  IndexSet extract_locally_active_dofs_with_component(const DoFHandler<dim> &dof_handler,
344  const ComponentMask &component_mask);
345 
355  template <int dim>
356  std::vector<Point<dim>> get_unit_support_points(const SimulatorAccess<dim> &simulator_access);
357 
358 
359 
365  template <int dim>
366  bool
367  point_is_in_triangulation(const Mapping<dim> &mapping,
368  const parallel::distributed::Triangulation<dim> &triangulation,
369  const Point<dim> &point,
370  const MPI_Comm mpi_communicator);
371 
372 
373  namespace Coordinates
374  {
375 
381  template <int dim>
382  std::array<double,dim>
383  WGS84_coordinates(const ::Point<dim> &position);
384 
395  template <int dim>
396  std::array<double,dim>
397  cartesian_to_spherical_coordinates(const ::Point<dim> &position);
398 
404  template <int dim>
405  ::Point<dim>
406  spherical_to_cartesian_coordinates(const std::array<double,dim> &scoord);
407 
413  template <int dim>
414  Tensor<1,dim>
415  spherical_to_cartesian_vector(const Tensor<1,dim> &spherical_vector,
416  const ::Point<dim> &position);
417 
418 
424  template <int dim>
425  std::array<double,3>
426  cartesian_to_ellipsoidal_coordinates(const ::Point<3> &position,
427  const double semi_major_axis_a,
428  const double eccentricity);
429 
434  template <int dim>
435  ::Point<3>
436  ellipsoidal_to_cartesian_coordinates(const std::array<double,3> &phi_theta_d,
437  const double semi_major_axis_a,
438  const double eccentricity);
439 
440 
447  string_to_coordinate_system (const std::string &);
448  }
449 
450 
455  template <int dim>
456  bool
457  polygon_contains_point(const std::vector<Point<2>> &point_list,
458  const ::Point<2> &point);
459 
465  template <int dim>
466  double
467  signed_distance_to_polygon(const std::vector<Point<2>> &point_list,
468  const ::Point<2> &point);
469 
470 
477  double
478  distance_to_line(const std::array<::Point<2>,2> &point_list,
479  const ::Point<2> &point);
480 
488  template <int dim>
489  std::array<Tensor<1,dim>,dim-1>
490  orthogonal_vectors (const Tensor<1,dim> &v);
491 
496  Tensor<2,3>
497  rotation_matrix_from_axis (const Tensor<1,3> &rotation_axis,
498  const double rotation_angle);
499 
506  Tensor<2,3>
507  compute_rotation_matrix_for_slice (const Tensor<1,3> &point_one,
508  const Tensor<1,3> &point_two);
509 
546  std::pair<double,double> real_spherical_harmonic( unsigned int l, // degree
547  unsigned int m, // order
548  double theta, // colatitude (radians)
549  double phi ); // longitude (radians)
550 
554  struct ThousandSep : std::numpunct<char>
555  {
556  protected:
557  char do_thousands_sep() const override
558  {
559  return ',';
560  }
561 
562  std::string do_grouping() const override
563  {
564  return "\003"; // groups of 3 digits (this string is in octal format)
565  }
566 
567  };
568 
581  bool fexists(const std::string &filename);
582 
596  bool fexists(const std::string &filename,
597  const MPI_Comm comm);
598 
604  bool filename_is_url(const std::string &filename);
605 
625  std::string
626  read_and_distribute_file_content(const std::string &filename,
627  const MPI_Comm comm);
628 
641  void
642  collect_and_write_file_content(const std::string &filename,
643  const std::string &file_content,
644  const MPI_Comm comm);
645 
659  int
660  mkdirp(std::string pathname, const mode_t mode = 0755);
661 
672  void create_directory(const std::string &pathname,
673  const MPI_Comm comm,
674  bool silent);
675 
680  namespace tk
681  {
685  class spline
686  {
687  public:
697  void set_points(const std::vector<double> &x,
698  const std::vector<double> &y,
699  const bool cubic_spline = true,
700  const bool monotone_spline = false);
704  double operator() (double x) const;
705 
706  private:
710  std::vector<double> m_x;
711 
718  std::vector<double> m_a, m_b, m_c, m_y;
719  };
720  }
721 
729  inline
730  void
731  extract_composition_values_at_q_point (const std::vector<std::vector<double>> &composition_values,
732  const unsigned int q,
733  std::vector<double> &composition_values_at_q_point);
734 
739  std::string
740  expand_ASPECT_SOURCE_DIR (const std::string &location);
741 
746  std::string parenthesize_if_nonempty (const std::string &s);
747 
751  bool
752  string_to_bool(const std::string &s);
753 
757  std::vector<bool>
758  string_to_bool(const std::vector<std::string> &s);
759 
763  unsigned int
764  string_to_unsigned_int(const std::string &s);
765 
769  std::vector<unsigned int>
770  string_to_unsigned_int(const std::vector<std::string> &s);
771 
776  bool has_unique_entries (const std::vector<std::string> &strings);
777 
778 
779 
801  double weighted_p_norm_average (const std::vector<double> &weights,
802  const std::vector<double> &values,
803  const double p);
804 
805 
831  template <typename T>
832  T derivative_of_weighted_p_norm_average (const double averaged_parameter,
833  const std::vector<double> &weights,
834  const std::vector<double> &values,
835  const std::vector<T> &derivatives,
836  const double p);
868  template <int dim>
869  double compute_spd_factor(const double eta,
870  const SymmetricTensor<2,dim> &strain_rate,
871  const SymmetricTensor<2,dim> &dviscosities_dstrain_rate,
872  const double SPD_safety_factor);
873 
877  template <int dim>
878  Point<dim> convert_array_to_point(const std::array<double,dim> &array);
879 
883  template <int dim>
884  std::array<double,dim> convert_point_to_array(const Point<dim> &point);
885 
893  class Operator
894  {
895  public:
900  {
906  replace_if_valid
907  };
908 
913  Operator();
914 
918  Operator(const operation op);
919 
924  double operator() (const double x, const double y) const;
925 
930  bool operator== (const operation op) const;
931 
932  private:
937  };
938 
943  std::vector<Operator> create_model_operator_list(const std::vector<std::string> &operator_names);
944 
948  const std::string get_model_operator_options();
949 
955  template <int dim>
956  SymmetricTensor<2,dim> nth_basis_for_symmetric_tensors (const unsigned int k);
957 
961  template <int dim>
963  {
964  public:
968  NaturalCoordinate(Point<dim> &position,
969  const GeometryModel::Interface<dim> &geometry_model);
970 
975  NaturalCoordinate(const std::array<double, dim> &coord,
976  const Utilities::Coordinates::CoordinateSystem &coord_system);
977 
982  std::array<double,dim> &get_coordinates();
983 
988  const std::array<double,dim> &get_coordinates() const;
989 
994  std::array<double,dim-1> get_surface_coordinates() const;
995 
1000  double get_depth_coordinate() const;
1001 
1002  private:
1008 
1012  std::array<double,dim> coordinates;
1013  };
1014 
1015 
1034  template <int dim, typename VectorType>
1035  void
1036  project_cellwise(const Mapping<dim> &mapping,
1037  const DoFHandler<dim> &dof_handler,
1038  const unsigned int component_index,
1039  const Quadrature<dim> &quadrature,
1040  const std::function<void(
1041  const typename DoFHandler<dim>::active_cell_iterator &,
1042  const std::vector<Point<dim>> &,
1043  std::vector<double> &)> &function,
1044  VectorType &vec_result);
1045 
1069  void throw_linear_solver_failure_exception(const std::string &solver_name,
1070  const std::string &function_name,
1071  const std::vector<SolverControl> &solver_controls,
1072  const std::exception &exc,
1073  const MPI_Comm mpi_communicator,
1074  const std::string &output_filename = "");
1075 
1083  template <int dim>
1085  {
1086  public:
1096  VectorFunctionFromVelocityFunctionObject (const unsigned int n_components,
1097  const std::function<Tensor<1,dim> (const Point<dim> &)> &function_object);
1098 
1106  double value (const Point<dim> &p,
1107  const unsigned int component = 0) const override;
1108 
1118  void vector_value (const Point<dim> &p,
1119  Vector<double> &values) const override;
1120 
1121  private:
1126  const std::function<Tensor<1,dim> (const Point<dim> &)> function_object;
1127  };
1128 
1135  template <typename T>
1136  inline
1137  std::vector<std::size_t>
1138  compute_sorting_permutation(const std::vector<T> &vector);
1139 
1147  template <typename T>
1148  inline
1149  std::vector<T>
1151  const std::vector<T> &vector,
1152  const std::vector<std::size_t> &permutation_vector);
1153 
1166  std::vector<Tensor<2,3>>
1167  rotation_matrices_random_draw_volume_weighting(const std::vector<double> &volume_fractions,
1168  const std::vector<Tensor<2,3>> &rotation_matrices,
1169  const unsigned int n_output_matrices,
1170  std::mt19937 &random_number_generator);
1171 
1175  double wrap_angle(const double angle);
1176 
1181  std::array<double,3> zxz_euler_angles_from_rotation_matrix(const Tensor<2,3> &rotation_matrix);
1182 
1187  Tensor<2,3> zxz_euler_angles_to_rotation_matrix(const double phi1,
1188  const double theta,
1189  const double phi2);
1190 
1191  }
1192 }
1193 
1194 
1195 // inline implementations:
1196 #ifndef DOXYGEN
1197 namespace aspect
1198 {
1199  namespace Utilities
1200  {
1201 
1202  template <typename T>
1203  inline
1204  std::vector<T>
1205  possibly_extend_from_1_to_N (const std::vector<T> &values,
1206  const unsigned int N,
1207  const std::string &id_text)
1208  {
1209  if (values.size() == 1)
1210  {
1211  return std::vector<T> (N, values[0]);
1212  }
1213  else if (values.size() == N)
1214  {
1215  return values;
1216  }
1217  else
1218  {
1219  // Non-specified behavior
1220  AssertThrow(false,
1221  ExcMessage("Length of " + id_text + " list must be " +
1222  "either one or " + Utilities::to_string(N) +
1223  ". Currently it is " + Utilities::to_string(values.size()) + "."));
1224  }
1225 
1226  // This should never happen, but return an empty vector so the compiler
1227  // will be happy
1228  return std::vector<T> ();
1229  }
1230 
1231  inline
1232  void
1233  extract_composition_values_at_q_point (const std::vector<std::vector<double>> &composition_values,
1234  const unsigned int q,
1235  std::vector<double> &composition_values_at_q_point)
1236  {
1237  Assert(q<composition_values.size(), ExcInternalError());
1238  Assert(composition_values_at_q_point.size() > 0,
1239  ExcInternalError());
1240 
1241  for (unsigned int k=0; k < composition_values_at_q_point.size(); ++k)
1242  {
1243  Assert(composition_values[k].size() == composition_values_at_q_point.size(),
1244  ExcInternalError());
1245  composition_values_at_q_point[k] = composition_values[k][q];
1246  }
1247  }
1248 
1249  template <typename T>
1250  inline
1251  std::vector<std::size_t>
1252  compute_sorting_permutation(const std::vector<T> &vector)
1253  {
1254  std::vector<std::size_t> p(vector.size());
1255  std::iota(p.begin(), p.end(), 0);
1256  std::sort(p.begin(), p.end(),
1257  [&](std::size_t i, std::size_t j)
1258  {
1259  return vector[i] < vector[j];
1260  });
1261  return p;
1262  }
1263 
1264  template <typename T>
1265  inline
1266  std::vector<T>
1268  const std::vector<T> &vector,
1269  const std::vector<std::size_t> &permutation_vector)
1270  {
1271  std::vector<T> sorted_vec(vector.size());
1272  std::transform(permutation_vector.begin(), permutation_vector.end(), sorted_vec.begin(),
1273  [&](std::size_t i)
1274  {
1275  return vector[i];
1276  });
1277  return sorted_vec;
1278  }
1279 
1283  namespace Tensors
1284  {
1290  template <int dim, class Iterator>
1291  inline
1292  SymmetricTensor<2,dim>
1293  to_symmetric_tensor(const Iterator begin,
1294  const Iterator end)
1295  {
1296  AssertDimension(std::distance(begin, end), (SymmetricTensor<2,dim>::n_independent_components));
1297  (void) end;
1298 
1299  SymmetricTensor<2,dim> output;
1300 
1301  Iterator next = begin;
1302  for (unsigned int i=0; i < SymmetricTensor<2,dim>::n_independent_components; ++i, ++next)
1303  output[SymmetricTensor<2,dim>::unrolled_to_component_indices(i)] = *next;
1304 
1305  return output;
1306  }
1307 
1312  template <int dim, class Iterator>
1313  inline
1314  void
1315  unroll_symmetric_tensor_into_array(const SymmetricTensor<2,dim> &tensor,
1316  const Iterator begin,
1317  const Iterator end)
1318  {
1319  AssertDimension(std::distance(begin, end), (SymmetricTensor<2,dim>::n_independent_components));
1320  (void) end;
1321 
1322  Iterator next = begin;
1323  for (unsigned int i=0; i < SymmetricTensor<2,dim>::n_independent_components; ++i, ++next)
1324  *next = tensor[SymmetricTensor<2,dim>::unrolled_to_component_indices(i)];
1325  }
1326 
1330  SymmetricTensor<4,3>
1331  rotate_full_stiffness_tensor(const Tensor<2,3> &rotation_tensor, const SymmetricTensor<4,3> &input_tensor);
1332 
1337  SymmetricTensor<2,6>
1338  rotate_voigt_stiffness_matrix(const Tensor<2,3> &rotation_tensor, const SymmetricTensor<2,6> &input_tensor);
1339 
1344  SymmetricTensor<2,6>
1345  to_voigt_stiffness_matrix(const SymmetricTensor<4,3> &input_tensor);
1346 
1351  SymmetricTensor<4,3>
1352  to_full_stiffness_tensor(const SymmetricTensor<2,6> &input_tensor);
1353 
1358  Tensor<1,21>
1359  to_voigt_stiffness_vector(const SymmetricTensor<2,6> &input_tensor);
1360 
1365  SymmetricTensor<2,6>
1366  to_voigt_stiffness_matrix(const Tensor<1,21> &input_tensor);
1367 
1372  Tensor<1,21>
1373  to_voigt_stiffness_vector(const SymmetricTensor<4,3> &input);
1374 
1375 
1380  template <int dim>
1381  const Tensor<dim,dim> &levi_civita();
1382 
1383  // Declare the existence of a specialization:
1384  template <>
1385  const Tensor<3,3> &levi_civita<3>();
1386  }
1387 
1388  }
1389 }
1390 #endif
1391 
1392 #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:718
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:1012
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:710
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:1007
::Point< dim > spherical_to_cartesian_coordinates(const std::array< double, dim > &scoord)
std::string do_grouping() const override
Definition: utilities.h:562
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)
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)
void create_directory(const std::string &pathname, const MPI_Comm comm, bool silent)
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)
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:557
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)