Skip to content

Commit

Permalink
print to new output streams instead of std::cout
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.sintef.no/trondheim/IFEM/trunk@3160 e10b68d5-8a6e-419e-a041-bce267b0401d
  • Loading branch information
akva authored and kmokstad committed Feb 2, 2016
1 parent a5fc53f commit ed81f13
Show file tree
Hide file tree
Showing 12 changed files with 122 additions and 122 deletions.
10 changes: 5 additions & 5 deletions Elasticity.C
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ Elasticity::~Elasticity ()
}


void Elasticity::print (std::ostream& os) const
void Elasticity::print (utl::LogStream& os) const
{
if (axiSymmetry)
std::cout <<"Axial-symmetric Elasticity problem\n";
std::cout <<"Elasticity: "<< nsd <<"D, gravity =";
os <<"Axial-symmetric Elasticity problem\n";
os <<"Elasticity: "<< nsd <<"D, gravity =";
for (unsigned short int d = 0; d < nsd; d++)
std::cout <<" "<< gravity[d];
std::cout << std::endl;
os <<" "<< gravity[d];
os << std::endl;

if (material)
material->print(os);
Expand Down
2 changes: 1 addition & 1 deletion Elasticity.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Elasticity : public ElasticBase
virtual ~Elasticity();

//! \brief Prints out the problem definition to the given output stream.
virtual void print(std::ostream& os) const;
virtual void print(utl::LogStream& os) const;

//! \brief Defines the traction field to use in Neumann boundary conditions.
void setTraction(TractionFunc* tf) { tracFld = tf; }
Expand Down
33 changes: 17 additions & 16 deletions LinIsotropic.C
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "Utilities.h"
#include "Functions.h"
#include "Field.h"
#include "IFEM.h"
#include "Tensor.h"
#include "Vec3.h"
#include "tinyxml.h"
Expand Down Expand Up @@ -58,59 +59,59 @@ LinIsotropic::LinIsotropic (Field* E, double v, double den, bool ps, bool ax)
void LinIsotropic::parse (const TiXmlElement* elem)
{
if (utl::getAttribute(elem,"E",Emod))
std::cout <<" "<< Emod;
IFEM::cout <<" "<< Emod;
if (utl::getAttribute(elem,"nu",nu))
std::cout <<" "<< nu;
IFEM::cout <<" "<< nu;
if (utl::getAttribute(elem,"rho",rho))
std::cout <<" "<< rho;
IFEM::cout <<" "<< rho;
if (utl::getAttribute(elem,"alpha",alpha))
std::cout <<" "<< alpha;
IFEM::cout <<" "<< alpha;
if (utl::getAttribute(elem,"cp",heatcapacity))
std::cout <<" "<< heatcapacity;
IFEM::cout <<" "<< heatcapacity;
if (utl::getAttribute(elem,"kappa",conductivity))
std::cout <<" "<< conductivity;
IFEM::cout <<" "<< conductivity;

const TiXmlNode* aval = NULL;
const TiXmlElement* child = elem->FirstChildElement();
for (; child; child = child->NextSiblingElement())
if (!strcasecmp(child->Value(),"thermalexpansion"))
{
std::cout <<" ";
IFEM::cout <<" ";
std::string type;
utl::getAttribute(child,"type",type,true);
if ((aval = child->FirstChild()))
Afunc = utl::parseTimeFunc(aval->Value(),type);
}
else if (!strcasecmp(child->Value(),"heatcapacity"))
{
std::cout <<" ";
IFEM::cout <<" ";
std::string type;
utl::getAttribute(child,"type",type,true);
if ((aval = child->FirstChild()))
Cpfunc = utl::parseTimeFunc(aval->Value(),type);
}
else if (!strcasecmp(child->Value(),"conductivity"))
{
std::cout <<" ";
IFEM::cout <<" ";
std::string type;
utl::getAttribute(child,"type",type,true);
if ((aval = child->FirstChild()))
condFunc = utl::parseTimeFunc(aval->Value(),type);
}

if (!aval) std::cout << std::endl;
if (!aval) IFEM::cout << std::endl;
}


void LinIsotropic::print (std::ostream& os) const
void LinIsotropic::print (utl::LogStream& os) const
{
std::cout <<"LinIsotropic: ";
os <<"LinIsotropic: ";
if (axiSymmetry)
std::cout <<"axial-symmetric, ";
os <<"axial-symmetric, ";
else if (planeStress)
std::cout <<"plane stress, ";
std::cout <<"E = "<< Emod <<", nu = "<< nu <<", rho = "<< rho
<<", alpha = "<< alpha << std::endl;
os <<"plane stress, ";
os <<"E = "<< Emod <<", nu = "<< nu <<", rho = "<< rho
<<", alpha = "<< alpha << std::endl;
}


Expand Down
2 changes: 1 addition & 1 deletion LinIsotropic.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class LinIsotropic : public Material
virtual void parse(const TiXmlElement* elem);

//! \brief Prints out material parameters to the given output stream.
virtual void print(std::ostream& os) const;
virtual void print(utl::LogStream& os) const;

//! \brief Returns \e false if plane stress in 2D.
virtual bool isPlaneStrain() const { return !planeStress; }
Expand Down
6 changes: 3 additions & 3 deletions Linear/KirchhoffLovePlate.C
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ KirchhoffLovePlate::~KirchhoffLovePlate ()
}


void KirchhoffLovePlate::print (std::ostream& os) const
void KirchhoffLovePlate::print (utl::LogStream& os) const
{
std::cout <<"KirchhoffLovePlate: thickness = "<< thickness
<<", gravity = "<< gravity << std::endl;
os <<"KirchhoffLovePlate: thickness = "<< thickness
<<", gravity = "<< gravity << std::endl;

if (!material)
{
Expand Down
2 changes: 1 addition & 1 deletion Linear/KirchhoffLovePlate.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class KirchhoffLovePlate : public IntegrandBase
virtual ~KirchhoffLovePlate();

//! \brief Prints out the problem definition to the given output stream.
virtual void print(std::ostream& os) const;
virtual void print(utl::LogStream& os) const;

//! \brief Defines the solution mode before the element assembly is started.
//! \param[in] mode The solution mode to use
Expand Down
26 changes: 13 additions & 13 deletions Linear/SIMLinEl2D.C
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ template<> bool SIMLinEl2D::parseDimSpecific (const TiXmlElement* child)
utl::getAttribute(child,"a",a);
utl::getAttribute(child,"F0",F0);
utl::getAttribute(child,"nu",nu);
std::cout <<"\tAnalytical solution: Hole a="<< a <<" F0="<< F0
<<" nu="<< nu << std::endl;
IFEM::cout <<"\tAnalytical solution: Hole a="<< a <<" F0="<< F0
<<" nu="<< nu << std::endl;
if (!mySol)
mySol = new AnaSol(new Hole(a,F0,nu));
}
Expand All @@ -124,8 +124,8 @@ template<> bool SIMLinEl2D::parseDimSpecific (const TiXmlElement* child)
utl::getAttribute(child,"a",a);
utl::getAttribute(child,"F0",F0);
utl::getAttribute(child,"nu",nu);
std::cout <<"\tAnalytical solution: Lshape a="<< a <<" F0="<< F0
<<" nu="<< nu << std::endl;
IFEM::cout <<"\tAnalytical solution: Lshape a="<< a <<" F0="<< F0
<<" nu="<< nu << std::endl;
if (!mySol)
mySol = new AnaSol(new Lshape(a,F0,nu));
}
Expand All @@ -134,8 +134,8 @@ template<> bool SIMLinEl2D::parseDimSpecific (const TiXmlElement* child)
utl::getAttribute(child,"L",L);
utl::getAttribute(child,"H",H);
utl::getAttribute(child,"F0",F0);
std::cout <<"\tAnalytical solution: CanTS L="<< L <<" H="<< H
<<" F0="<< F0 << std::endl;
IFEM::cout <<"\tAnalytical solution: CanTS L="<< L <<" H="<< H
<<" F0="<< F0 << std::endl;
if (!mySol)
mySol = new AnaSol(new CanTS(L,H,F0));
}
Expand All @@ -144,8 +144,8 @@ template<> bool SIMLinEl2D::parseDimSpecific (const TiXmlElement* child)
utl::getAttribute(child,"L",L);
utl::getAttribute(child,"H",H);
utl::getAttribute(child,"M0",M0);
std::cout <<"\tAnalytical solution: CanTM H="<< H
<<" M0="<< M0 << std::endl;
IFEM::cout <<"\tAnalytical solution: CanTM H="<< H
<<" M0="<< M0 << std::endl;
if (!mySol)
mySol = new AnaSol(new CanTM(H,M0));
}
Expand All @@ -155,13 +155,13 @@ template<> bool SIMLinEl2D::parseDimSpecific (const TiXmlElement* child)
utl::getAttribute(child,"b",b);
utl::getAttribute(child,"u0",u0);
utl::getAttribute(child,"E",E);
std::cout <<"\tAnalytical solution: Curved Beam a="<< a <<" b="<< b
<<" u0="<< u0 <<" E="<< E << std::endl;
IFEM::cout <<"\tAnalytical solution: Curved Beam a="<< a <<" b="<< b
<<" u0="<< u0 <<" E="<< E << std::endl;
if (!mySol)
mySol = new AnaSol(new CurvedBeam(u0,a,b,E));
}
else if (type == "expression") {
std::cout <<"\tAnalytical solution: Expression"<< std::endl;
IFEM::cout <<"\tAnalytical solution: Expression"<< std::endl;
if (!mySol)
mySol = new AnaSol(child,false);
}
Expand All @@ -173,8 +173,8 @@ template<> bool SIMLinEl2D::parseDimSpecific (const TiXmlElement* child)
int code = 0;
utl::getAttribute(child,"code",code);
if (code > 0 && mySol && mySol->getStressSol()) {
std::cout <<"\tNeumann code "<< code
<<": Analytical traction"<< std::endl;
IFEM::cout <<"\tNeumann code "<< code
<<": Analytical traction"<< std::endl;
this->setPropertyType(code,Property::NEUMANN);
myTracs[code] = new TractionField(*mySol->getStressSol());
}
Expand Down
24 changes: 12 additions & 12 deletions Linear/SIMLinEl3D.C
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public:
//! \brief Constructor printing a message making user aware of its presense.
CylinderCS()
{
std::cout <<"\nLocal coordinate system: Cylindric"<< std::endl;
IFEM::cout <<"\nLocal coordinate system: Cylindric"<< std::endl;
}

//! \brief Computes the global-to-local transformation at the point \a X.
Expand Down Expand Up @@ -59,7 +59,7 @@ public:
//! \brief Constructor printing a message making user aware of its presense.
CylinderSphereCS(double H = 0.0) : h(H)
{
std::cout <<"\nLocal coordinate system: Cylindric with Spherical cap, h="
IFEM::cout <<"\nLocal coordinate system: Cylindric with Spherical cap, h="
<< h << std::endl;
#ifdef PRINT_CS
sn.open("nodes.dat");
Expand All @@ -77,7 +77,7 @@ public:

virtual ~CylinderSphereCS()
{
std::cout <<"Finalizing VTF-output of local coordinate systems"<< std::endl;
IFEM::cout <<"Finalizing VTF-output of local coordinate systems"<< std::endl;
s1 <<"\n*GLVIEWVECTOR 2\n%NAME \"v1\"\n%STEP 1\n31\n";
s2 <<"\n*GLVIEWVECTOR 3\n%NAME \"v2\"\n%STEP 1\n32\n";
s3 <<"\n*GLVIEWVECTOR 4\n%NAME \"v3\"\n%STEP 1\n33\n";
Expand Down Expand Up @@ -234,8 +234,8 @@ template<> bool SIMLinEl3D::parseDimSpecific (const TiXmlElement* child)
utl::getAttribute(child,"a",a);
utl::getAttribute(child,"F0",F0);
utl::getAttribute(child,"nu",nu);
std::cout <<"\tAnalytical solution: Hole a="<< a <<" F0="<< F0
<<" nu="<< nu << std::endl;
IFEM::cout <<"\tAnalytical solution: Hole a="<< a <<" F0="<< F0
<<" nu="<< nu << std::endl;
if (!mySol)
mySol = new AnaSol(new Hole(a,F0,nu,true));
}
Expand All @@ -244,8 +244,8 @@ template<> bool SIMLinEl3D::parseDimSpecific (const TiXmlElement* child)
utl::getAttribute(child,"a",a);
utl::getAttribute(child,"F0",F0);
utl::getAttribute(child,"nu",nu);
std::cout <<"\tAnalytical solution: Lshape a="<< a <<" F0="<< F0
<<" nu="<< nu << std::endl;
IFEM::cout <<"\tAnalytical solution: Lshape a="<< a <<" F0="<< F0
<<" nu="<< nu << std::endl;
if (!mySol)
mySol = new AnaSol(new Lshape(a,F0,nu,true));
}
Expand All @@ -254,13 +254,13 @@ template<> bool SIMLinEl3D::parseDimSpecific (const TiXmlElement* child)
utl::getAttribute(child,"L",L);
utl::getAttribute(child,"H",H);
utl::getAttribute(child,"F0",F0);
std::cout <<"\tAnalytical solution: CanTS L="<< L <<" H="<< H
<<" F0="<< F0 << std::endl;
IFEM::cout <<"\tAnalytical solution: CanTS L="<< L <<" H="<< H
<<" F0="<< F0 << std::endl;
if (!mySol)
mySol = new AnaSol(new CanTS(L,H,F0,true));
}
else if (type == "expression") {
std::cout <<"\tAnalytical solution: Expression"<< std::endl;
IFEM::cout <<"\tAnalytical solution: Expression"<< std::endl;
if (!mySol)
mySol = new AnaSol(child,false);
}
Expand All @@ -272,8 +272,8 @@ template<> bool SIMLinEl3D::parseDimSpecific (const TiXmlElement* child)
int code = 0;
utl::getAttribute(child,"code",code);
if (code > 0 && mySol && mySol->getStressSol()) {
std::cout <<"\tNeumann code "<< code
<<": Analytical traction"<< std::endl;
IFEM::cout <<"\tNeumann code "<< code
<<": Analytical traction"<< std::endl;
setPropertyType(code,Property::NEUMANN);
myTracs[code] = new TractionField(*mySol->getStressSol());
}
Expand Down
3 changes: 1 addition & 2 deletions Linear/SIMLinElKL.C
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,7 @@ bool SIMLinElKL::initBodyLoad (size_t patchInd)

void SIMLinElKL::preprocessA ()
{
if (myPid == 0)
this->printProblem(std::cout);
this->printProblem(IFEM::cout);

ThinPlateSol* plSol = dynamic_cast<ThinPlateSol*>(mySol);
if (!plSol) return;
Expand Down
Loading

0 comments on commit ed81f13

Please sign in to comment.