Changed: Renamed the base class SIMinput to SIMadmin

This commit is contained in:
Knut Morten Okstad 2016-12-13 11:44:17 +01:00
parent 4a5bafaa45
commit 1a43e1c694
13 changed files with 78 additions and 78 deletions

View File

@ -40,7 +40,7 @@ public:
//! \brief Empty destructor.
virtual ~SIMOverride() {}
//! \copydoc SIMinput::read(const char*)
//! \copydoc SIMadmin::read(const char*)
bool read(const char* fileName) { return base.read(fileName); }
//! \copydoc ISolver::setInitialConditions()

View File

@ -14,7 +14,7 @@
#ifndef _SIM_SEMI3D_H
#define _SIM_SEMI3D_H
#include "SIMinput.h"
#include "SIMadmin.h"
#include "SIMdependency.h"
#include "SIMSolver.h"
#include "IFEM.h"
@ -42,7 +42,7 @@ extern std::vector< std::shared_ptr<std::ostream> > plane_log_files;
*/
template<class PlaneSolver>
class SIMSemi3D : public SIMinput, public SIMdependency
class SIMSemi3D : public SIMadmin, public SIMdependency
{
public:
typedef typename PlaneSolver::SetupProps SetupProps;
@ -53,7 +53,7 @@ public:
startCtx(0), planes(1), procs_per_plane(1), output_plane(-1),
direction('Z'), props(props_)
{
SIMinput::myHeading = "Plane-decoupled 3D simulation driver";
SIMadmin::myHeading = "Plane-decoupled 3D simulation driver";
}
//! \brief The destructor deletes the plane-wise sub-step solvers.
@ -212,7 +212,7 @@ public:
//! \param[in] fileName Name of input file to read data from
virtual bool read(const char* fileName)
{
if (!this->SIMinput::read(fileName))
if (!this->SIMadmin::read(fileName))
return false;
// Setup our communicator

View File

@ -14,7 +14,7 @@
#ifndef _SIM_SOLVER_H_
#define _SIM_SOLVER_H_
#include "SIMinput.h"
#include "SIMadmin.h"
#include "DataExporter.h"
#include "TimeStep.h"
#include "IFEM.h"
@ -49,11 +49,11 @@ int ConfigureSIM(T& t, char* infile,
ISolver interface. It provides a time stepping loop with data output.
*/
template<class T1> class SIMSolver : public SIMinput
template<class T1> class SIMSolver : public SIMadmin
{
public:
//! \brief The constructor initializes the reference to the actual solver.
SIMSolver(T1& s1) : SIMinput("Time integration driver"), S1(s1) {}
SIMSolver(T1& s1) : SIMadmin("Time integration driver"), S1(s1) {}
//! \brief Empty destructor.
virtual ~SIMSolver() {}

View File

@ -24,7 +24,7 @@
#include <cstdio>
AdaptiveSIM::AdaptiveSIM (SIMoutput& sim, bool sa) : SIMinput(sim), model(sim)
AdaptiveSIM::AdaptiveSIM (SIMoutput& sim, bool sa) : SIMadmin(sim), model(sim)
{
alone = sa;
geoBlk = nBlock = 0;

View File

@ -14,7 +14,7 @@
#ifndef _ADAPTIVE_SIM_H
#define _ADAPTIVE_SIM_H
#include "SIMinput.h"
#include "SIMadmin.h"
#include "MatVec.h"
class SIMoutput;
@ -26,7 +26,7 @@ class SIMoutput;
problems adaptively, based on element error norms as refinement indicators.
*/
class AdaptiveSIM : public SIMinput
class AdaptiveSIM : public SIMadmin
{
public:
//! \brief The constructor initializes default adaptation parameters.

View File

@ -18,7 +18,7 @@
MultiStepSIM::MultiStepSIM (SIMbase& sim)
: SIMinput(sim), model(static_cast<SIMoutput&>(sim))
: SIMadmin(sim), model(static_cast<SIMoutput&>(sim))
{
#ifndef SP_DEBUG
msgLevel = 1; // prints the convergence history only

View File

@ -14,7 +14,7 @@
#ifndef _MULTI_STEP_SIM_H
#define _MULTI_STEP_SIM_H
#include "SIMinput.h"
#include "SIMadmin.h"
#include "SIMenums.h"
#include "MatVec.h"
@ -28,7 +28,7 @@ struct TimeDomain;
\brief Base class for multi-step solution drivers.
*/
class MultiStepSIM : public SIMinput
class MultiStepSIM : public SIMadmin
{
protected:
//! \brief Enum describing reference norm options.

View File

@ -1,21 +1,20 @@
// $Id$
//==============================================================================
//!
//! \file SIMinput.C
//! \file SIMadmin.C
//!
//! \date Jun 1 2010
//!
//! \author Knut Morten Okstad / SINTEF
//!
//! \brief Base class for simulators with input parsing functionality.
//! \brief Administration base class for FEM simulators.
//!
//==============================================================================
#include "SIMinput.h"
#include "IFEM.h"
#include "SIMadmin.h"
#include "Utilities.h"
#include "IFEM.h"
#include "tinyxml.h"
#include "SystemMatrix.h"
#ifdef HAVE_MPI
#include <mpi.h>
#endif
@ -25,10 +24,10 @@
#define strcasestr strstr
#endif
int SIMinput::msgLevel = 2;
int SIMadmin::msgLevel = 2;
SIMinput::SIMinput (const char* heading) : opt(myOpts)
SIMadmin::SIMadmin (const char* heading) : opt(myOpts)
#ifdef HAS_PETSC
, adm(PETSC_COMM_WORLD)
#elif defined(HAVE_MPI)
@ -44,7 +43,7 @@ SIMinput::SIMinput (const char* heading) : opt(myOpts)
}
SIMinput::SIMinput (SIMinput& anotherSIM) : opt(anotherSIM.myOpts)
SIMadmin::SIMadmin (SIMadmin& anotherSIM) : opt(anotherSIM.myOpts)
{
adm = anotherSIM.adm;
myPid = anotherSIM.myPid;
@ -52,7 +51,7 @@ SIMinput::SIMinput (SIMinput& anotherSIM) : opt(anotherSIM.myOpts)
}
void SIMinput::printHeading (int& subStep) const
void SIMadmin::printHeading (int& subStep) const
{
if (myHeading.empty())
return;
@ -66,7 +65,7 @@ void SIMinput::printHeading (int& subStep) const
}
bool SIMinput::read (const char* fileName)
bool SIMadmin::read (const char* fileName)
{
static int substep = 0;
this->printHeading(substep);
@ -84,24 +83,24 @@ bool SIMinput::read (const char* fileName)
}
bool SIMinput::readFlat (const char* fileName)
bool SIMadmin::readFlat (const char* fileName)
{
std::ifstream is(fileName);
if (!is)
{
std::cerr <<"\n *** SIMinput::read: Failure opening input file "
<< fileName << std::endl;
std::cerr <<"\n *** SIMadmin::read: Failure opening input file \""
<< fileName <<"\"."<< std::endl;
return false;
}
IFEM::cout <<"\nReading input file "<< fileName << std::endl;
char* keyWord = 0;
char* keyWord = nullptr;
while (is.good() && (keyWord = utl::readLine(is)))
if (!this->parse(keyWord,is))
{
std::cerr <<" *** SIMinput::read: Failure occured while parsing \""
<< keyWord <<"\""<< std::endl;
std::cerr <<" *** SIMadmin::read: Failure occured while parsing \""
<< keyWord <<"\"."<< std::endl;
return false;
}
@ -111,9 +110,9 @@ bool SIMinput::readFlat (const char* fileName)
}
bool SIMinput::parse (char*, std::istream&)
bool SIMadmin::parse (char*, std::istream&)
{
std::cerr <<" *** SIMinput::parse(char*,std::istream&):"
std::cerr <<" *** SIMadmin::parse(char*,std::istream&):"
<<" The flat file format is depreciated.\n"
<<" Use the XML format instead."<< std::endl;
return false;

View File

@ -1,50 +1,52 @@
// $Id$
//==============================================================================
//!
//! \file SIMinput.h
//! \file SIMadmin.h
//!
//! \date Jun 1 2010
//!
//! \author Knut Morten Okstad / SINTEF
//!
//! \brief Base class for simulators with input parsing functionality.
//! \brief Administration base class for FEM simulators.
//!
//==============================================================================
#ifndef _SIM_INPUT_H
#define _SIM_INPUT_H
#ifndef _SIM_ADMIN_H
#define _SIM_ADMIN_H
#include "XMLInputBase.h"
#include "SIMoptions.h"
#include "ProcessAdm.h"
#include "XMLInputBase.h"
#include <iostream>
#include <vector>
#include <string>
/*!
\brief Base class for NURBS-based FEM simulators with input file parsing.
\brief Administration base class for FEM simulators.
\details This class serves as a common base for all types of simulator drivers
in IFEM and contains the general top-level methods for reading the model input
file, as well as data for administration of parallel executions.
*/
class SIMinput : public XMLInputBase
class SIMadmin : public XMLInputBase
{
protected:
//! \brief The default constructor initializes the process administrator.
SIMinput(const char* heading = nullptr);
SIMadmin(const char* heading = nullptr);
//! \brief Copy constructor.
SIMinput(SIMinput& anotherSIM);
SIMadmin(SIMadmin& anotherSIM);
public:
//! \brief Empty destructor.
virtual ~SIMinput() {}
virtual ~SIMadmin() {}
//! \brief Reads model data from the specified input file \a *fileName.
virtual bool read(const char* fileName);
public:
using XMLInputBase::parse;
//! \brief Parses a data section from an input stream.
virtual bool parse(char* keyWord, std::istream& is);
//! \brief Parses a data section from an XML element.
virtual bool parse(const TiXmlElement* elem) = 0;
//! \brief Returns the parallel process administrator.
const ProcessAdm& getProcessAdm() const { return adm; }
@ -59,24 +61,23 @@ public:
void setHeading(const std::string& heading) { myHeading = heading; }
protected:
//! \brief Prints the heading of this (sub-step) solver, if any, to std::cout.
//! \brief Prints the heading of this simulator, if any, to IFEM::cout.
void printHeading(int& supStep) const;
//! \brief Reads a flat text input file (obsolete file format).
//! \brief Reads a flat text input file (the old file format).
bool readFlat(const char* fileName);
public:
static int msgLevel; //!< Controls the amount of console output during solving
static int msgLevel; //!< Controls the console output amount during solving
SIMoptions& opt; //!< Simulation control parameters
private:
SIMoptions myOpts; //!< The actual control parameters owned by this simulator
SIMoptions myOpts; //!< Actual control parameters owned by this simulator
protected:
ProcessAdm adm; //!< Parallel administrator
int myPid; //!< Processor ID in parallel simulations
int nProc; //!< Number of processors in parallel simulations
std::string myHeading; //!< Heading written before reading the input file
};

View File

@ -14,7 +14,7 @@
#ifndef _SIM_BASE_H
#define _SIM_BASE_H
#include "SIMinput.h"
#include "SIMadmin.h"
#include "SIMdependency.h"
#include "TimeDomain.h"
#include "TopologySet.h"
@ -61,7 +61,7 @@ struct Mode
Sub-classes are derived with additional info regarding the problem to solve.
*/
class SIMbase : public SIMinput, public SIMdependency
class SIMbase : public SIMadmin, public SIMdependency
{
protected:
//! \brief The constructor initializes the pointers to dynamic data members.

View File

@ -15,7 +15,6 @@
#define SIM_OPTIONS_H_
#include "ASMenums.h"
#include <iostream>
#include <string>
#include <map>

View File

@ -13,7 +13,6 @@
#include "XMLInputBase.h"
#include "IFEM.h"
#include "tinyxml.h"
#include <algorithm>
@ -39,9 +38,9 @@ void XMLInputBase::injectIncludeFiles (TiXmlElement* tag) const
foundIncludes = true;
}
else
std::cerr << __PRETTY_FUNCTION__ <<": Failed to load "
std::cerr <<" *** SIMadmin::read: Failed to load \""
<< elem->FirstChild()->Value()
<<"\n\tError at line "<< doc.ErrorRow() <<": "
<<"\".\n\tError at line "<< doc.ErrorRow() <<": "
<< doc.ErrorDesc() << std::endl;
}
@ -56,16 +55,16 @@ bool XMLInputBase::readXML (const char* fileName, bool verbose)
{
TiXmlDocument doc;
if (!doc.LoadFile(fileName)) {
std::cerr << __PRETTY_FUNCTION__ <<": Failed to load "<< fileName
<<"\n\tError at line "<< doc.ErrorRow() <<": "
std::cerr <<" *** SIMadmin::read: Failed to load \""<< fileName
<<"\".\n\tError at line "<< doc.ErrorRow() <<": "
<< doc.ErrorDesc() << std::endl;
return false;
}
const TiXmlElement* tag = doc.RootElement();
if (!tag || strcmp(tag->Value(),"simulation")) {
std::cerr << __PRETTY_FUNCTION__ <<": Malformatted input file "<< fileName
<< std::endl;
std::cerr <<" *** SIMadmin::read: Malformatted input file \""<< fileName
<<"\"."<< std::endl;
return false;
}
@ -83,8 +82,8 @@ bool XMLInputBase::readXML (const char* fileName, bool verbose)
if (verbose)
IFEM::cout <<"\nParsing <"<< tag->Value() <<">"<< std::endl;
if (!this->parse(tag)) {
std::cerr <<" *** SIMinput::read: Failure occured while parsing \""
<< tag->Value() <<"\""<< std::endl;
std::cerr <<" *** SIMadmin::read: Failure occured while parsing \""
<< tag->Value() <<"\"."<< std::endl;
return false;
}
}
@ -108,8 +107,8 @@ bool XMLInputBase::handlePriorityTags (const TiXmlElement* base,
if (verbose)
IFEM::cout <<"\nParsing <"<< elem->Value() <<">"<< std::endl;
if (!this->parse(elem)) {
std::cerr <<" *** SIMinput::read: Failure occured while parsing \""
<< elem->Value() <<"\""<< std::endl;
std::cerr <<" *** SIMadmin::read: Failure occured while parsing \""
<< elem->Value() <<"\"."<< std::endl;
return false;
}
parsed.push_back(elem);

View File

@ -19,16 +19,18 @@
class TiXmlElement;
/*! \brief Base class for XML based input file parsing.
* \details This is inherited by SIMinput for input parsing handling,
* and is also used in applications for pre-parsing the input file.
*/
/*!
\brief Base class for XML based input file parsing.
\details This class is inherited by SIMadmin for input parsing handling,
and is also used in applications for pre-parsing of the input file.
*/
class XMLInputBase
{
public:
//! \brief Reads an XML input file.
//! \param fileName File to read
//! \param verbose True to print the tags being parsed to output
//! \param[in] fileName File to read
//! \param[in] verbose True to print the tags being parsed to output
bool readXML(const char* fileName, bool verbose = true);
protected: