HermesCommon  3.0
Hermes::Solvers::SimpleExternalSolver< Scalar > Class Template Referenceabstract

An example class for using external solvers that run a command and store the result in a file. More...

#include <linear_matrix_solver.h>

+ Inheritance diagram for Hermes::Solvers::SimpleExternalSolver< Scalar >:

Public Member Functions

 SimpleExternalSolver (CSCMatrix< Scalar > *m, SimpleVector< Scalar > *rhs)
 
void solve ()
 
void solve (Scalar *initial_guess)
 
- Public Member Functions inherited from Hermes::Solvers::ExternalSolver< Scalar >
 ExternalSolver (CSCMatrix< Scalar > *m, SimpleVector< Scalar > *rhs)
 
virtual int get_matrix_size ()
 Get size of matrix.
 
CSCMatrix< Scalar > * get_matrix ()
 
SimpleVector< Scalar > * get_rhs ()
 
template<>
ExternalSolver< double >::creation create_external_solver
 
template<>
ExternalSolver< std::complex
< double > >::creation 
create_external_solver
 
- Public Member Functions inherited from Hermes::Solvers::LinearMatrixSolver< Scalar >
 LinearMatrixSolver (SparseMatrix< Scalar > *matrix, Hermes::Algebra::Vector< Scalar > *rhs)
 
DirectSolver< Scalar > * as_DirectSolver () const
 
LoopSolver< Scalar > * as_LoopSolver () const
 
IterSolver< Scalar > * as_IterSolver () const
 
AMGSolver< Scalar > * as_AMGSolver () const
 
virtual void free ()=0
 
Scalar * get_sln_vector ()
 
double get_time ()
 
virtual MatrixStructureReuseScheme get_used_reuse_scheme () const
 Get factorization scheme.
 
virtual void set_reuse_scheme (MatrixStructureReuseScheme reuse_scheme)
 
virtual void set_reuse_scheme ()
 Set factorization scheme to default.
 
virtual void use_node_wise_ordering (unsigned int num_pdes)
 Set matrix ordering in the case of a system of PDEs.
 
virtual void use_equations_wise_ordering ()
 
virtual double get_residual_norm ()
 Dummy methods that are implemented in the appropriate classes.
 
SparseMatrix< Scalar > * get_matrix ()
 
Vector< Scalar > * get_rhs ()
 
- Public Member Functions inherited from Hermes::Mixins::Loggable
 Loggable (bool verbose_output=false, callbackFn verbose_callback=NULL, bool add_newline=true)
 
void set_file_output_only (bool onOff)
 
void set_timestamps (bool onOff)
 Sets the addition of a time stamp on each line in the log file. By default it is on.
 
void set_erase_on_beginning (bool onOff)
 Sets the logFile being always erased before logging.
 
void set_logFile_name (const char *filename)
 
void set_logFile_name (std::string filename)
 
void info (const char *msg,...) const
 
void info_if (bool cond, const char *msg,...) const
 
void warn (const char *msg,...) const
 
void warn_if (bool cond, const char *msg,...) const
 
void error (const char *msg,...) const
 
void error_if (bool cond, const char *msg,...) const
 
virtual void set_verbose_output (bool to_set)
 
bool get_verbose_output () const
 Returns the current value of verbose_output;.
 
virtual void set_verbose_callback (callbackFn callback)
 
callbackFn get_verbose_callback () const
 Returns the current value of verbose_callback;.
 
- Public Member Functions inherited from Hermes::Mixins::TimeMeasurable
 TimeMeasurable (const char *name=nullptr)
 Constructs internal structures and starts measuring.
 
const TimeMeasurablereset ()
 Resets accumulated time.
 
const TimeMeasurabletick_reset ()
 Starts a new_ period and resets accumulated time.
 
const TimeMeasurabletick (TimeMeasurable::TimerPeriodTickType type=HERMES_ACCUMULATE)
 Starts/ends a new_ period.
 
const std::string & name () const
 Returns a name of the time period if any.
 
double accumulated () const
 Returns accumulated time (in seconds).
 
std::string accumulated_str () const
 Returns accumulated time in human readable form.
 
double last () const
 Returns last measured period (in seconds). More...
 
std::string last_str () const
 Returns last measured period in human readable form.
 
- Public Member Functions inherited from Hermes::Algebra::Mixins::MatrixRhsOutput< Scalar >
 MatrixRhsOutput ()
 
void process_matrix_output (Hermes::Algebra::SparseMatrix< Scalar > *matrix, int iteration)
 Processes the matrix.
 
void process_matrix_output (Hermes::Algebra::SparseMatrix< Scalar > *matrix)
 
void process_vector_output (Hermes::Algebra::Vector< Scalar > *rhs, int iteration)
 Processes the matrix.
 
void process_vector_output (Hermes::Algebra::Vector< Scalar > *rhs)
 
void output_matrix (bool only_last_iteration=true, int firstIterations=-1)
 
void set_print_zero_matrix_entries (bool to_set)
 Sets this instance to output matrix entries even though they are zero or not.
 
void set_matrix_filename (std::string name)
 
void set_matrix_varname (std::string name)
 
void set_matrix_export_format (Hermes::Algebra::MatrixExportFormat format)
 
void set_matrix_number_format (char *number_format)
 
void output_rhs (bool only_last_iteration=true, int firstIterations=-1)
 
void set_rhs_filename (std::string name)
 
void set_rhs_varname (std::string name)
 
void set_rhs_export_format (Hermes::Algebra::MatrixExportFormat format)
 
void set_rhs_number_format (char *number_format)
 

Protected Member Functions

virtual std::string command ()=0
 
- Protected Member Functions inherited from Hermes::Mixins::Loggable
void hermes_fwrite (const void *ptr, size_t size, size_t nitems, FILE *stream) const
 
void hermes_fread (void *ptr, size_t size, size_t nitems, FILE *stream) const
 

Additional Inherited Members

- Public Types inherited from Hermes::Solvers::ExternalSolver< Scalar >
typedef ExternalSolver< Scalar > *(* creation )(CSCMatrix< Scalar > *m, SimpleVector< Scalar > *rhs)
 
- Public Types inherited from Hermes::Mixins::TimeMeasurable
enum  TimerPeriodTickType { HERMES_ACCUMULATE, HERMES_SKIP }
 Tick type. Used by the class Hermes::TimePeriod. More...
 
- Static Public Member Functions inherited from Hermes::Mixins::Loggable
static void set_static_logFile_name (const char *filename)
 
static void set_static_logFile_name (std::string filename)
 
- Public Attributes inherited from Hermes::Mixins::Loggable
char * logFileName
 Logfile name.
 
- Static Public Attributes inherited from Hermes::Solvers::ExternalSolver< Scalar >
static creation create_external_solver
 
- Static Public Attributes inherited from Hermes::Mixins::Loggable
static char * staticLogFileName = nullptr
 
- Protected Attributes inherited from Hermes::Solvers::ExternalSolver< Scalar >
CSCMatrix< Scalar > * m
 Matrix to solve.
 
SimpleVector< Scalar > * rhs
 Right hand side vector.
 
- Protected Attributes inherited from Hermes::Solvers::LinearMatrixSolver< Scalar >
MatrixStructureReuseScheme reuse_scheme
 Factorization scheme.
 
SparseMatrix< Scalar > * general_matrix
 
Vector< Scalar > * general_rhs
 
Scalar * sln
 Solution vector. More...
 
double time
 
unsigned int n_eq
 Number of equations in a system of PDEs.
 
bool node_wise_ordering
 
- Protected Attributes inherited from Hermes::Algebra::Mixins::MatrixRhsOutput< Scalar >
bool print_matrix_zero_values
 
bool output_matrixOn
 
bool only_lastMatrixIteration
 
int output_matrixIterations
 
std::string matrixFilename
 
std::string matrixVarname
 
Hermes::Algebra::MatrixExportFormat matrixFormat
 
char * matrix_number_format
 
bool output_rhsOn
 
bool only_lastRhsIteration
 
int output_rhsIterations
 
std::string RhsFilename
 
std::string RhsVarname
 
Hermes::Algebra::MatrixExportFormat RhsFormat
 
char * rhs_number_format
 

Detailed Description

template<typename Scalar>
class Hermes::Solvers::SimpleExternalSolver< Scalar >

An example class for using external solvers that run a command and store the result in a file.

Definition at line 199 of file linear_matrix_solver.h.

Member Function Documentation

template<typename Scalar >
virtual std::string Hermes::Solvers::SimpleExternalSolver< Scalar >::command ( )
protectedpure virtual

External command call.

Returns
Filepath to the result vector in the raw text format (just numbers, one per line). Can destroy the matrix and rhs files, those are not needed anymore.
template<typename Scalar >
void Hermes::Solvers::SimpleExternalSolver< Scalar >::solve ( )
virtual

Solve.

Returns
true on succes

Reimplemented from Hermes::Solvers::ExternalSolver< Scalar >.

Definition at line 390 of file linear_matrix_solver.cpp.

template<typename Scalar >
void Hermes::Solvers::SimpleExternalSolver< Scalar >::solve ( Scalar *  initial_guess)
virtual

Solve.

Returns
true on succes
Parameters
[in]initialguess.

Reimplemented from Hermes::Solvers::ExternalSolver< Scalar >.

Definition at line 396 of file linear_matrix_solver.cpp.


The documentation for this class was generated from the following files: