51 #include "../sm/EngineeringModels/structengngmodel.h" 52 #include "../sm/Elements/Beams/beam2d.h" 53 #include "../sm/Elements/Beams/beam3d.h" 89 int ret = std :: sscanf(line.c_str(),
"#NODE tStep %d number %d dof %d unknown %c value %le tolerance %le",
92 ret = std :: sscanf(line.c_str(),
"#NODE tStep %d tStepVer %d number %d dof %d unknown %c value %le tolerance %le",
96 OOFEM_ERROR(
"Something wrong in the error checking rule: %s\n", line.c_str());
99 if ( unknown ==
'd' ) {
101 }
else if ( unknown ==
'v' ) {
103 }
else if ( unknown ==
'a' ) {
104 mode = VM_Acceleration;
106 OOFEM_ERROR(
"Can't recognize unknown '%c'", unknown);
137 OOFEM_WARNING(
"Check failed in %s: tstep %d, node %d, dof %d, mode %d:\n" 138 "value is %.8e, but should be %.8e ( error is %e but tolerance is %e )",
150 int ret = std :: sscanf(line.c_str(),
"#ELEMENT tStep %d number %d irule %d gp %d keyword %d component %d value %le tolerance %le",
153 ret = std :: sscanf(line.c_str(),
"#ELEMENT tStep %d tStepVer %d number %d irule %d gp %d keyword %d component %d value %le tolerance %le",
156 ret = std :: sscanf(line.c_str(),
"#ELEMENT tStep %d tStepVer %d number %d gp %d keyword %d component %d value %le tolerance %le",
159 }
else if ( ret < 3 ) {
160 ret = std :: sscanf(line.c_str(),
"#ELEMENT tStep %d number %d gp %d keyword %d component %d value %le tolerance %le",
164 OOFEM_ERROR(
"Something wrong in the error checking rule: %s\n", line.c_str());
196 OOFEM_WARNING(
"Check failed in %s: element %d, gpnum %d, ist %d, component %d:\n" 197 "Component not found!",
206 OOFEM_WARNING(
"Check failed in %s: tstep %d, element %d, gpnum %d, ist %d, component %d:\n" "value is %.8e, but should be %.8e ( error is %e but tolerance is %e )",
218 int ret = std :: sscanf(line.c_str(),
"#BEAM_ELEMENT tStep %d number %d keyword %d component %d value %le tolerance %le",
221 ret = std :: sscanf(line.c_str(),
"#BEAM_ELEMENT tStep %d tStepVer %d number %d keyword %d component %d value %le tolerance %le",
225 OOFEM_ERROR(
"Something wrong in the error checking rule: %s\n", line.c_str());
255 if(
Beam2d* b = dynamic_cast<Beam2d*>(element)) b->giveEndForcesVector(val, tStep);
256 else if(
Beam3d* b = dynamic_cast<Beam3d*>(element)) b->giveEndForcesVector(val, tStep);
264 OOFEM_WARNING(
"Check failed in %s: beam_element %d, ist %d, component %d:\n" 265 "Component not found!",
274 OOFEM_WARNING(
"Check failed in %s: tstep %d, beam_element %d, ist %d, component %d:\n" 275 "value is %.8e, but should be %.8e ( error is %e but tolerance is %e )",
287 int ret = std :: sscanf(line.c_str(),
"#REACTION tStep %d number %d dof %d value %le tolerance %le",
290 ret = std :: sscanf(line.c_str(),
"#REACTION tStep %d tStepVer %d number %d dof %d value %le tolerance %le",
294 OOFEM_ERROR(
"Something wrong in the error checking rule: %s\n", line.c_str());
314 IntArray restrDofMans, restrDofs, eqn;
320 for ( index = 1; index <= restrDofs.
giveSize(); ++index ) {
335 double reactionForce = reactionForces.
at(index);
338 OOFEM_WARNING(
"Check failed in %s: tstep %d, reaction forces number %d, dof %d:\n" 339 "value is %.8e, but should be %.8e ( error is %e but tolerance is %e )",
345 OOFEM_WARNING(
"Reaction forces only supported for structural problems yet");
354 int ret = std :: sscanf(line.c_str(),
"#LOADLEVEL tStep %d value %le tolerance %le",
357 OOFEM_ERROR(
"Something wrong in the error checking rule: %s\n", line.c_str());
374 "value is %.8e, but should be %.8e ( error is %e but tolerance is %e )",
385 int ret = std :: sscanf(line.c_str(),
"#EIGVAL tStep %d EigNum %d value %le tolerance %le",
388 OOFEM_ERROR(
"Something wrong in the error checking rule: %s\n", line.c_str());
403 OOFEM_WARNING(
"Check failed in %s: tstep %d, eigen value %d:\n" 404 "value is %.8e, but should be %.8e ( error is %e but tolerance is %e )",
439 std :: ifstream inputStream(this->
filename);
440 if ( !inputStream ) {
447 std :: unique_ptr< ErrorCheckingRule > rule(this->
giveErrorCheck(inputStream, tol));
462 OOFEM_WARNING(
"No rules found (possibly wrong file or syntax).");
482 this->
allPassed &= rule->check(domain, tStep);
487 OOFEM_ERROR(
"Rule not passed, exiting with error");
501 std :: cout <<
"#%BEGIN_CHECK% tolerance 1.e-3\n";
505 for (
Dof *dof: *dman ) {
506 if ( dof->giveEqn() < 0 ) {
509 std :: cout <<
"#NODE tStep " << tStep->
giveNumber();
510 std :: cout <<
" number " << dman->giveNumber();
511 std :: cout <<
" dof " << dof->giveDofID();
512 std :: cout <<
" unknown " <<
'd';
513 std :: cout <<
" value " << dof->giveUnknown(VM_Total, tStep);
514 std :: cout << std :: endl;
525 for (
int component = 1; component <= ipval.
giveSize(); ++component ) {
526 std :: cout <<
"#ELEMENT tStep " << tStep->
giveNumber();
527 std :: cout <<
" number " << element->giveNumber();
528 std :: cout <<
" gp " << gpnum+1;
529 std :: cout <<
" keyword " << ist;
530 std :: cout <<
" component " << component;
531 std :: cout <<
" value " << ipval.
at(component);
532 std :: cout << std :: endl;
539 std :: cout <<
"#%END_CHECK%" << std :: endl;
547 while ( !stream.eof() ) {
549 std :: getline(stream, line);
550 if ( line.compare(0, 14,
"#%BEGIN_CHECK%") == 0 ) {
551 errorTolerance = 1e-6;
552 if ( line.size() >= 25 ) {
553 errorTolerance = std :: stod( line.substr(25) );
565 while ( !stream.eof() ) {
566 std :: getline(stream, line);
567 if ( line.compare(0, 12,
"#%END_CHECK%") == 0 ) {
570 if ( line.size() > 2 && line[0] ==
'#' && line[1] !=
'#' ) {
575 if ( line.compare(0, 5,
"#NODE") == 0 ) {
577 }
else if ( line.compare(0, 8,
"#ELEMENT") == 0 ) {
579 }
else if ( line.compare(0, 13,
"#BEAM_ELEMENT") == 0 ) {
581 }
else if ( line.compare(0, 9,
"#REACTION") == 0 ) {
583 }
else if ( line.compare(0, 10,
"#LOADLEVEL") == 0 ) {
585 }
else if ( line.compare(0, 7,
"#EIGVAL") == 0 ) {
588 OOFEM_ERROR(
"Unsupported rule '%s'", line.c_str());
bool scanToErrorChecks(std::ifstream &stream, double &errorTolerance)
InternalStateType
Type representing the physical meaning of element or constitutive model internal variable.
Checks a beam element value (in terms of end forces and and-displacements)
bool testTimeStepOutput(TimeStep *tStep)
Tests if given time step output is required.
DofManager in active domain is shared only by remote elements (these are only introduced for nonlocal...
virtual bool check(Domain *domain, TimeStep *tStep)
Checks if the rule is correct.
LoadLevelErrorCheckingRule(const std::string &line, double tol)
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in full form.
std::string giveOutputBaseFileName()
Returns base output file name to which extensions, like .out .vtu .osf should be added.
void computeVectorOf(ValueModeType u, TimeStep *tStep, FloatArray &answer)
Returns local vector of unknowns.
virtual IntegrationRule * giveIntegrationRule(int i)
double & at(int i)
Coefficient access function.
virtual double giveUnknown(ValueModeType mode, TimeStep *tStep)=0
The key method of class Dof.
virtual bool check(Domain *domain, TimeStep *tStep)
Checks if the rule is correct.
This class implements a 2-dimensional beam element with cubic lateral displacement, quadratic rotations, and linear longitudinal displacements and geometry.
EngngModel * giveEngngModel()
Returns engineering model to which receiver is associated.
bool isParallel() const
Returns true if receiver in parallel mode.
Abstract base class for all finite elements.
Base class for dof managers.
std::vector< std::unique_ptr< DofManager > > & giveDofManagers()
#define _IFT_ErrorCheckingExportModule_filename
Filename where rules are defined (normally the input file).
Checks a reaction force value.
int giveNumber()
Returns domain number.
virtual bool check(Domain *domain, TimeStep *tStep)
Checks if the rule is correct.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Checks a reaction force value.
Represents export output module - a base class for all output modules.
Class implementing an array of integers.
int & at(int i)
Coefficient access function.
Checks error in analysis (for automatic regression tests).
Abstract base class representing integration rule.
bool isTheFirstStep()
Check if receiver is first step.
virtual bool check(Domain *domain, TimeStep *tStep)
Checks if the rule is correct.
void buildReactionTable(IntArray &restrDofMans, IntArray &restrDofs, IntArray &eqn, TimeStep *tStep, int di)
Builds the reaction force table.
NodeErrorCheckingRule(const std::string &line, double tol)
#define OOFEM_LOG_INFO(...)
int giveNumber()
Returns receiver's number.
void clear()
Clears the array (zero size).
EngngModel * emodel
Problem pointer.
std::string giveReferenceFileName()
Returns reference file name.
DofManager * giveGlobalDofManager(int n)
Service for accessing particular domain dof manager.
#define _IFT_ErrorCheckingExportModule_writeIST
Which internal state types to write rules for.
virtual double giveLoadLevel()
Returns the current load level.
ElementErrorCheckingRule(const std::string &line, double tol)
bool checkValue(double computedValue)
Element * giveGlobalElement(int n)
Service for accessing particular domain fe element.
Class representing vector of real numbers.
elementParallelMode giveParallelMode() const
Return elementParallelMode of receiver.
Element is local, there are no contributions from other domains to this element.
This class implements a 2-dimensional beam element with cubic lateral displacement interpolation (rot...
IRResultType
Type defining the return values of InputRecord reading operations.
ErrorCheckingRule * giveErrorCheck(std::ifstream &stream, double errorTolerance)
GaussPoint * getIntegrationPoint(int n)
Access particular integration point of receiver.
virtual void doOutput(TimeStep *tStep, bool forcedOutput=false)
Writes the output.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
virtual void printYourself() const
Print receiver on stdout.
Dof * giveDofWithID(int dofID) const
Returns DOF with given dofID; issues error if not present.
int giveNumberOfIntegrationPoints() const
Returns number of integration points of receiver.
Error checking rule used for regressions tests.
void writeCheck(Domain *domain, TimeStep *tStep)
virtual bool check(Domain *domain, TimeStep *tStep)
Checks if the rule is correct.
virtual double giveEigenValue(int eigNum)
Only relevant for eigen value analysis. Otherwise returns zero.
EigenValueErrorCheckingRule(const std::string &line, double tol)
int giveVersion()
Returns receiver's version.
This class implements extension of EngngModel for structural models.
std::vector< std::unique_ptr< Element > > & giveElements()
void computeReaction(FloatArray &answer, TimeStep *tStep, int di)
Computes reaction forces.
ErrorCheckingExportModule(int n, EngngModel *e)
Abstract base class representing the "problem" under consideration.
DofManager in active domain is only mirror of some remote DofManager.
int giveSize() const
Returns the size of receiver.
Node * giveNode(int n)
Service for accessing particular domain node.
the oofem namespace is to define a context or scope in which all oofem names are defined.
BeamElementErrorCheckingRule(const std::string &line, double tol)
Domain * giveDomain(int n)
Service for accessing particular problem domain.
Abstract class Dof represents Degree Of Freedom in finite element mesh.
bool isNotTheLastStep()
Check if solution step is not the last step.
std::vector< std::unique_ptr< ErrorCheckingRule > > errorCheckingRules
virtual bool check(Domain *domain, TimeStep *tStep)
Checks if the rule is correct.
Class representing integration point in finite element program.
#define OOFEM_WARNING(...)
Class representing solution step.
dofManagerParallelMode giveParallelMode() const
Return dofManagerParallelMode of receiver.
REGISTER_ExportModule(ErrorCheckingExportModule)
ReactionErrorCheckingRule(const std::string &line, double tol)