38 #ifdef OOMPH_HAS_UNISTDH 53 namespace SecondInvariantHelper
60 unsigned n=tensor.
nrow();
61 double trace_of_tensor=0.0;
62 double trace_of_tensor_squared=0.0;
63 for(
unsigned i=0;
i<n;
i++)
66 trace_of_tensor += tensor(
i,
i);
68 for(
unsigned j=0;j<n;j++)
70 trace_of_tensor_squared += tensor(
i,j)*tensor(j,
i);
75 return 0.5*(trace_of_tensor*trace_of_tensor-trace_of_tensor_squared);
93 std::string error_message =
"Assignment operator for class\n\n";
94 error_message += class_name;
95 error_message +=
"\n\n";
96 error_message +=
"is deliberately broken to avoid the accidental \n";
97 error_message +=
"use of the inappropriate C++ default.\n";
98 error_message +=
"If you really need an assignment operator\n";
99 error_message +=
"for this class, write it yourself...\n";
102 OOMPH_EXCEPTION_LOCATION);
110 std::string error_message =
"Copy constructor for class\n\n";
111 error_message += class_name;
112 error_message +=
"\n\n";
113 error_message +=
"is deliberately broken to avoid the accidental\n";
114 error_message +=
"use of the inappropriate C++ default.\n";
116 "All function arguments should be passed by reference or\n";
118 "constant reference. If you really need a copy constructor\n";
119 error_message +=
"for this class, write it yourself...\n";
122 OOMPH_CURRENT_FUNCTION,
123 OOMPH_EXCEPTION_LOCATION);
137 namespace CumulativeTimings
155 return double(
Timing[i])/CLOCKS_PER_SEC;
168 for (
unsigned i=0;
i<n;
i++)
177 Timing.resize(ntimers,clock_t(0.0));
193 namespace BlackBoxFDNewtonSolver
199 const Vector<double>&,
227 const Vector<double>& params,
228 Vector<double>& unknowns)
231 unsigned ndof=unknowns.size();
233 Vector<double> residuals(ndof);
234 Vector<double> residuals_pls(ndof);
235 Vector<double> dx(ndof);
236 Vector<double> gradient(ndof);
237 Vector<double> newton_direction(ndof);
239 double half_residual_squared=0.0;
246 for (
unsigned iloop=0;iloop<
Max_iter;iloop++)
249 residual_fct(params,unknowns,residuals);
253 if (Use_step_length_control)
255 half_residual_squared=0.0;
257 for (
unsigned i=0;
i<ndof;
i++)
259 sum += unknowns[
i]*unknowns[
i];
260 half_residual_squared+=residuals[
i]*residuals[
i];
262 half_residual_squared*=0.5;
263 max_step=100.0*std::max(sqrt(sum),
double(ndof));
268 double max_res = std::fabs(*std::max_element(residuals.begin(),
276 oomph_info <<
"\nNewton iteration iter=" << iloop
277 <<
"\ni residual[i] unknown[i] " << std::endl;
278 for (
unsigned i=0;
i<ndof;
i++)
281 <<
" " << unknowns[
i] << std::endl;
296 for (
unsigned i=0;
i<ndof;
i++)
298 double backup=unknowns[
i];
302 residual_fct(params,unknowns,residuals_pls);
305 for (
unsigned j=0;j<ndof;j++)
307 jacobian(j,
i)=(residuals_pls[j]-residuals[j])/FD_step;
319 if (Use_step_length_control)
321 for (
unsigned i=0;
i<ndof;
i++)
324 for (
unsigned j=0;j<ndof;j++)
326 sum += jacobian(j,
i)*residuals[j];
333 jacobian.
solve(residuals,newton_direction);
336 if (Use_step_length_control)
338 for (
unsigned i=0;
i<ndof;
i++)
340 newton_direction[
i]*=-1.0;
343 Vector<double> unknowns_old(unknowns);
344 double half_residual_squared_old=half_residual_squared;
346 half_residual_squared_old,
352 half_residual_squared,
358 for (
unsigned i=0;
i<ndof;
i++)
360 unknowns[
i]-=newton_direction[
i];
370 std::ostringstream error_stream;
371 error_stream<<
"Newton solver did not converge in " 372 << Max_iter <<
" steps " << std::endl;
375 OOMPH_CURRENT_FUNCTION,
376 OOMPH_EXCEPTION_LOCATION);
391 const double half_residual_squared_old,
392 const Vector<double>& gradient,
394 const Vector<double>& params,
395 Vector<double>& newton_dir,
397 double& half_residual_squared,
398 const double& stpmax)
400 const double min_fct_decrease=1.0e-4;
401 double convergence_tol_on_x=1.0e-16;
403 double lambda_aux=0.0;
404 double proposed_lambda=0.0;
405 unsigned n=x_old.size();
407 for (
unsigned i=0;
i<n;
i++)
409 sum += newton_dir[
i]*newton_dir[
i];
414 for (
unsigned i=0;
i<n;
i++)
416 newton_dir[
i] *= stpmax/sum;
420 for (
unsigned i=0;
i<n;
i++)
422 slope += gradient[
i]*newton_dir[
i];
426 std::ostringstream error_stream;
427 error_stream <<
"Roundoff problem in lnsrch: slope=" << slope <<
"\n";
429 OOMPH_CURRENT_FUNCTION,
430 OOMPH_EXCEPTION_LOCATION);
433 for (
unsigned i=0;
i<n;
i++)
435 double temp=std::fabs(newton_dir[
i])/std::max(std::fabs(x_old[i]),1.0);
436 if (temp > test) test=temp;
438 double lambda_min=convergence_tol_on_x/test;
442 for (
unsigned i=0;
i<n;
i++)
444 x[
i]=x_old[
i]+lambda*newton_dir[
i];
448 Vector<double> residuals(n);
449 residual_fct(params,x,residuals);
450 half_residual_squared=0.0;
451 for (
unsigned i=0;
i<n;
i++)
453 half_residual_squared+=residuals[
i]*residuals[
i];
455 half_residual_squared*=0.5;
457 if (lambda < lambda_min)
459 for (
unsigned i=0;
i<n;
i++) x[
i]=x_old[
i];
463 "BlackBoxFDNewtonSolver::line_search()",
464 OOMPH_EXCEPTION_LOCATION);
467 else if (half_residual_squared <= half_residual_squared_old+
468 min_fct_decrease*lambda*slope)
476 proposed_lambda = -slope/(2.0*(half_residual_squared-
477 half_residual_squared_old-slope));
481 double r1=half_residual_squared-
482 half_residual_squared_old-lambda*slope;
483 double r2=f_aux-half_residual_squared_old-lambda_aux*slope;
484 double a_poly=(r1/(lambda*lambda)-r2/(lambda_aux*lambda_aux))/
486 double b_poly=(-lambda_aux*r1/(lambda*lambda)+lambda*r2/
487 (lambda_aux*lambda_aux))/(lambda-lambda_aux);
490 proposed_lambda = -slope/(2.0*b_poly);
494 double discriminant=b_poly*b_poly-3.0*a_poly*slope;
495 if (discriminant < 0.0)
497 proposed_lambda=0.5*lambda;
499 else if (b_poly <= 0.0)
501 proposed_lambda=(-b_poly+sqrt(discriminant))/(3.0*a_poly);
505 proposed_lambda=-slope/(b_poly+sqrt(discriminant));
508 if (proposed_lambda>0.5*lambda)
510 proposed_lambda=0.5*lambda;
515 f_aux = half_residual_squared;
516 lambda=std::max(proposed_lambda,0.1*lambda);
530 std::ostringstream filename;
531 filename << directory_ <<
"/.dummy_check.dat";
532 std::ofstream some_file;
533 some_file.open(filename.str().c_str());
534 if (!some_file.is_open())
537 std::string error_message =
"Problem opening output file.\n";
538 error_message +=
"I suspect you haven't created the output directory ";
539 error_message += directory_;
540 error_message +=
"\n";
543 if(!Directory_must_exist)
547 OOMPH_EXCEPTION_LOCATION);
552 error_message +=
"and the Directory_must_exist flag is true.\n";
554 OOMPH_CURRENT_FUNCTION,
555 OOMPH_EXCEPTION_LOCATION);
559 some_file <<
"Dummy file, opened to check if output directory " << std::endl;
560 some_file <<
"exists. Can be deleted...." << std::endl;
563 Directory=directory_;
571 namespace StringConversion
577 std::string::iterator it;
578 for(it = output.begin(); it!= output.end(); ++it)
588 std::string::iterator it;
589 for(it = output.begin(); it!= output.end(); ++it)
601 std::stringstream ss(s);
603 while (std::getline(ss, item, delim))
605 elems.push_back(item);
628 namespace CommandLineArgs
641 std::map<std::string, ArgInfo<double> >
645 std::map<std::string, ArgInfo<int> >
649 std::map<std::string, ArgInfo<unsigned> >
653 std::map<std::string, ArgInfo<std::string> >
668 oomph_info <<
"with the following command line args: " << std::endl;
669 std::stringstream str;
682 Specified_command_line_flag[command_line_flag] =
732 Specified_command_line_flag.begin();
733 it!=Specified_command_line_flag.end();it++)
737 return it->second.is_set;
747 return (it->second).is_set;
757 return (it->second).is_set;
767 return (it->second).is_set;
777 return (it->second).is_set;
788 Specified_command_line_flag.begin();
789 it!=Specified_command_line_flag.end();it++)
791 outstream << it->first <<
" " << it->second.is_set << std::endl;
797 outstream << it->first <<
" " << *(it->second.arg_pt)
804 outstream << it->first <<
" " << *(it->second.arg_pt)
811 outstream << it->first <<
" " << *(it->second.arg_pt)
826 outstream << it->first <<
" " << arg_string
835 oomph_info <<
"Specified (and recognised) command line flags:\n" ;
836 oomph_info <<
"----------------------------------------------\n";
839 Specified_command_line_flag.begin();
840 it!=Specified_command_line_flag.end();it++)
842 if (it->second.is_set)
852 if (it->second.is_set)
855 << *(it->second.arg_pt)
864 if (it->second.is_set)
867 << *(it->second.arg_pt)
876 if (it->second.is_set)
879 << *(it->second.arg_pt)
888 if (it->second.is_set)
891 << *(it->second.arg_pt)
904 oomph_info <<
"Available command line flags:\n" ;
905 oomph_info <<
"-----------------------------\n";
908 Specified_command_line_flag.begin();
909 it!=Specified_command_line_flag.end();it++)
912 << it->second.doc << std::endl
920 oomph_info << it->first <<
" <double> " << std::endl
921 << it->second.doc << std::endl
929 oomph_info << it->first <<
" <int> " << std::endl
930 << it->second.doc << std::endl
938 oomph_info << it->first <<
" <unsigned> " << std::endl
939 << it->second.doc << std::endl
947 oomph_info << it->first <<
" <string> " << std::endl
948 << it->second.doc << std::endl
964 std::stringstream error_stream;
965 error_stream <<
"Tried to read more command line arguments than\n" 966 <<
"specified. This tends to happen if a required argument\n" 967 <<
"to a command line flag was omitted, e.g. by running \n\n" 968 <<
" ./a.out -some_double \n\n rather than\n\n" 969 <<
" ./a.out -some_double 1.23 \n\n" 970 <<
"To aid the debugging I've output the available\n" 971 <<
"command line arguments above.\n";
974 OOMPH_CURRENT_FUNCTION,
975 OOMPH_EXCEPTION_LOCATION);
988 while (arg_index < argc)
991 bool found_match=
false;
993 if ( (strcmp(argv[arg_index],
"-help") == 0 ) ||
994 (strcmp(argv[arg_index],
"--help")== 0 ) )
996 oomph_info <<
"NOTE: You entered --help or -help on the command line\n";
997 oomph_info <<
"so I'm going to tell you about this code's\n";
998 oomph_info <<
"available command line flags and then return.\n";
1001 #ifdef OOMPH_HAS_MPI 1003 MPI_Initialized(&flag);
1015 Specified_command_line_flag.begin();
1016 it!=Specified_command_line_flag.end();it++)
1018 if (it->first==argv[arg_index])
1020 Specified_command_line_flag[argv[arg_index]].is_set =
true;
1034 if (it->first==argv[arg_index])
1040 it->second.is_set=
true;
1041 *(it->second.arg_pt)=atof(argv[arg_index]);
1057 if (it->first==argv[arg_index])
1063 it->second.is_set=
true;
1064 *(it->second.arg_pt)=atoi(argv[arg_index]);
1080 if (it->first==argv[arg_index])
1086 it->second.is_set=
true;
1087 *(it->second.arg_pt)=
unsigned(atoi(argv[arg_index]));
1103 if (it->first==argv[arg_index])
1109 it->second.is_set=
true;
1110 *(it->second.arg_pt)=argv[arg_index];
1124 std::string error_message =
"Command line argument\n\n";
1125 error_message += argv[arg_index];
1126 error_message +=
"\n\nwas not recognised. This may be legal\n";
1127 error_message +=
"but seems sufficiently suspicious to flag up.\n";
1128 error_message +=
"If it should have been recognised, make sure you\n";
1129 error_message +=
"used the right number of \"-\" signs...\n";
1131 if(throw_on_unrecognised_args)
1133 error_message +=
"Throwing an error because you requested it with";
1134 error_message +=
" throw_on_unrecognised_args option.";
1136 OOMPH_EXCEPTION_LOCATION);
1142 OOMPH_EXCEPTION_LOCATION);
1163 #ifdef OOMPH_HAS_MPI 1174 int my_rank = Communicator_pt->my_rank();
1176 if (!Output_from_single_processor)
1178 stream <<
"Processor " << my_rank <<
": ";
1184 if (
unsigned(my_rank)==Output_rank)
1186 stream <<
"Processor " << my_rank <<
": ";
1204 const bool& make_duplicate_of_mpi_comm_world)
1206 #ifdef OOMPH_HAS_MPI 1208 MPI_Init(&argc,&argv);
1213 MPI_Comm oomph_comm_world=MPI_COMM_WORLD;
1214 if (make_duplicate_of_mpi_comm_world)
1216 MPI_Comm_dup(MPI_COMM_WORLD,&oomph_comm_world);
1219 if (MPI_COMM_WORLD!=oomph_comm_world)
1221 oomph_info <<
"Oomph-lib communicator is a duplicate of MPI_COMM_WORLD\n";
1225 oomph_info <<
"Oomph-lib communicator is MPI_COMM_WORLD\n";
1235 MPI_Comm_set_errhandler(oomph_comm_world, MPI_ERRORS_RETURN);
1245 MPI_has_been_initialised=
true;
1254 delete Communicator_pt;
1257 #ifdef OOMPH_HAS_MPI 1269 if (!MPI_has_been_initialised)
1271 std::ostringstream error_message_stream;
1272 error_message_stream
1273 <<
"MPI has not been initialised.\n Call MPI_Helpers::init(...)";
1275 OOMPH_CURRENT_FUNCTION,
1276 OOMPH_EXCEPTION_LOCATION);
1279 return Communicator_pt;
1300 return Communicator_pt;
1302 #endif // end ifdef MPI 1312 namespace ObsoleteCode
1321 if (FlagObsoleteCode)
1324 oomph_info <<
"\n\n--------------------------------------------\n";
1325 oomph_info <<
"You are using obsolete code " << std::endl;
1326 oomph_info <<
"--------------------------------------------\n\n";
1327 oomph_info <<
"Enter: \"s\" to suppress further messages" << std::endl;
1329 " \"k\" to crash the code to allow a trace back in the debugger" 1332 oomph_info <<
" any other key to continue\n \n";
1334 " [Note: Insert \n \n ";
1336 " ObsoleteCode::FlagObsoleteCode=false;\n \n";
1338 " into your code to suppress these messages \n";
1345 FlagObsoleteCode=
false;
1350 OOMPH_CURRENT_FUNCTION,
1351 OOMPH_EXCEPTION_LOCATION);
1360 if(FlagObsoleteCode)
1362 oomph_info <<
"\n\n------------------------------------" << std::endl;
1364 oomph_info <<
"----------------------------------------" << std::endl;
1378 namespace TecplotNames
1407 namespace LeakCheckNames
1426 QuadTreeForest_build=0;
1427 OcTreeForest_build=0;
1430 MacroElement_build=0;
1433 GeomReference_build=0;
1434 AlgebraicNode_build=0;
1440 "\n Leak check: # of builds - # of deletes for the following objects: \n\n";
1441 oomph_info <<
"LeakCheckNames::QuadTree_build " 1443 oomph_info <<
"LeakCheckNames::QuadTreeForest_build " 1445 oomph_info <<
"LeakCheckNames::OcTree_build " 1447 oomph_info <<
"LeakCheckNames::OcTreeForest_build " 1449 oomph_info <<
"LeakCheckNames::RefineableQElement<2>_build " 1450 << LeakCheckNames::RefineableQElement<2>_build << std::endl;
1451 oomph_info <<
"LeakCheckNames::RefineableQElement<3>_build " 1452 << LeakCheckNames::RefineableQElement<3>_build << std::endl;
1453 oomph_info <<
"LeakCheckNames::MacroElement_build " 1455 oomph_info <<
"LeakCheckNames::HangInfo_build " 1459 oomph_info <<
"LeakCheckNames::GeomReference_build " 1461 oomph_info <<
"LeakCheckNames::AlgebraicNode_build " 1482 namespace PauseFlags
1499 <<
"\n hit any key to continue [hit \"S\" " 1500 <<
"to suppress further interruptions]\n";
1509 oomph_info <<
"\n[Suppressed pause message] \n";
1524 namespace TimingHelpers
1530 #ifdef OOMPH_HAS_MPI 1539 return double(t) / double(CLOCKS_PER_SEC);
1561 namespace MemoryUsage
1596 if (Bypass_all_memory_usage_monitoring)
return;
1599 std::ofstream the_file;
1600 the_file.open(My_memory_usage_filename.c_str());
1601 the_file <<
"# My memory usage: \n";
1606 #ifdef OOMPH_HAS_UNISTDH 1617 if (Bypass_all_memory_usage_monitoring)
return;
1620 std::ofstream the_file;
1621 the_file.open(My_memory_usage_filename.c_str(),std::ios::app);
1622 the_file << prefix_string <<
" ";
1626 #ifdef OOMPH_HAS_MPI 1628 (!Suppress_mpi_synchronisation))
1635 std::stringstream tmp;
1636 tmp << My_memory_usage_system_string
1637 <<
" | awk '{if ($2==" << getpid() <<
"){print $4}}' >> " 1639 int success=system(tmp.str().c_str());
1651 "ps aux | awk 'BEGIN{sum=0}{sum+=$4}END{print sum}'";
1666 if (Bypass_all_memory_usage_monitoring)
return;
1669 std::ofstream the_file;
1670 the_file.open(Total_memory_usage_filename.c_str());
1671 the_file <<
"# Total memory usage: \n";
1682 if (Bypass_all_memory_usage_monitoring)
return;
1685 std::ofstream the_file;
1686 the_file.open(Total_memory_usage_filename.c_str(),std::ios::app);
1687 the_file << prefix_string <<
" ";
1691 #ifdef OOMPH_HAS_MPI 1693 (!Suppress_mpi_synchronisation))
1700 std::stringstream tmp;
1701 tmp << Total_memory_usage_system_string <<
" >> " 1703 int success=system(tmp.str().c_str());
1716 if (Bypass_all_memory_usage_monitoring)
return;
1729 if (Bypass_all_memory_usage_monitoring)
return;
1731 #ifdef OOMPH_HAS_UNISTDH 1760 if (Bypass_all_memory_usage_monitoring)
return;
1763 std::ofstream the_file;
1764 the_file.open(Top_output_filename.c_str());
1765 the_file <<
"# Continuous output from top obtained with: \n";
1766 the_file <<
"# " << Top_system_string <<
"\n";
1779 if (Bypass_all_memory_usage_monitoring)
return;
1784 #ifdef OOMPH_HAS_MPI 1787 if (!Suppress_mpi_synchronisation)
1791 std::stringstream tmp;
1798 std::stringstream tmp;
1805 tmp <<
"echo \"#/bin/bash\" > run_continuous_top" << modifier
1807 <<
"echo \" echo " << backslash <<
"\" kill " 1808 << backslash << dollar
1809 << backslash << dollar <<
" " << backslash <<
"\" > kill_continuous_top" 1810 << modifier <<
".bash; chmod a+x kill_continuous_top" 1811 << modifier <<
".bash; " << Top_system_string
1812 <<
" \" >> run_continuous_top" << modifier
1813 <<
".bash; chmod a+x run_continuous_top" << modifier <<
".bash ";
1814 int success=system(tmp.str().c_str());
1823 std::stringstream tmp2;
1824 tmp2 <<
"./run_continuous_top" << modifier <<
".bash >> " 1825 << Top_output_filename <<
" & ";
1826 success=system(tmp2.str().c_str());
1840 if (Bypass_all_memory_usage_monitoring)
return;
1845 #ifdef OOMPH_HAS_MPI 1848 if (!Suppress_mpi_synchronisation)
1852 std::stringstream tmp;
1865 std::stringstream tmp2;
1866 tmp2 <<
"./kill_continuous_top" << modifier <<
".bash >> " 1867 << Top_output_filename <<
" & ";
1868 int success=system(tmp2.str().c_str());
1879 if (Bypass_all_memory_usage_monitoring)
return;
1881 std::stringstream tmp;
1882 tmp <<
" echo \"OOMPH-LIB EVENT: " << comment <<
"\" >> " 1884 int success=system(tmp.str().c_str());
void doc_total_memory_usage(const std::string &prefix_string)
Doc total memory usage, prepended by string (which allows identification from where the function is c...
Class of matrices containing doubles, and stored as a DenseMatrix<double>, but with solving functiona...
long QuadTreeForest_build
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
unsigned long nrow() const
Return the number of rows of the matrix.
char ** Argv
Arguments themselves.
void obsolete(const std::string &message)
Ouput a warning message with a string argument.
std::string to_lower(const std::string &input)
Convert a string to lower case (outputs a copy).
Structure to store information on a command line argument.
Vector< clock_t > Timing
Cumulative timings.
bool Doc_Progress
Flag to indicate if progress of Newton iteration is to be documented (defaults to false) ...
std::string My_memory_usage_system_string
String containing system command that obtains memory usage of all processes. Default assignment for l...
std::string Top_system_string
String containing system command that runs "top" (or equivalent) "indefinitely" and writes to file sp...
std::map< std::string, ArgInfo< int > > Specified_command_line_int_pt
Map to associate an input flag with an int – specified via pointer.
void check_arg_index(const int &argc, const int &arg_index)
Helper function to check if command line index is legal.
static void finalize()
finalize mpi
void run_continous_top(const std::string &comment)
Start running top continuously and output (append) into file specified by Top_output_filename. Wipe that file with empty_top_file() if you wish. Note that this is again quite Linux specific and unlikely to work on other operating systems. Insert optional comment into output file before starting.
std::map< std::string, ArgInfo< std::string > > Specified_command_line_string_pt
Map to associate an input flag with a string – specified via pointer.
unsigned N_iter_taken
Number of Newton iterations taken in most recent invocation.
void empty_total_memory_usage_file()
Function to empty file that records total memory usage in file whose name is specified by Total_memor...
static OomphCommunicator * communicator_pt()
access to the global oomph-lib communicator
static bool mpi_has_been_initialised()
return true if MPI has been initialised
OomphCommunicator *& communicator_pt()
Return pointer to communicator.
std::map< std::string, ArgInfo< bool > > Specified_command_line_flag
Map to indicate an input flag as having been set.
void set_ntimers(const unsigned &ntimers)
Set number of timings that can be recorded in parallel.
bool Use_step_length_control
Use steplength control do make globally convergent (default false)
void empty_memory_usage_files()
Function to empty file that records total and local memory usage in appropriate files.
std::map< std::string, ArgInfo< unsigned > > Specified_command_line_unsigned_pt
Map to associate an input flag with an unsigned – specified via pointer.
std::string to_upper(const std::string &input)
Convert a string to upper case (outputs a copy).
void specify_command_line_flag(const std::string &command_line_flag, std::string *arg_pt, const std::string &doc)
Specify possible command line flag that specifies a string, accessed via pointer. ...
void insert_comment_to_continous_top(const std::string &comment)
Insert comment into running continuous top output.
void solve(DoubleVector &rhs)
Complete LU solve (replaces matrix by its LU decomposition and overwrites RHS with solution)...
static OomphCommunicator * Communicator_pt
the global communicator
std::map< std::string, ArgInfo< double > > Specified_command_line_double_pt
Map to associate an input flag with a double – specified via pointer.
virtual bool operator()(std::ostream &stream)
Precede the output by the processor ID but output everything.
static bool MPI_has_been_initialised
Bool set to true if MPI has been initialised.
void start(const unsigned &i)
(Re-)start i-th timer
void setup()
Setup namespace.
std::string Top_output_filename
String containing name of file in which we document "continuous" output from "top" (or equivalent)– ...
unsigned Max_iter
Max. # of Newton iterations.
std::string My_memory_usage_filename
String containing name of file in which we document my memory usage – you may want to change this to...
MPIOutputModifier oomph_mpi_output
Single (global) instantiation of the mpi output modifier.
double timer()
returns the time in seconds after some point in past
void output(std::ostream &outfile)
Output with default number of plot points.
bool command_line_flag_has_been_set(const std::string &flag)
Check if command line flag has been set (value will have been assigned directly). ...
void empty_my_memory_usage_file()
Function to empty file that records my memory usage in file whose name is specified by My_memory_usag...
void doc_my_memory_usage(const std::string &prefix_string)
Doc my memory usage, prepended by string (which allows identification from where the function is call...
void black_box_fd_newton_solve(ResidualFctPt residual_fct, const Vector< double > ¶ms, Vector< double > &unknowns)
Black-box FD Newton solver: Calling sequence for residual function is.
Vector< std::string > split_string(const std::string &s, char delim)
Split a string, s, into a vector of strings where ever there is an instance of delimiter (i...
void parse_and_assign(const bool &throw_on_unrecognised_args)
Parse previously specified command line, check for recognised flags and assign associated values...
static void init(int argc, char **argv, const bool &make_duplicate_of_mpi_comm_world=true)
initialise mpi (oomph-libs equivalent of MPI_Init(...)) Initialises MPI and creates the global oomph-...
int Argc
Number of arguments + 1.
OutputModifier *& output_modifier_pt()
Access function for the output modifier pointer.
void broken_assign(const std::string &class_name)
Issue error message and terminate execution.
std::string Total_memory_usage_filename
String containing name of file in which we document total memory usage – you may want to change this...
bool Suppress_mpi_synchronisation
Boolean to suppress synchronisation of doc memory usage on processors (via mpi barriers). True (i.e. sync is suppressed) by default because not all processors may reach the relevant doc memory usage statements causing the code to hang).
bool PauseFlag
Flag to enable pausing code – pause the code by default.
Vector< clock_t > Start_time
Start times of active timers.
bool Bypass_all_memory_usage_monitoring
Bool allowing quick bypassing of ALL operations related to memory usage monitoring – this allows the...
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
void set_directory(const std::string &directory)
Set output directory (we try to open a file in it to see if the directory exists – if it doesn't we'...
std::string Total_memory_usage_system_string
String containing system command that obtains total memory usage. Default assignment for linux...
void pause(std::string message)
Pause and display message.
void empty_top_file()
Function to empty file that records continuous output from top in file whose name is specified by Top...
Vector< std::string > colour
Tecplot colours.
void doc_available_flags()
Document available command line flags.
long RefineableQElement< 2 > _build
void stop_continous_top(const std::string &comment)
Stop running top continuously. Note that this is again quite Linux specific and unlikely to work on o...
void line_search(const Vector< double > &x_old, const double half_residual_squared_old, const Vector< double > &gradient, ResidualFctPt residual_fct, const Vector< double > ¶ms, Vector< double > &newton_dir, Vector< double > &x, double &half_residual_squared, const double &stpmax)
Line search helper for globally convergent Newton method.
double cumulative_time(const unsigned &i)
Report time accumulated by i-th timer.
void doc_memory_usage(const std::string &prefix_string)
Doc total and local memory usage, prepended by string (which allows identification from where the fun...
void doc_specified_flags()
Document specified command line flags.
void doc_all_flags(std::ostream &outstream)
Document the values of all flags (specified or not).
void(* ResidualFctPt)(const Vector< double > &, const Vector< double > &, Vector< double > &)
Function pointer for residual function: Parameters, unknowns, residuals.
double second_invariant(const DenseMatrix< double > &tensor)
Compute second invariant of tensor.
bool FlagObsoleteCode
Flag up obsolete parts of the code.
void halt(const unsigned &i)
Halt i-th timer.
An oomph-lib wrapper to the MPI_Comm communicator object. Just contains an MPI_Comm object (which is ...