MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / check

Method check

SRC/analysis/analysis/ResponseSpectrumAnalysis.cpp:432–474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

430}
431
432int ResponseSpectrumAnalysis::check()
433{
434 // get the domain
435 Domain* domain = m_model->getDomainPtr();
436
437 // get the modal properties
438 //const DomainModalProperties& mp = domain->getModalProperties();
439 DomainModalProperties mp;
440 if (domain->getModalProperties(mp) < 0) {
441 opserr << "ResponseSpectrumAnalysis::check() - failed to get modal properties" << endln;
442 return -1;
443 }
444
445 // number of eigen-modes
446 int num_eigen = domain->getEigenvalues().Size();
447 if (num_eigen < 1) {
448 opserr << "ResponseSpectrumAnalysis::check() - No Eigenvalue provided.\n";
449 return -1;
450 }
451
452 // check consistency
453 auto check_eigen = [&mp, domain]() -> bool {
454 const Vector& ev = domain->getEigenvalues();
455 if (ev.Size() != mp.eigenvalues().Size())
456 return false;
457 double tol = std::max(1.0e-15, 1.0e-12 * ev.Norm());
458 for (int i = 0; i < ev.Size(); ++i) {
459 double a = ev(i);
460 double b = mp.eigenvalues()(i);
461 if (std::abs(a - b) > tol)
462 return false;
463 }
464 return true;
465 };
466 if (!check_eigen()) {
467 opserr << "ResponseSpectrumAnalysis::check() - Eigenvalues stored in DomainModalProperties are not equal to the eigenvalues in the model.\n"
468 "Make sure to call the 'modalProperties' command\n"
469 "after the 'eigen' command, and right before the 'responseSpectrum' command.\n";
470 return -1;
471 }
472
473 return 0;
474}
475
476int ResponseSpectrumAnalysis::beginMode()
477{

Callers

nothing calls this directly

Calls 4

getModalPropertiesMethod · 0.80
getDomainPtrMethod · 0.45
SizeMethod · 0.45
NormMethod · 0.45

Tested by

no test coverage detected