5#include <core/revision.h>
9#include <deal.II/base/mpi.h>
10#include <deal.II/base/revision.h>
12#include <deal.II/numerics/vector_tools.h>
14#include <boost/algorithm/string/replace.hpp>
19#include <system_error>
25 const std::vector<T> &independent_values,
26 const std::string &independent_column_name,
27 const std::vector<std::vector<double>> &dependent_vector,
28 const std::vector<std::string> &dependent_column_names,
29 const unsigned int display_precision,
30 const bool display_scientific_notation)
32 AssertDimension(independent_values.size(), dependent_vector.size());
36 for (
unsigned int i = 0; i < independent_values.size(); ++i)
38 table.add_value(independent_column_name, independent_values[i]);
39 for (
unsigned int d = 0; d < dependent_column_names.size(); ++d)
40 table.add_value(dependent_column_names[d], dependent_vector[i][d]);
43 table.set_precision(independent_column_name, display_precision);
44 for (
const auto &name : dependent_column_names)
45 table.set_precision(name, display_precision);
47 if (display_scientific_notation)
49 table.set_scientific(independent_column_name,
true);
50 for (
const auto &name : dependent_column_names)
51 table.set_scientific(name,
true);
57template <
int dim,
typename T>
60 const std::vector<T> &independent_vector,
61 const std::string &independent_column_name,
62 const std::vector<Tensor<1, dim>> &dependent_vector,
63 const std::vector<std::string> &dependent_column_names,
64 const unsigned int display_precision,
65 const bool display_scientific_notation)
67 AssertDimension(independent_vector.size(), dependent_vector.size());
68 AssertDimension(dependent_column_names.size(), dim);
72 for (
unsigned int i = 0; i < dependent_vector.size(); ++i)
74 table.add_value(independent_column_name, independent_vector[i]);
75 for (
int d = 0; d < dim; ++d)
76 table.add_value(dependent_column_names[d], dependent_vector[i][d]);
79 for (
int d = 0; d < dim; ++d)
80 table.set_precision(dependent_column_names[d], display_precision);
82 if constexpr (!std::is_integral_v<T>)
83 table.set_precision(independent_column_name, display_precision);
85 if (display_scientific_notation)
87 if constexpr (!std::is_integral_v<T>)
88 table.set_scientific(independent_column_name,
true);
89 for (
int d = 0; d < dim; ++d)
90 table.set_scientific(dependent_column_names[d],
true);
96template <
int dim,
typename T>
99 const std::vector<T> &independent_vector,
100 const std::string &independent_column_name,
101 const std::vector<std::vector<Tensor<1, dim>>> &dependent_vectors,
102 const std::vector<std::string> &dependent_column_names,
103 const unsigned int display_precision,
104 const bool display_scientific_notation)
106 AssertDimension(dependent_column_names.size(),
107 dependent_vectors.size() * dim);
110 unsigned int vect_index = 0;
112 for (
unsigned int i = 0; i < dependent_vectors[0].size(); ++i)
113 table.add_value(independent_column_name, independent_vector[i]);
115 for (
auto &vect : dependent_vectors)
117 AssertDimension(independent_vector.size(), vect.size());
118 for (
unsigned int i = 0; i < vect.size(); ++i)
120 for (
int d = 0; d < dim; ++d)
122 table.add_value(dependent_column_names[d + vect_index],
124 table.set_precision(dependent_column_names[d + vect_index],
126 if (display_scientific_notation)
127 table.set_scientific(dependent_column_names[d + vect_index],
134 if constexpr (!std::is_integral_v<T>)
136 table.set_precision(independent_column_name, display_precision);
137 if (display_scientific_notation)
138 table.set_scientific(independent_column_name,
true);
148 const std::vector<Tensor<1, dim>> &independent_vector,
149 const std::vector<std::string> &independent_column_names,
150 const std::vector<Tensor<1, dim>> &dependent_vector,
151 const std::vector<std::string> &dependent_column_names,
152 const unsigned int display_precision,
153 const bool display_scientific_notation)
155 AssertDimension(independent_vector.size(), dependent_vector.size());
156 AssertDimension(independent_column_names.size(), dim);
157 AssertDimension(dependent_column_names.size(), dim);
161 for (
unsigned int i = 0; i < dependent_vector.size(); ++i)
163 for (
int d = 0; d < dim; ++d)
165 table.add_value(independent_column_names[d],
166 independent_vector[i][d]);
167 table.add_value(dependent_column_names[d], dependent_vector[i][d]);
171 for (
int d = 0; d < dim; ++d)
173 table.set_precision(independent_column_names[d], display_precision);
174 table.set_precision(dependent_column_names[d], display_precision);
177 if (display_scientific_notation)
178 for (
int d = 0; d < dim; ++d)
180 table.set_scientific(independent_column_names[d],
true);
181 table.set_scientific(dependent_column_names[d],
true);
190 const std::vector<Tensor<1, dim>> &independent_vector,
191 const std::vector<std::string> &independent_column_names,
192 const std::vector<double> &dependent_vector,
193 const std::string &dependent_column_name,
194 const unsigned int display_precision,
195 const bool display_scientific_notation)
197 AssertDimension(independent_vector.size(), dependent_vector.size());
198 AssertDimension(independent_column_names.size(), dim);
203 for (
unsigned int i = 0; i < dependent_vector.size(); ++i)
205 table.add_value(dependent_column_name, dependent_vector[i]);
206 for (
int d = 0; d < dim; ++d)
207 table.add_value(independent_column_names[d], independent_vector[i][d]);
210 table.set_precision(dependent_column_name, display_precision);
211 for (
int d = 0; d < dim; ++d)
212 table.set_precision(independent_column_names[d], display_precision);
214 if (display_scientific_notation)
216 table.set_scientific(dependent_column_name,
true);
217 for (
int d = 0; d < dim; ++d)
218 table.set_scientific(independent_column_names[d],
true);
226 const std::string &file_description)
228 AssertThrow(!file_name.empty(), EmptyFileName(file_description));
234 std::error_code error_code;
235 const std::filesystem::path path(file_name);
237 AssertThrow(std::filesystem::exists(path, error_code),
238 FileDoesNotExist(file_name, file_description));
243 AssertThrow(!std::filesystem::is_directory(path, error_code),
244 FileIsNotReadable(file_name, file_description));
248 const std::ifstream file(file_name);
249 AssertThrow(file.good(), FileIsNotReadable(file_name, file_description));
254 const std::string &file_name,
255 const std::string &delimiter)
259 std::ifstream myfile(file_name);
262 std::vector<std::string> vector_of_column_names;
263 std::vector<double> line_of_data;
264 unsigned int line_count = 0;
266 while (std::getline(myfile, line))
269 std::vector<std::string> list_of_words_base =
270 Utilities::split_string_list(line, delimiter);
271 std::vector<std::string> list_of_words_clean;
272 for (
const auto &word : list_of_words_base)
276 list_of_words_clean.emplace_back(word);
282 line_of_data = Utilities::string_to_double(list_of_words_clean);
283 for (
unsigned int i = 0; i < line_of_data.size(); ++i)
285 table.add_value(vector_of_column_names[i], line_of_data[i]);
291 vector_of_column_names = list_of_words_clean;
300 const std::string &file,
301 const std::string &delimiter)
306 std::ifstream myfile(file);
309 std::vector<std::string> column_names;
310 std::vector<double> line_of_data;
311 unsigned int line_count = 0;
313 while (std::getline(myfile, line))
316 std::vector<std::string> list_of_words_base =
317 Utilities::split_string_list(line, delimiter);
318 std::vector<std::string> list_of_words_clean;
319 for (
const auto &word : list_of_words_base)
323 list_of_words_clean.emplace_back(word);
329 line_of_data = Utilities::string_to_double(list_of_words_clean);
330 for (
unsigned int i = 0; i < line_of_data.size(); ++i)
332 map[column_names[i]].emplace_back(line_of_data[i]);
339 column_names = list_of_words_clean;
340 for (
unsigned int i = 0; i < list_of_words_clean.size(); ++i)
342 std::vector<double> base_vector;
343 map[column_names[i]] = base_vector;
353 std::map<std::string, std::vector<std::string>> &map,
354 const std::string &file,
355 const std::string &delimiter)
358 std::ifstream myfile(file);
361 std::vector<std::string> column_names;
362 std::vector<std::string> line_of_data;
363 unsigned int line_count = 0;
365 while (std::getline(myfile, line))
368 std::vector<std::string> list_of_words_base =
369 Utilities::split_string_list(line, delimiter);
370 std::vector<std::string> list_of_words_clean;
371 for (
const auto &word : list_of_words_base)
374 list_of_words_clean.emplace_back(word);
380 line_of_data = list_of_words_clean;
381 for (
unsigned int i = 0; i < line_of_data.size(); ++i)
383 map[column_names[i]].emplace_back(line_of_data[i]);
388 column_names = list_of_words_clean;
389 for (
unsigned int i = 0; i < list_of_words_clean.size(); ++i)
391 std::vector<std::string> base_vector;
392 map[column_names[i]] = base_vector;
403 std::filesystem::create_directories(dirname);
409 std::filesystem::remove_all(dirname);
414 const std::vector<double> &independent_values,
415 const std::string &independent_column_name,
416 const std::vector<std::vector<double>> &dependent_vector,
417 const std::vector<std::string> &dependent_column_names,
418 const unsigned int display_precision,
419 const bool display_scientific_notation);
423 const std::vector<unsigned int> &independent_values,
424 const std::string &independent_column_name,
425 const std::vector<std::vector<double>> &dependent_vector,
426 const std::vector<std::string> &dependent_column_names,
427 const unsigned int display_precision,
428 const bool display_scientific_notation);
432 const std::vector<int> &independent_values,
433 const std::string &independent_column_name,
434 const std::vector<std::vector<double>> &dependent_vector,
435 const std::vector<std::string> &dependent_column_names,
436 const unsigned int display_precision,
437 const bool display_scientific_notation);
441 const std::vector<double> &independent_values,
442 const std::string &independent_column_name,
443 const std::vector<Tensor<1, 2>> &dependent_vector,
444 const std::vector<std::string> &dependent_column_names,
445 const unsigned int display_precision,
446 const bool display_scientific_notation);
450 const std::vector<double> &independent_values,
451 const std::string &independent_column_name,
452 const std::vector<Tensor<1, 3>> &dependent_vector,
453 const std::vector<std::string> &dependent_column_names,
454 const unsigned int display_precision,
455 const bool display_scientific_notation);
459 const std::vector<double> &independent_values,
460 const std::string &independent_column_name,
461 const std::vector<std::vector<Tensor<1, 2>>> &dependent_vector,
462 const std::vector<std::string> &dependent_column_names,
463 const unsigned int display_precision,
464 const bool display_scientific_notation);
468 const std::vector<double> &independent_values,
469 const std::string &independent_column_name,
470 const std::vector<std::vector<Tensor<1, 3>>> &dependent_vector,
471 const std::vector<std::string> &dependent_column_names,
472 const unsigned int display_precision,
473 const bool display_scientific_notation);
477 const std::vector<unsigned int> &independent_values,
478 const std::string &independent_column_name,
479 const std::vector<Tensor<1, 2>> &dependent_vector,
480 const std::vector<std::string> &dependent_column_names,
481 const unsigned int display_precision,
482 const bool display_scientific_notation);
486 const std::vector<unsigned int> &independent_values,
487 const std::string &independent_column_name,
488 const std::vector<Tensor<1, 3>> &dependent_vector,
489 const std::vector<std::string> &dependent_column_names,
490 const unsigned int display_precision,
491 const bool display_scientific_notation);
495 const std::vector<unsigned int> &independent_values,
496 const std::string &independent_column_name,
497 const std::vector<std::vector<Tensor<1, 2>>> &dependent_vector,
498 const std::vector<std::string> &dependent_column_names,
499 const unsigned int display_precision,
500 const bool display_scientific_notation);
504 const std::vector<unsigned int> &independent_values,
505 const std::string &independent_column_name,
506 const std::vector<std::vector<Tensor<1, 3>>> &dependent_vector,
507 const std::vector<std::string> &dependent_column_names,
508 const unsigned int display_precision,
509 const bool display_scientific_notation);
513 const std::vector<int> &independent_values,
514 const std::string &independent_column_name,
515 const std::vector<Tensor<1, 2>> &dependent_vector,
516 const std::vector<std::string> &dependent_column_names,
517 const unsigned int display_precision,
518 const bool display_scientific_notation);
522 const std::vector<int> &independent_values,
523 const std::string &independent_column_name,
524 const std::vector<Tensor<1, 3>> &dependent_vector,
525 const std::vector<std::string> &dependent_column_names,
526 const unsigned int display_precision,
527 const bool display_scientific_notation);
531 const std::vector<int> &independent_values,
532 const std::string &independent_column_name,
533 const std::vector<std::vector<Tensor<1, 2>>> &dependent_vector,
534 const std::vector<std::string> &dependent_column_names,
535 const unsigned int display_precision,
536 const bool display_scientific_notation);
540 const std::vector<int> &independent_values,
541 const std::string &independent_column_name,
542 const std::vector<std::vector<Tensor<1, 3>>> &dependent_vector,
543 const std::vector<std::string> &dependent_column_names,
544 const unsigned int display_precision,
545 const bool display_scientific_notation);
549 const std::vector<Tensor<1, 2>> &independent_values,
550 const std::vector<std::string> &independent_column_names,
551 const std::vector<Tensor<1, 2>> &dependent_vector,
552 const std::vector<std::string> &dependent_column_names,
553 const unsigned int display_precision,
554 const bool display_scientific_notation);
558 const std::vector<Tensor<1, 3>> &independent_values,
559 const std::vector<std::string> &independent_column_names,
560 const std::vector<Tensor<1, 3>> &dependent_vector,
561 const std::vector<std::string> &dependent_column_names,
562 const unsigned int display_precision,
563 const bool display_scientific_notation);
567 const std::vector<Tensor<1, 2>> &independent_vector,
568 const std::vector<std::string> &independent_column_names,
569 const std::vector<double> &dependent_values,
570 const std::string &dependent_column_name,
571 const unsigned int display_precision,
572 const bool display_scientific_notation);
576 const std::vector<Tensor<1, 3>> &independent_vector,
577 const std::vector<std::string> &independent_column_names,
578 const std::vector<double> &dependent_values,
579 const std::string &dependent_column_name,
580 const unsigned int display_precision,
581 const bool display_scientific_notation);
586 const std::string ¶meter_name)
590 std::string return_value;
591 std::ifstream x_file(file_name);
599 std::getline(x_file, line);
601 while ((line.size() > 0) && (line[0] ==
' ' || line[0] ==
'\t'))
603 while ((line.size() > 0) &&
604 (line[line.size() - 1] ==
' ' || line[line.size() - 1] ==
'\t'))
605 line.erase(line.size() - 1, std::string::npos);
607 std::match_results<std::string::const_iterator> matches;
608 const std::string regex =
609 "set[ \t]+" + parameter_name +
"[ \t]*=[ \t]*(.*)";
610 if (std::regex_match(line, matches, std::regex(regex)))
615 Assert(matches.size() == 2, dealii::ExcInternalError());
616 return_value = std::string(matches[1].first, matches[1].second);
626 const std::string ¶meter_name)
630 std::string return_string;
631 int return_value = -100000;
633 std::ifstream x_file(file_name);
641 std::getline(x_file, line);
643 while ((line.size() > 0) && (line[0] ==
' ' || line[0] ==
'\t'))
645 while ((line.size() > 0) &&
646 (line[line.size() - 1] ==
' ' || line[line.size() - 1] ==
'\t'))
647 line.erase(line.size() - 1, std::string::npos);
649 std::match_results<std::string::const_iterator> matches;
650 const std::string regex =
651 "set[ \t]+" + parameter_name +
"[ \t]*=[ \t]*(.*)";
652 if (std::regex_match(line, matches, std::regex(regex)))
657 Assert(matches.size() == 2, dealii::ExcInternalError());
658 return_string = std::string(matches[1].first, matches[1].second);
660 std::max(return_value, Utilities::string_to_int(return_string));
672 const std::string dimension =
675 if (dimension.size() > 0)
700 dimension.find(
'\r') == std::string::npos,
702 "It appears that your input file uses Windows-style "
703 "line endings ('\\r\\n') but you are running on a system where "
704 "the C++ run time environment expects input files to have "
705 "Unix-style line endings ('\\n'). You need to convert your "
706 "input file to use the correct line endings before running "
710 return dealii::Utilities::string_to_int(dimension);
716 "While reading the dimension from the input file, "
717 "Lethe found a string that can not be converted to "
728 "While reading the dimension from the input file, "
729 "Lethe found a value that is neither 2 or 3. Since August 2023, "
730 "Lethe requires that the user explicitly specify the dimension of the problem within the parameter file. This can be achieved by adding set dimension = 2 or set dimension = 3 within the parameter file"));
737 const bool require_subsection_size)
739 int max_number_of_boundary_conditions =
743 !require_subsection_size || max_number_of_boundary_conditions >= 0,
745 "Your parameter file does not contain any indication for the number of boundary conditions for any physics supported by Lethe. Since November 2023, Lethe requires that a \"boundary conditions\" subsection is present with at least \"number=0\" "));
747 return std::max(max_number_of_boundary_conditions, 0);
760 std::string result = std::string(argv[0]);
762 for (
int i = 1; i < argc; ++i)
763 result = result +
" " + std::string(argv[i]);
780 std::string lethe_tag = LETHE_GIT_FANCY_TAG;
781 std::string dealii_tag = DEAL_II_GIT_FANCY_TAG;
784 pcout <<
"lethe/" << lethe_tag.erase(0, 1) <<
" deal.II/"
785 << dealii_tag.erase(0, 1) << std::endl;
799std::tuple<std::map<std::string, bool>, std::vector<std::string>>
803 std::map<std::string, bool> options{};
804 for (; argi < argc; ++argi)
806 std::string arg{argv[argi]};
807 auto n{arg.length()};
808 if (n == 0 || arg[0] !=
'-' || n == 1)
814 for (
decltype(n) i = 1; i < n; ++i)
816 options[std::string{
'-'} + std::string{arg[i]}] =
true;
829 std::vector<std::string> args{};
830 for (; argi < argc; ++argi)
832 std::string arg{argv[argi]};
835 return {options, args};
840 const std::string &deprecated_value,
841 const std::string &new_value)
846 const bool is_first_process =
847 !Utilities::MPI::job_supports_mpi() ||
848 Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0;
849 const ConditionalOStream pcout(std::cout, is_first_process);
851 pcout <<
"Warning: the value \"" << deprecated_value
852 <<
"\" of the parameter \"" << parameter_name
853 <<
"\" is deprecated and will be removed. Use \"" << new_value
854 <<
"\" instead." << std::endl;
866 const ParameterHandler &prm,
867 const std::string &file_name)
869 const std::string print_parameters =
872 if (print_parameters ==
"only changed")
874 prm.print_parameters(pcout.get_stream(),
875 ParameterHandler::OutputStyle::PRM |
876 ParameterHandler::OutputStyle::Short |
877 ParameterHandler::KeepDeclarationOrder |
878 ParameterHandler::KeepOnlyChanged);
879 pcout << std::endl << std::endl;
881 else if (print_parameters ==
"all")
883 prm.print_parameters(pcout.get_stream(),
884 ParameterHandler::OutputStyle::PRM |
885 ParameterHandler::OutputStyle::Short |
886 ParameterHandler::KeepDeclarationOrder);
887 pcout << std::endl << std::endl;
894 boost::replace_all(s,
"\\n",
"\n");
895 boost::replace_all(s,
"\\t",
"\t");
896 boost::replace_all(s,
"\\r",
"\r");
897 boost::replace_all(s,
"\\b",
"\b");
898 boost::replace_all(s,
"\\v",
"\v");
903 ParameterHandler &prm)
905 std::string comment_string = prm.get(
"comment message");
908 if (!comment_string.empty())
910 pcout <<
"Comment message: " << std::endl;
911 pcout << comment_string << std::endl;
912 pcout << std::endl << std::endl;
919 for (
auto const &filename : std::filesystem::directory_iterator{output_path})
921 if (filename.path().extension() ==
".vtu" ||
922 filename.path().extension() ==
".pvd" ||
923 filename.path().extension() ==
".pvtu")
924 std::filesystem::remove(filename.path());
928template <
int dim,
typename VectorType>
931 const Mapping<dim> &mapping,
932 const DoFHandler<dim> &dof_handler,
934 const std::vector<Point<dim>> &evaluation_points,
935 Utilities::MPI::RemotePointEvaluation<dim> &remote_point_evaluator,
936 std::vector<double> &evaluated_scalar_values,
937 const unsigned int first_selected_component)
940 if (Utilities::MPI::n_mpi_processes(dof_handler.get_mpi_communicator()) > 1)
941 AssertThrow(solution_field.has_ghost_elements(),
942 GhostElementsRequired(
"evaluate_values_at_points"));
945 if (!remote_point_evaluator.is_ready())
946 remote_point_evaluator.reinit(evaluation_points,
947 dof_handler.get_triangulation(),
953 evaluated_scalar_values = VectorTools::point_values<1>(
958 remote_point_evaluator,
959 VectorTools::EvaluationFlags::EvaluationFlags::avg,
960 first_selected_component);
965 const Mapping<2> &mapping,
966 const DoFHandler<2> &dof_handler,
968 const std::vector<Point<2>> &evaluation_points,
969 Utilities::MPI::RemotePointEvaluation<2> &remote_point_evaluator,
970 std::vector<double> &evaluated_scalar_values,
971 const unsigned int first_selected_component);
975 const Mapping<3> &mapping,
976 const DoFHandler<3> &dof_handler,
978 const std::vector<Point<3>> &evaluation_points,
979 Utilities::MPI::RemotePointEvaluation<3> &remote_point_evaluator,
980 std::vector<double> &evaluated_scalar_values,
981 const unsigned int first_selected_component);
985 const Mapping<2> &mapping,
986 const DoFHandler<2> &dof_handler,
988 const std::vector<Point<2>> &evaluation_points,
989 Utilities::MPI::RemotePointEvaluation<2> &remote_point_evaluator,
990 std::vector<double> &evaluated_scalar_values,
991 const unsigned int first_selected_component);
995 const Mapping<3> &mapping,
996 const DoFHandler<3> &dof_handler,
998 const std::vector<Point<3>> &evaluation_points,
999 Utilities::MPI::RemotePointEvaluation<3> &remote_point_evaluator,
1000 std::vector<double> &evaluated_scalar_values,
1001 const unsigned int first_selected_component);
1003#ifndef LETHE_USE_LDV
1006 const Mapping<2> &mapping,
1007 const DoFHandler<2> &dof_handler,
1008 const LinearAlgebra::distributed::Vector<double> &solution_field,
1009 const std::vector<Point<2>> &evaluation_points,
1010 Utilities::MPI::RemotePointEvaluation<2> &remote_point_evaluator,
1011 std::vector<double> &evaluated_scalar_values,
1012 const unsigned int first_selected_component);
1016 const Mapping<3> &mapping,
1017 const DoFHandler<3> &dof_handler,
1018 const LinearAlgebra::distributed::Vector<double> &solution_field,
1019 const std::vector<Point<3>> &evaluation_points,
1020 Utilities::MPI::RemotePointEvaluation<3> &remote_point_evaluator,
1021 std::vector<double> &evaluated_scalar_values,
1022 const unsigned int first_selected_component);
1025template <
int n_component,
int dim,
typename VectorType>
1028 const Mapping<dim> &mapping,
1029 const DoFHandler<dim> &dof_handler,
1031 const std::vector<Point<dim>> &evaluation_points,
1032 Utilities::MPI::RemotePointEvaluation<dim> &remote_point_evaluator,
1033 std::vector<Tensor<1, dim, double>> &evaluated_vector_values,
1034 const unsigned int first_selected_component)
1037 if (Utilities::MPI::n_mpi_processes(dof_handler.get_mpi_communicator()) > 1)
1038 AssertThrow(solution_field.has_ghost_elements(),
1039 GhostElementsRequired(
"evaluate_values_at_points"));
1042 if (!remote_point_evaluator.is_ready())
1043 remote_point_evaluator.reinit(evaluation_points,
1044 dof_handler.get_triangulation(),
1049 evaluated_vector_values = VectorTools::point_values<n_component>(
1054 remote_point_evaluator,
1055 VectorTools::EvaluationFlags::EvaluationFlags::avg,
1056 first_selected_component);
1061 const Mapping<2> &mapping,
1062 const DoFHandler<2> &dof_handler,
1064 const std::vector<Point<2>> &evaluation_points,
1065 Utilities::MPI::RemotePointEvaluation<2> &remote_point_evaluator,
1066 std::vector<Tensor<1, 2, double>> &evaluated_vector_values,
1067 const unsigned int first_selected_component);
1071 const Mapping<3> &mapping,
1072 const DoFHandler<3> &dof_handler,
1074 const std::vector<Point<3>> &evaluation_points,
1075 Utilities::MPI::RemotePointEvaluation<3> &remote_point_evaluator,
1076 std::vector<Tensor<1, 3, double>> &evaluated_vector_values,
1077 const unsigned int first_selected_component);
1081 const Mapping<2> &mapping,
1082 const DoFHandler<2> &dof_handler,
1084 const std::vector<Point<2>> &evaluation_points,
1085 Utilities::MPI::RemotePointEvaluation<2> &remote_point_evaluator,
1086 std::vector<Tensor<1, 2, double>> &evaluated_vector_values,
1087 const unsigned int first_selected_component);
1091 const Mapping<3> &mapping,
1092 const DoFHandler<3> &dof_handler,
1094 const std::vector<Point<3>> &evaluation_points,
1095 Utilities::MPI::RemotePointEvaluation<3> &remote_point_evaluator,
1096 std::vector<Tensor<1, 3, double>> &evaluated_vector_values,
1097 const unsigned int first_selected_component);
1099#ifndef LETHE_USE_LDV
1102 const Mapping<2> &mapping,
1103 const DoFHandler<2> &dof_handler,
1104 const LinearAlgebra::distributed::Vector<double> &solution_field,
1105 const std::vector<Point<2>> &evaluation_points,
1106 Utilities::MPI::RemotePointEvaluation<2> &remote_point_evaluator,
1107 std::vector<Tensor<1, 2, double>> &evaluated_vector_values,
1108 const unsigned int first_selected_component);
1112 const Mapping<3> &mapping,
1113 const DoFHandler<3> &dof_handler,
1114 const LinearAlgebra::distributed::Vector<double> &solution_field,
1115 const std::vector<Point<3>> &evaluation_points,
1116 Utilities::MPI::RemotePointEvaluation<3> &remote_point_evaluator,
1117 std::vector<Tensor<1, 3, double>> &evaluated_vector_values,
1118 const unsigned int first_selected_component);
void evaluate_values_at_points(const Mapping< dim > &mapping, const DoFHandler< dim > &dof_handler, const VectorType &solution_field, const std::vector< Point< dim > > &evaluation_points, Utilities::MPI::RemotePointEvaluation< dim > &remote_point_evaluator, std::vector< double > &evaluated_scalar_values, const unsigned int first_selected_component=0)
Evaluates the values of a scalar field at remote points of the domain from the mapping,...
bool points_are_in_domain(const std::vector< Point< dim > > &evaluation_points, const Utilities::MPI::RemotePointEvaluation< dim, dim > &remote_point_evaluator)
Checks that the evaluation points are within the simulated domain and returns true if all points are ...
Common exception declarations shared across multiple solvers in Lethe.
GlobalVectorType VectorType
TableHandler make_table_scalars_vectors(const std::vector< T > &independent_values, const std::string &independent_column_name, const std::vector< std::vector< double > > &dependent_vector, const std::vector< std::string > &dependent_column_names, const unsigned int display_precision, const bool display_scientific_notation)
Generate a table from a vector of scalars (independent variable) and a vector of vectors of scalars (...
template void evaluate_values_at_points< 3, GlobalVectorType >(const Mapping< 3 > &mapping, const DoFHandler< 3 > &dof_handler, const GlobalVectorType &solution_field, const std::vector< Point< 3 > > &evaluation_points, Utilities::MPI::RemotePointEvaluation< 3 > &remote_point_evaluator, std::vector< double > &evaluated_scalar_values, const unsigned int first_selected_component)
void check_file_exists(const std::string &file_name, const std::string &file_description)
Verify that a file that Lethe must read exists and can be opened, and raise an error stated in the us...
TableHandler make_table_scalars_tensors(const std::vector< T > &independent_vector, const std::string &independent_column_name, const std::vector< Tensor< 1, dim > > &dependent_vector, const std::vector< std::string > &dependent_column_names, const unsigned int display_precision, const bool display_scientific_notation)
Generate a table from a vector of scalars (independent variable) and a vector of Tensor<1,...
template void evaluate_values_at_points< 3, 3, GlobalVectorType >(const Mapping< 3 > &mapping, const DoFHandler< 3 > &dof_handler, const GlobalVectorType &solution_field, const std::vector< Point< 3 > > &evaluation_points, Utilities::MPI::RemotePointEvaluation< 3 > &remote_point_evaluator, std::vector< Tensor< 1, 3, double > > &evaluated_vector_values, const unsigned int first_selected_component)
unsigned int get_dimension(const std::string &file_name)
Extract the dimension in which to run Lethe from the contents of the parameter file....
std::string get_last_value_of_parameter(const std::string &file_name, const std::string ¶meter_name)
Retrieves the value of a specific parameter from an input file. Returns an empty string if the parame...
std::tuple< std::map< std::string, bool >, std::vector< std::string > > parse_args(int argc, char **argv)
Parse the arguments given to the application.
TableHandler make_table_tensors_scalars(const std::vector< Tensor< 1, dim > > &independent_vector, const std::vector< std::string > &independent_column_names, const std::vector< double > &dependent_vector, const std::string &dependent_column_name, const unsigned int display_precision, const bool display_scientific_notation)
Generate a table from a vector of Tensor<1,dim> (independent variables) and a vector of scalars (depe...
template void evaluate_values_at_points< 2, 2, GlobalVectorType >(const Mapping< 2 > &mapping, const DoFHandler< 2 > &dof_handler, const GlobalVectorType &solution_field, const std::vector< Point< 2 > > &evaluation_points, Utilities::MPI::RemotePointEvaluation< 2 > &remote_point_evaluator, std::vector< Tensor< 1, 2, double > > &evaluated_vector_values, const unsigned int first_selected_component)
void fill_table_from_file(TableHandler &table, const std::string &file_name, const std::string &delimiter)
Reads a file generated by a deal.II TableHandler and fills a TableHandler with its data.
void create_output_folder(const std::string &dirname)
Creates the simulation output folder.
void print_parameters_to_output_file(const ConditionalOStream &pcout, const ParameterHandler &prm, const std::string &file_name)
Print the parameters given by the parameter file of the application.
void delete_output_folder(const std::string &dirname)
Delete the output folder and its content.
void delete_vtu_and_pvd_files(const std::string &output_path)
Delete vtu and pvd files.
void fill_string_vectors_from_file(std::map< std::string, std::vector< std::string > > &map, const std::string &file, const std::string &delimiter)
Function that read a file that was build from a dealii table and create a map with the key being the ...
void evaluate_values_at_points(const Mapping< dim > &mapping, const DoFHandler< dim > &dof_handler, const VectorType &solution_field, const std::vector< Point< dim > > &evaluation_points, Utilities::MPI::RemotePointEvaluation< dim > &remote_point_evaluator, std::vector< double > &evaluated_scalar_values, const unsigned int first_selected_component)
Evaluates the values of a scalar field at remote points of the domain from the mapping,...
int get_max_subsection_size(const std::string &file_name, const bool require_subsection_size)
Extract the maximum value between the number of boundary conditions and the number of manifolds from ...
void print_version_info(const ConditionalOStream &pcout)
Print the information of the deal.II and Lethe branches used to run an application in the "git descri...
void fill_vectors_from_file(std::map< std::string, std::vector< double > > &map, const std::string &file, const std::string &delimiter)
function that read a file that was build from a dealii table and fill 2 vectors. The first vector con...
int get_max_value_of_parameter(const std::string &file_name, const std::string ¶meter_name)
std::string concatenate_strings(const int argc, char **argv)
Concatenate words which are passed from the command line to a main function into a single string in w...
template void evaluate_values_at_points< 3, GlobalBlockVectorType >(const Mapping< 3 > &mapping, const DoFHandler< 3 > &dof_handler, const GlobalBlockVectorType &solution_field, const std::vector< Point< 3 > > &evaluation_points, Utilities::MPI::RemotePointEvaluation< 3 > &remote_point_evaluator, std::vector< double > &evaluated_scalar_values, const unsigned int first_selected_component)
TableHandler make_table_tensors_tensors(const std::vector< Tensor< 1, dim > > &independent_vector, const std::vector< std::string > &independent_column_names, const std::vector< Tensor< 1, dim > > &dependent_vector, const std::vector< std::string > &dependent_column_names, const unsigned int display_precision, const bool display_scientific_notation)
Generate a table from a vector of Tensor<1,dim> (independent variables) and a vector of Tensor<1,...
template void evaluate_values_at_points< 3, 3, GlobalBlockVectorType >(const Mapping< 3 > &mapping, const DoFHandler< 3 > &dof_handler, const GlobalBlockVectorType &solution_field, const std::vector< Point< 3 > > &evaluation_points, Utilities::MPI::RemotePointEvaluation< 3 > &remote_point_evaluator, std::vector< Tensor< 1, 3, double > > &evaluated_vector_values, const unsigned int first_selected_component)
template void evaluate_values_at_points< 2, 2, GlobalBlockVectorType >(const Mapping< 2 > &mapping, const DoFHandler< 2 > &dof_handler, const GlobalBlockVectorType &solution_field, const std::vector< Point< 2 > > &evaluation_points, Utilities::MPI::RemotePointEvaluation< 2 > &remote_point_evaluator, std::vector< Tensor< 1, 2, double > > &evaluated_vector_values, const unsigned int first_selected_component)
void warn_deprecated_parameter_value(const std::string ¶meter_name, const std::string &deprecated_value, const std::string &new_value)
Print a warning stating that a deprecated value was given to a parameter, along with the value which ...
void interpret_escape_sequences(std::string &s)
Identify escape sequences listed below and apply them to the string.
template void evaluate_values_at_points< 2, GlobalBlockVectorType >(const Mapping< 2 > &mapping, const DoFHandler< 2 > &dof_handler, const GlobalBlockVectorType &solution_field, const std::vector< Point< 2 > > &evaluation_points, Utilities::MPI::RemotePointEvaluation< 2 > &remote_point_evaluator, std::vector< double > &evaluated_scalar_values, const unsigned int first_selected_component)
template void evaluate_values_at_points< 2, GlobalVectorType >(const Mapping< 2 > &mapping, const DoFHandler< 2 > &dof_handler, const GlobalVectorType &solution_field, const std::vector< Point< 2 > > &evaluation_points, Utilities::MPI::RemotePointEvaluation< 2 > &remote_point_evaluator, std::vector< double > &evaluated_scalar_values, const unsigned int first_selected_component)
void print_comment_to_output_file(const ConditionalOStream &pcout, ParameterHandler &prm)
Print a user comment at the beginning of the simulation on the console output.
dealii::TrilinosWrappers::MPI::Vector GlobalVectorType
dealii::TrilinosWrappers::MPI::BlockVector GlobalBlockVectorType