147 std::sort(v.begin(), v.end());
162 if( strcasecmp(op.c_str(),
"DIFFERENCE") == 0) {
163 std::set_difference(v1.begin(), v1.end(), v2.begin(), v2.end(), std::inserter(v, v.begin()));
165 else if(strcasecmp(op.c_str(),
"INTERSECTION") == 0){
166 std::set_intersection(v1.begin(), v1.end(), v2.begin(), v2.end(), back_inserter(v));
168 else if(strcasecmp(op.c_str(),
"UNION") == 0){
169 std::set_union(v1.begin(), v1.end(), v2.begin(), v2.end(), std::back_inserter(v));
174 auto last = std::unique(v.begin(), v.end());
175 v.erase(last, v.end());
189 unsigned int num = jsonFile[Name].
as_object().size();
190 std::vector<T> Tags(num);
194 for(
auto it = jsonFile[Name].as_object().begin(); it != jsonFile[Name].
as_object().end(); ++it){
196 unsigned int Tag = std::stoi(it->first);
215 std::vector<T> Tags = mesh->GetVectorIDs<T>(Name);
229 std::map<std::string, std::vector<T> >
232 std::vector<T> v1 = GetIDsFromJSON<T>(jsonFile, Name);
233 std::vector<T> v2 = GetIDsFromMESH<T>(mesh, Name);
236 std::map<std::string, std::vector<T> > Tags;
237 Tags[
"add"] = setOperation<T>(v1,v2,
"Difference");
238 Tags[
"del"] = setOperation<T>(v2,v1,
"Difference");
239 Tags[
"mod"] = setOperation<T>(v1,v2,
"Intersection");
252 std::string auxName = theFile;
253 std::string subDomainMesh;
256 std::stringstream process;
261 pos = auxName.find(
"$");
262 if(pos !=std::string::npos)
263 auxName.replace(pos, std::string(
"$").length(), process.str());
267 subDomainMesh =
filePath +
"/" + auxName;
270 subDomainMesh = auxName;
273 return subDomainMesh;
283 std::string auxName = theFile;
284 std::string subDomainMesh;
288 pos = auxName.find(
"~");
289 while(pos != std::string::npos){
290 auxName.replace(pos, std::string(
"~").length(), toReplace);
291 pos = auxName.find(
"~");
295 subDomainMesh = auxName;
297 return subDomainMesh;
306 std::map<std::string, std::vector<unsigned int> > Tags = Entities2Update<unsigned int>(theMesh, jsonFile,
"Nodes");
309 for(
unsigned int k = 0; k < Tags[
"del"].size(); k++){
310 unsigned int Tag = Tags[
"del"][k];
311 theMesh->DelNode(Tag);
315 for(
unsigned int k = 0; k < Tags[
"add"].size(); k++){
316 unsigned int Tag = Tags[
"add"][k];
320 unsigned int nDofs = jsonFile[
"Nodes"][nTag][
"ndof"].as<
int>();
323 std::vector<int> freeDofs(nDofs,0);
324 std::vector<int> totalDofs(nDofs,0);
329 for(
int k = 0; k < jsonFile[
"Nodes"][nTag][
"freedof"].size(); ++k)
330 freeDofs[k] = jsonFile[
"Nodes"][nTag][
"freedof"][k].as<int>();
332 for(
int k = 0; k < jsonFile[
"Nodes"][nTag][
"totaldof"].size(); ++k)
333 totalDofs[k] = jsonFile[
"Nodes"][nTag][
"totaldof"][k].as<int>();
335 for(
int k = 0; k < jsonFile[
"Nodes"][nTag][
"coords"].size(); ++k)
336 coordinates(k) = jsonFile[
"Nodes"][nTag][
"coords"][k].as<
double>();
339 bool IsFixed =
false;
340 if(std::find(freeDofs.begin(), freeDofs.end(), -1) != freeDofs.end())
344 std::shared_ptr<Node> theNode = std::make_shared<Node>(nDofs, coordinates, IsFixed);
347 theNode->SetFreeDegreeOfFreedom(freeDofs);
348 theNode->SetTotalDegreeOfFreedom(totalDofs);
351 theMesh->AddNode(Tag, theNode);
355 if( Tags[
"mod"].
size() > 0){
356 std::map<unsigned int, std::shared_ptr<Node> > theNodes = theMesh->GetNodes();
358 for(
unsigned int k = 0; k < Tags[
"mod"].size(); k++){
359 unsigned int Tag = Tags[
"mod"][k];
363 unsigned int nDofs = jsonFile[
"Nodes"][nTag][
"ndof"].as<
int>();
366 std::vector<int> freeDofs(nDofs,0);
367 for(
int k = 0; k < jsonFile[
"Nodes"][nTag][
"freedof"].size(); ++k)
368 freeDofs[k] = jsonFile[
"Nodes"][nTag][
"freedof"][k].as<int>();
370 std::vector<int> totalDofs(nDofs,0);
371 for(
int k = 0; k < jsonFile[
"Nodes"][nTag][
"totaldof"].size(); ++k)
372 totalDofs[k] = jsonFile[
"Nodes"][nTag][
"totaldof"][k].as<int>();
375 for(
int k = 0; k < jsonFile[
"Nodes"][nTag][
"coords"].size(); ++k)
376 coordinates(k) = jsonFile[
"Nodes"][nTag][
"coords"][k].as<
double>();
379 bool IsFixed =
false;
380 if(std::find(freeDofs.begin(), freeDofs.end(), -1) != freeDofs.end())
384 theNodes[Tag]->SetAsFixed(IsFixed);
385 theNodes[Tag]->SetCoordinates(coordinates);
386 theNodes[Tag]->SetFreeDegreeOfFreedom(freeDofs);
387 theNodes[Tag]->SetTotalDegreeOfFreedom(totalDofs);
398 std::map<std::string, std::vector<unsigned int> > Tags = Entities2Update<unsigned int>(theMesh, jsonFile,
"Masses");
401 for(
unsigned int k = 0; k < Tags[
"del"].size(); k++){
402 unsigned int Tag = Tags[
"del"][k];
403 theMesh->DelMass(Tag);
407 for(
unsigned int k = 0; k < Tags[
"add"].size(); k++){
409 unsigned int Tag = Tags[
"add"][k];
411 unsigned int nDofs = jsonFile[
"Masses"][nTag][
"ndof"].as<
int>();
413 Eigen::VectorXd Mass(nDofs);
414 for(
unsigned int k = 0; k < nDofs; ++k)
415 Mass(k) = jsonFile[
"Masses"][nTag][
"mass"][k].as<
double>();
418 theMesh->AddMass(Tag, Mass);
422 for(
unsigned int k = 0; k < Tags[
"mod"].size(); k++){
423 unsigned int Tag = Tags[
"mod"][k];
425 unsigned int nDofs = jsonFile[
"Masses"][nTag][
"ndof"].as<
int>();
427 Eigen::VectorXd Mass(nDofs);
428 for(
unsigned int k = 0; k < nDofs; ++k)
429 Mass(k) = jsonFile[
"Masses"][nTag][
"mass"][k].as<
double>();
432 theMesh->AddMass(Tag, Mass);
442 std::map<std::string, std::vector<int> > Tags = Entities2Update<int>(theMesh, jsonFile,
"Constraints");
445 for(
unsigned int k = 0; k < Tags[
"del"].size(); k++){
446 int Tag = Tags[
"del"][k];
447 theMesh->DelConstraint(Tag);
451 for(
unsigned int k = 0; k < Tags[
"add"].size(); k++){
453 int Tag = Tags[
"add"][k];
457 unsigned int stag = jsonFile[
"Constraints"][cTag][
"stag"].as<
int>();
458 unsigned int nCombs = jsonFile[
"Constraints"][cTag][
"mtag"].size();
461 std::vector<double> factors(nCombs);
462 std::vector<unsigned int> mtag(nCombs);
464 for(
unsigned int k = 0; k < nCombs; ++k){
465 mtag[k] = jsonFile[
"Constraints"][cTag][
"mtag"][k].as<
int>();
466 factors[k] = jsonFile[
"Constraints"][cTag][
"factor"][k].as<
double>();
470 std::shared_ptr<Constraint> theConstraint = std::make_shared<Constraint>(stag, mtag, factors);
473 theMesh->AddConstraint(Tag, theConstraint);
477 if( Tags[
"mod"].
size() > 0){
478 std::map<int, std::shared_ptr<Constraint> > theConstraints = theMesh->GetConstraints();
480 for(
unsigned int k = 0; k < Tags[
"mod"].size(); k++){
481 int Tag = Tags[
"mod"][k];
485 unsigned int stag = jsonFile[
"Constraints"][cTag][
"stag"].as<
int>();
486 unsigned int nCombs = jsonFile[
"Constraints"][cTag][
"mtag"].size();
489 std::vector<double> factors(nCombs);
490 std::vector<unsigned int> mtag(nCombs);
492 for(
unsigned int k = 0; k < nCombs; ++k){
493 mtag[k] = jsonFile[
"Constraints"][cTag][
"mtag"][k].as<
int>();
494 factors[k] = jsonFile[
"Constraints"][cTag][
"factor"][k].as<
double>();
498 theConstraints[Tag]->SetSlaveInformation(stag);
499 theConstraints[Tag]->SetMasterInformation(mtag);
500 theConstraints[Tag]->SetCombinationFactors(factors);
511 std::map<std::string, std::vector<int> > Tags = Entities2Update<int>(theMesh, jsonFile,
"Supports");
514 for(
unsigned int k = 0; k < Tags[
"del"].size(); k++){
515 unsigned int Tag = Tags[
"del"][k];
516 theMesh->DelSupportMotion(Tag);
520 for(
unsigned int k = 0; k < Tags[
"add"].size(); k++){
522 unsigned int Tag = Tags[
"add"][k];
524 std::string Name = jsonFile[
"Supports"][nTag][
"type"].as<std::string>();
526 for(
int n = 0; n < jsonFile[
"Supports"][nTag][
"dof"].size(); ++n){
528 std::vector<double> Xo;
530 if(strcasecmp(Name.c_str(),
"CONSTANT") == 0){
532 Xo[0] = jsonFile[
"Supports"][nTag][
"value"][n].as<
double>();
534 else if(strcasecmp(Name.c_str(),
"TIMESERIES") == 0){
535 std::string File = jsonFile[
"Supports"][nTag][
"file"][n].as<std::string>();
537 std::ifstream motion(File.c_str());
540 if(motion.is_open()){
547 for(
unsigned int j = 0; j < nt; j++)
553 dof = jsonFile[
"Supports"][nTag][
"dof"][n].as<
int>();
556 theMesh->SetSupportMotion(Tag, dof, Xo);
569 std::vector<unsigned int> Tags = theMesh->GetVectorIDs<
unsigned int>(
"Materials");
572 for(
auto it = jsonFile[
"Materials"].as_object().begin(); it != jsonFile[
"Materials"].
as_object().end(); ++it){
574 unsigned int Tag = std::stoi(it->first);
577 if (std::find(Tags.begin(), Tags.end(), Tag) == Tags.end()) {
579 unsigned int Tag = std::stoi(it->first);
580 std::string Name = it->second[
"name"].as<std::string>();
583 std::unique_ptr<Material> theMaterial;
585 if(strcasecmp(Name.c_str(),
"Elastic1DLinear") == 0){
586 double E = it->second[
"attributes"][
"E"].as<
double>(0.0);
587 double nu = it->second[
"attributes"][
"nu"].as<
double>(0.0);
588 double rho = it->second[
"attributes"][
"rho"].as<
double>(0.0);
591 theMaterial = std::make_unique<Elastic1DLinear>(E, nu, rho);
593 else if(strcasecmp(Name.c_str(),
"Hertzian1DLinear") == 0){
594 double k1 = it->second[
"attributes"][
"k1"].as<
double>(0.0);
595 double k2 = it->second[
"attributes"][
"k2"].as<
double>(0.0);
596 double k3 = it->second[
"attributes"][
"k3"].as<
double>(0.0);
597 double rho = it->second[
"attributes"][
"rho"].as<
double>(0.0);
600 theMaterial = std::make_unique<Hertzian1DLinear>(k1, k2, k3, rho);
602 else if(strcasecmp(Name.c_str(),
"Viscous1DLinear") == 0){
603 double eta = it->second[
"attributes"][
"eta"].as<
double>(0.0);
606 theMaterial =std::make_unique<Viscous1DLinear>(eta);
608 else if(strcasecmp(Name.c_str(),
"Elastic2DPlaneStrain") == 0){
609 double E = it->second[
"attributes"][
"E"].as<
double>(0.0);
610 double nu = it->second[
"attributes"][
"nu"].as<
double>(0.0);
611 double rho = it->second[
"attributes"][
"rho"].as<
double>(0.0);
614 theMaterial = std::make_unique<Elastic2DPlaneStrain>(E, nu, rho);
616 else if(strcasecmp(Name.c_str(),
"Elastic2DPlaneStress") == 0){
617 double E = it->second[
"attributes"][
"E"].as<
double>(0.0);
618 double nu = it->second[
"attributes"][
"nu"].as<
double>(0.0);
619 double rho = it->second[
"attributes"][
"rho"].as<
double>(0.0);
622 theMaterial = std::make_unique<Elastic2DPlaneStress>(E, nu, rho);
624 else if(strcasecmp(Name.c_str(),
"Elastic3DLinear") == 0){
625 double E = it->second[
"attributes"][
"E"].as<
double>(0.0);
626 double nu = it->second[
"attributes"][
"nu"].as<
double>(0.0);
627 double rho = it->second[
"attributes"][
"rho"].as<
double>(0.0);
630 theMaterial = std::make_unique<Elastic3DLinear>(E, nu, rho);
632 else if(strcasecmp(Name.c_str(),
"Plastic1DJ2") == 0){
633 double E = it->second[
"attributes"][
"E"].as<
double>(0.0);
634 double nu = it->second[
"attributes"][
"nu"].as<
double>(0.0);
635 double rho = it->second[
"attributes"][
"rho"].as<
double>(0.0);
636 double K = it->second[
"attributes"][
"k"].as<
double>(0.0);
637 double H = it->second[
"attributes"][
"h"].as<
double>(0.0);
638 double Sy = it->second[
"attributes"][
"Sy"].as<
double>(0.0);
641 theMaterial = std::make_unique<Plastic1DJ2>(E, nu, rho, K, H, Sy);
643 else if(strcasecmp(Name.c_str(),
"PlasticPlaneStrainJ2") == 0){
644 double K = it->second[
"attributes"][
"K"].as<
double>(0.0);
645 double G = it->second[
"attributes"][
"G"].as<
double>(0.0);
646 double rho = it->second[
"attributes"][
"rho"].as<
double>(0.0);
647 double H = it->second[
"attributes"][
"h"].as<
double>(0.0);
648 double Sy = it->second[
"attributes"][
"Sy"].as<
double>(0.0);
649 double beta = it->second[
"attributes"][
"beta"].as<
double>(0.0);
652 theMaterial = std::make_unique<PlasticPlaneStrainJ2>(K, G, rho, H, beta, Sy);
654 else if(strcasecmp(Name.c_str(),
"PlasticPlaneStrainBA") == 0){
655 double K = it->second[
"attributes"][
"K"].as<
double>(0.0);
656 double G = it->second[
"attributes"][
"G"].as<
double>(0.0);
657 double rho = it->second[
"attributes"][
"rho"].as<
double>(0.0);
658 double h0 = it->second[
"attributes"][
"h0"].as<
double>(0.0);
659 double h = it->second[
"attributes"][
"h"].as<
double>(0.0);
660 double m = it->second[
"attributes"][
"m"].as<
double>(0.0);
661 double Su = it->second[
"attributes"][
"Su"].as<
double>(0.0);
662 double beta = it->second[
"attributes"][
"beta"].as<
double>(0.0);
665 theMaterial = std::make_unique<PlasticPlaneStrainBA>(K, G, rho, h0, h, m, Su, beta);
667 else if(strcasecmp(Name.c_str(),
"Plastic3DJ2") == 0){
668 double K = it->second[
"attributes"][
"K"].as<
double>(0.0);
669 double G = it->second[
"attributes"][
"G"].as<
double>(0.0);
670 double rho = it->second[
"attributes"][
"rho"].as<
double>(0.0);
671 double h = it->second[
"attributes"][
"h"].as<
double>(0.0);
672 double Sy = it->second[
"attributes"][
"Sy"].as<
double>(0.0);
673 double beta = it->second[
"attributes"][
"beta"].as<
double>(0.0);
676 theMaterial = std::make_unique<Plastic3DJ2>(K, G, rho, h, beta, Sy);
678 else if(strcasecmp(Name.c_str(),
"Plastic3DBA") == 0){
679 double K = it->second[
"attributes"][
"K"].as<
double>(0.0);
680 double G = it->second[
"attributes"][
"G"].as<
double>(0.0);
681 double rho = it->second[
"attributes"][
"rho"].as<
double>(0.0);
682 double h0 = it->second[
"attributes"][
"h0"].as<
double>(0.0);
683 double h = it->second[
"attributes"][
"h"].as<
double>(0.0);
684 double m = it->second[
"attributes"][
"m"].as<
double>(0.0);
685 double Su = it->second[
"attributes"][
"Su"].as<
double>(0.0);
686 double beta = it->second[
"attributes"][
"beta"].as<
double>(0.0);
689 theMaterial = std::make_unique<Plastic3DBA>(K, G, rho, h0, h, m, Su, beta);
691 else if(strcasecmp(Name.c_str(),
"Elastic1DFiber") == 0){
692 double E = it->second[
"attributes"][
"E"].as<
double>(0.0);
693 double nu = it->second[
"attributes"][
"nu"].as<
double>(0.0);
694 double rho = it->second[
"attributes"][
"rho"].as<
double>(0.0);
697 theMaterial = std::make_unique<Elastic1DFiber>(E, nu, rho);
699 else if(strcasecmp(Name.c_str(),
"Elastic1DGap") == 0){
700 double E = it->second[
"attributes"][
"E"].as<
double>(0.0);
701 double gap = it->second[
"attributes"][
"gap"].as<
double>(0.0);
702 double behavior = it->second[
"attributes"][
"behavior"].as<
bool>(
false);
705 theMaterial = std::make_unique<Elastic1DGap>(E, gap, behavior);
707 else if(strcasecmp(Name.c_str(),
"Plastic1DGap") == 0){
708 double E = it->second[
"attributes"][
"E"].as<
double>(0.0);
709 double fy = it->second[
"attributes"][
"fy"].as<
double>(0.0);
710 double eta = it->second[
"attributes"][
"ratio"].as<
double>(0.0);
711 double gap = it->second[
"attributes"][
"gap"].as<
double>(0.0);
712 double behavior = it->second[
"attributes"][
"behavior"].as<
bool>(
false);
715 theMaterial = std::make_unique<Plastic1DGap>(E, fy, gap, eta, behavior);
717 else if(strcasecmp(Name.c_str(),
"Steel1DFiber") == 0){
718 double E = it->second[
"attributes"][
"E"].as<
double>(0.0);
719 double fy = it->second[
"attributes"][
"fy"].as<
double>(0.0);
720 double b = it->second[
"attributes"][
"b"].as<
double>(0.0);
721 double R0 = it->second[
"attributes"][
"R0"].as<
double>(15.00);
722 double cR1 = it->second[
"attributes"][
"cR1"].as<
double>(0.925);
723 double cR2 = it->second[
"attributes"][
"cR2"].as<
double>(0.150);
724 double a1 = it->second[
"attributes"][
"a1"].as<
double>(0.0);
725 double a2 = it->second[
"attributes"][
"a2"].as<
double>(1.0);
726 double a3 = it->second[
"attributes"][
"a3"].as<
double>(0.0);
727 double a4 = it->second[
"attributes"][
"a4"].as<
double>(1.0);
728 double nu = it->second[
"attributes"][
"nu"].as<
double>(0.33);
729 double rho = it->second[
"attributes"][
"rho"].as<
double>(0.0);
732 theMaterial = std::make_unique<Steel1DFiber>(fy, E, b, R0, cR1, cR2, a1, a2, a3, a4, nu, rho);
734 else if(strcasecmp(Name.c_str(),
"Concrete1DFiber") == 0){
735 double fc = it->second[
"attributes"][
"fc"].as<
double>();
736 double ecc = it->second[
"attributes"][
"ecc"].as<
double>(-0.002);
737 double fcu = it->second[
"attributes"][
"fcu"].as<
double>();
738 double ecu = it->second[
"attributes"][
"ecu"].as<
double>(-0.012);
739 double ratio = it->second[
"attributes"][
"ratio"].as<
double>(0.1);
740 double ft = it->second[
"attributes"][
"ft"].as<
double>(0.0);
741 double Et = it->second[
"attributes"][
"Et"].as<
double>(0.0);
742 double nu = it->second[
"attributes"][
"nu"].as<
double>(0.25);
743 double rho = it->second[
"attributes"][
"rho"].as<
double>(0.0);
746 theMaterial = std::make_unique<Concrete1DFiber>(fc, ecc, fcu, ecu, ratio, ft, Et, nu, rho);
752 theMesh->AddMaterial(Tag, theMaterial);
763 std::vector<unsigned int> Tags = theMesh->GetVectorIDs<
unsigned int>(
"Sections");
766 for(
auto it = jsonFile[
"Sections"].as_object().begin(); it != jsonFile[
"Sections"].
as_object().end(); ++it){
768 unsigned int Tag = std::stoi(it->first);
771 if (std::find(Tags.begin(), Tags.end(), Tag) == Tags.end()) {
773 unsigned int Tag = std::stoi(it->first);
774 std::string Name = it->second[
"name"].as<std::string>();
775 std::string Model = it->second[
"model"].as<std::string>();
778 std::unique_ptr<Section> theSection;
780 if(strcasecmp(Model.c_str(),
"Plain") == 0){
782 double theta = it->second[
"attributes"][
"theta"].as<
double>(0.0);
783 unsigned int ip = it->second[
"attributes"][
"ip"].as<
int>(10);
784 unsigned int matTag = it->second[
"attributes"][
"material"].as<
int>();
786 if(strcasecmp(Name.c_str(),
"Lin2DRectangular") == 0){
787 double h = it->second[
"attributes"][
"h"].as<
double>();
788 double b = it->second[
"attributes"][
"b"].as<
double>();
791 theSection = std::make_unique<Lin2DRectangular>(h, b, theMesh->GetMaterial(matTag), theta, ip);
793 else if(strcasecmp(Name.c_str(),
"Lin3DRectangular") == 0){
794 double h = it->second[
"attributes"][
"h"].as<
double>();
795 double b = it->second[
"attributes"][
"b"].as<
double>();
798 theSection = std::make_unique<Lin3DRectangular>(h, b, theMesh->GetMaterial(matTag), theta, ip);
800 else if(strcasecmp(Name.c_str(),
"Lin2DRectangularTube") == 0){
801 double h = it->second[
"attributes"][
"h"].as<
double>();
802 double b = it->second[
"attributes"][
"b"].as<
double>();
803 double tw = it->second[
"attributes"][
"tw"].as<
double>();
804 double tf = it->second[
"attributes"][
"tf"].as<
double>();
807 theSection = std::make_unique<Lin2DRectangularTube>(h, b, tw, tf, theMesh->GetMaterial(matTag), theta, ip);
809 else if(strcasecmp(Name.c_str(),
"Lin3DRectangularTube") == 0){
810 double h = it->second[
"attributes"][
"h"].as<
double>();
811 double b = it->second[
"attributes"][
"b"].as<
double>();
812 double tw = it->second[
"attributes"][
"tw"].as<
double>();
813 double tf = it->second[
"attributes"][
"tf"].as<
double>();
816 theSection = std::make_unique<Lin3DRectangularTube>(h, b, tw, tf, theMesh->GetMaterial(matTag), theta, ip);
818 else if(strcasecmp(Name.c_str(),
"Lin2DCircular") == 0){
819 double r = it->second[
"attributes"][
"r"].as<
double>();
822 theSection = std::make_unique<Lin2DCircular>(r, theMesh->GetMaterial(matTag), theta, ip);
824 else if(strcasecmp(Name.c_str(),
"Lin3DCircular") == 0){
825 double r = it->second[
"attributes"][
"r"].as<
double>();
828 theSection = std::make_unique<Lin3DCircular>(r, theMesh->GetMaterial(matTag), theta, ip);
830 else if(strcasecmp(Name.c_str(),
"Lin2DCircularTube") == 0){
831 double re = it->second[
"attributes"][
"re"].as<
double>();
832 double ri = it->second[
"attributes"][
"ri"].as<
double>();
835 theSection = std::make_unique<Lin2DCircularTube>(re, ri, theMesh->GetMaterial(matTag), theta, ip);
837 else if(strcasecmp(Name.c_str(),
"Lin3DCircularTube") == 0){
838 double re = it->second[
"attributes"][
"re"].as<
double>();
839 double ri = it->second[
"attributes"][
"ri"].as<
double>();
842 theSection = std::make_unique<Lin3DCircularTube>(re, ri, theMesh->GetMaterial(matTag), theta, ip);
844 else if(strcasecmp(Name.c_str(),
"Lin2DAngle") == 0){
845 double h = it->second[
"attributes"][
"h"].as<
double>();
846 double b = it->second[
"attributes"][
"b"].as<
double>();
847 double tw = it->second[
"attributes"][
"tw"].as<
double>();
848 double tf = it->second[
"attributes"][
"tf"].as<
double>();
851 theSection = std::make_unique<Lin2DAngle>(h, b, tw, tf, theMesh->GetMaterial(matTag), theta, ip);
853 else if(strcasecmp(Name.c_str(),
"Lin3DAngle") == 0){
854 double h = it->second[
"attributes"][
"h"].as<
double>();
855 double b = it->second[
"attributes"][
"b"].as<
double>();
856 double tw = it->second[
"attributes"][
"tw"].as<
double>();
857 double tf = it->second[
"attributes"][
"tf"].as<
double>();
860 theSection = std::make_unique<Lin3DAngle>(h, b, tw, tf, theMesh->GetMaterial(matTag), theta, ip);
862 else if(strcasecmp(Name.c_str(),
"Lin2DChannel") == 0){
863 double h = it->second[
"attributes"][
"h"].as<
double>();
864 double b = it->second[
"attributes"][
"b"].as<
double>();
865 double tw = it->second[
"attributes"][
"tw"].as<
double>();
866 double tf = it->second[
"attributes"][
"tf"].as<
double>();
869 theSection = std::make_unique<Lin2DChannel>(h, b, tw, tf, theMesh->GetMaterial(matTag), theta, ip);
871 else if(strcasecmp(Name.c_str(),
"Lin3DChannel") == 0){
872 double h = it->second[
"attributes"][
"h"].as<
double>();
873 double b = it->second[
"attributes"][
"b"].as<
double>();
874 double tw = it->second[
"attributes"][
"tw"].as<
double>();
875 double tf = it->second[
"attributes"][
"tf"].as<
double>();
878 theSection = std::make_unique<Lin3DChannel>(h, b, tw, tf, theMesh->GetMaterial(matTag), theta, ip);
880 if(strcasecmp(Name.c_str(),
"Lin2DTee") == 0){
881 double h = it->second[
"attributes"][
"h"].as<
double>();
882 double b = it->second[
"attributes"][
"b"].as<
double>();
883 double tw = it->second[
"attributes"][
"tw"].as<
double>();
884 double tf = it->second[
"attributes"][
"tf"].as<
double>();
887 theSection = std::make_unique<Lin2DTee>(h, b, tw, tf, theMesh->GetMaterial(matTag), theta, ip);
889 if(strcasecmp(Name.c_str(),
"Lin3DTee") == 0){
890 double h = it->second[
"attributes"][
"h"].as<
double>();
891 double b = it->second[
"attributes"][
"b"].as<
double>();
892 double tw = it->second[
"attributes"][
"tw"].as<
double>();
893 double tf = it->second[
"attributes"][
"tf"].as<
double>();
896 theSection = std::make_unique<Lin3DTee>(h, b, tw, tf, theMesh->GetMaterial(matTag), theta, ip);
898 else if(strcasecmp(Name.c_str(),
"Lin2DWideFlange") == 0){
899 double h = it->second[
"attributes"][
"h"].as<
double>();
900 double b = it->second[
"attributes"][
"b"].as<
double>();
901 double tw = it->second[
"attributes"][
"tw"].as<
double>();
902 double tf = it->second[
"attributes"][
"tf"].as<
double>();
905 theSection = std::make_unique<Lin2DWideFlange>(h, b, tw, tf, theMesh->GetMaterial(matTag), theta, ip);
907 else if(strcasecmp(Name.c_str(),
"Lin3DWideFlange") == 0){
908 double h = it->second[
"attributes"][
"h"].as<
double>();
909 double b = it->second[
"attributes"][
"b"].as<
double>();
910 double tw = it->second[
"attributes"][
"tw"].as<
double>();
911 double tf = it->second[
"attributes"][
"tf"].as<
double>();
914 theSection = std::make_unique<Lin3DWideFlange>(h, b, tw, tf, theMesh->GetMaterial(matTag), theta, ip);
916 else if(strcasecmp(Name.c_str(),
"Lin2DUserDefined") == 0){
917 std::vector<double> prop(3, 0.0);
918 prop[0] = it->second[
"attributes"][
"A"].as<
double>();
919 prop[1] = it->second[
"attributes"][
"As2"].as<
double>(0.0);
920 prop[2] = it->second[
"attributes"][
"I33"].as<
double>();
923 theSection = std::make_unique<Lin2DUserDefined>(prop, theMesh->GetMaterial(matTag), theta);
925 else if(strcasecmp(Name.c_str(),
"Lin3DUserDefined") == 0){
926 std::vector<double> prop(7, 0.0);
927 prop[0] = it->second[
"attributes"][
"A"].as<
double>();
928 prop[3] = it->second[
"attributes"][
"J"].as<
double>();
929 prop[1] = it->second[
"attributes"][
"As2"].as<
double>(0.0);
930 prop[2] = it->second[
"attributes"][
"As3"].as<
double>(0.0);
931 prop[4] = it->second[
"attributes"][
"I22"].as<
double>();
932 prop[5] = it->second[
"attributes"][
"I33"].as<
double>();
933 prop[6] = it->second[
"attributes"][
"I23"].as<
double>(0.0);
936 theSection = std::make_unique<Lin3DUserDefined>(prop, theMesh->GetMaterial(matTag), theta);
938 else if(strcasecmp(Name.c_str(),
"Lin3DThinArea") == 0){
939 double th = it->second[
"attributes"][
"th"].as<
double>();
942 theSection = std::make_unique<Lin3DThinArea>(th, theMesh->GetMaterial(matTag));
945 else if(strcasecmp(Model.c_str(),
"Fiber") == 0){
946 if(strcasecmp(Name.c_str(),
"Fib3DLineSection") == 0){
948 unsigned int numOfFibers = it->second[
"attributes"][
"fiber"].size();
949 std::vector<double> zi(numOfFibers);
950 std::vector<double> yi(numOfFibers);
951 std::vector<double> Ai(numOfFibers);
952 std::vector<std::unique_ptr<Material> > fibers(numOfFibers);
955 for(
unsigned int k =0; k < numOfFibers; k++){
956 unsigned int fibTag = it->second[
"attributes"][
"fiber"][k].as<
int>();
957 zi[k] = it->second[
"attributes"][
"zi"][k].as<
double>();
958 yi[k] = it->second[
"attributes"][
"yi"][k].as<
double>();
959 Ai[k] = it->second[
"attributes"][
"Ai"][k].as<
double>();
961 theMesh->AddFiber(fibTag, fibers[k]);
964 double kappa2 = it->second[
"attributes"][
"kappa2"].as<
double>(1.00);
965 double kappa3 = it->second[
"attributes"][
"kappa3"].as<
double>(1.00);
968 double h = it->second[
"attributes"][
"h"].as<
double>();
969 double b = it->second[
"attributes"][
"b"].as<
double>();
970 unsigned int ip = it->second[
"attributes"][
"ip"].as<
int>(10);
973 double theta = it->second[
"attributes"][
"theta"].as<
double>(0.0);
976 theSection = std::make_unique<Fib3DLineSection>(h, b, fibers, zi, yi, Ai, kappa2, kappa3, theta, ip);
978 else if(strcasecmp(Name.c_str(),
"Fib3DAreaSection") == 0){
983 else if(strcasecmp(Model.c_str(),
"General") == 0){
990 theMesh->AddSection(Tag, theSection);
1001 std::map<std::string, std::vector<unsigned int> > Tags = Entities2Update<unsigned int>(theMesh, jsonFile,
"Elements");
1004 for(
unsigned int k = 0; k < Tags[
"del"].size(); k++){
1005 unsigned int Tag = Tags[
"del"][k];
1006 theMesh->DelElement(Tag);
1010 for(
unsigned int k = 0; k < Tags[
"add"].size(); k++){
1011 unsigned int Tag = Tags[
"add"][k];
1015 std::string Name = jsonFile[
"Elements"][eTag][
"name"].as<std::string>();
1018 unsigned int n = jsonFile[
"Elements"][eTag][
"conn"].size();
1019 std::vector<unsigned int> nodes(n);
1020 for(
unsigned int k = 0; k < n; ++k)
1021 nodes[k] = jsonFile[
"Elements"][eTag][
"conn"][k].as<int>();
1024 std::shared_ptr<Element> theElement;
1026 if(strcasecmp(Name.c_str(),
"lin2DTruss2") == 0){
1027 unsigned int matID = jsonFile[
"Elements"][eTag][
"attributes"][
"material"].as<
int>();
1028 double parameters = jsonFile[
"Elements"][eTag][
"attributes"][
"area"].as<
double>();
1031 theElement = std::make_shared<lin2DTruss2>(nodes, theMesh->GetMaterial(matID), parameters);
1033 else if(strcasecmp(Name.c_str(),
"kin2DTruss2") == 0){
1034 unsigned int matID = jsonFile[
"Elements"][eTag][
"attributes"][
"material"].as<
int>();
1035 double parameters = jsonFile[
"Elements"][eTag][
"attributes"][
"area"].as<
double>();
1038 theElement = std::make_shared<kin2DTruss2>(nodes, theMesh->GetMaterial(matID), parameters);
1040 else if(strcasecmp(Name.c_str(),
"lin3DTruss2") == 0){
1041 unsigned int matID = jsonFile[
"Elements"][eTag][
"attributes"][
"material"].as<
int>();
1042 double parameters = jsonFile[
"Elements"][eTag][
"attributes"][
"area"].as<
double>();
1045 theElement = std::make_shared<lin3DTruss2>(nodes, theMesh->GetMaterial(matID), parameters);
1047 else if(strcasecmp(Name.c_str(),
"kin3DTruss2") == 0){
1048 unsigned int matID = jsonFile[
"Elements"][eTag][
"attributes"][
"material"].as<
int>();
1049 double parameters = jsonFile[
"Elements"][eTag][
"attributes"][
"area"].as<
double>();
1052 theElement = std::make_shared<kin3DTruss2>(nodes, theMesh->GetMaterial(matID), parameters);
1054 else if(strcasecmp(Name.c_str(),
"lin2DTruss3") == 0){
1055 double parameters = jsonFile[
"Elements"][eTag][
"attributes"][
"area"].as<
double>();
1056 unsigned int nGauss = jsonFile[
"Elements"][eTag][
"attributes"][
"np"].as<
int>(3);
1057 unsigned int matID = jsonFile[
"Elements"][eTag][
"attributes"][
"material"].as<
int>();
1058 std::string Quadrature = jsonFile[
"Elements"][eTag][
"attributes"][
"rule"].as<std::string>(
"GAUSS");
1061 theElement = std::make_shared<lin2DTruss3>(nodes, theMesh->GetMaterial(matID), parameters, Quadrature, nGauss);
1063 else if(strcasecmp(Name.c_str(),
"lin3DTruss3") == 0){
1064 double parameters = jsonFile[
"Elements"][eTag][
"attributes"][
"area"].as<
double>();
1065 unsigned int nGauss = jsonFile[
"Elements"][eTag][
"attributes"][
"np"].as<
int>(3);
1066 unsigned int matID = jsonFile[
"Elements"][eTag][
"attributes"][
"material"].as<
int>();
1067 std::string Quadrature = jsonFile[
"Elements"][eTag][
"attributes"][
"rule"].as<std::string>(
"GAUSS");
1070 theElement = std::make_shared<lin3DTruss3>(nodes, theMesh->GetMaterial(matID), parameters, Quadrature, nGauss);
1072 else if(strcasecmp(Name.c_str(),
"ZeroLength1D") == 0){
1073 unsigned int dir = jsonFile[
"Elements"][eTag][
"attributes"][
"dir"].as<
int>();
1074 unsigned int matID = jsonFile[
"Elements"][eTag][
"attributes"][
"material"].as<
int>();
1077 theElement = std::make_shared<ZeroLength1D>(nodes, theMesh->GetMaterial(matID), dir);
1079 else if(strcasecmp(Name.c_str(),
"UnxBoucWen2DLink") == 0){
1080 std::vector<double> variables(2, 0.0);
1081 std::vector<double> parameters(4, 0.0);
1082 double tol = jsonFile[
"Elements"][eTag][
"attributes"][
"tol"].as<
double>(1E-06);
1083 unsigned int nmax = jsonFile[
"Elements"][eTag][
"attributes"][
"nmax"].as<
int>(50);
1084 unsigned int dir = jsonFile[
"Elements"][eTag][
"attributes"][
"dir"].as<
int>();
1085 unsigned int dim = jsonFile[
"Elements"][eTag][
"attributes"][
"dim"].as<
int>();
1087 variables[0] = jsonFile[
"Elements"][eTag][
"attributes"][
"Fy"].as<
double>();
1088 variables[1] = jsonFile[
"Elements"][eTag][
"attributes"][
"k0"].as<
double>();
1089 parameters[0] = jsonFile[
"Elements"][eTag][
"attributes"][
"alpha"].as<
double>(1.0);
1090 parameters[1] = jsonFile[
"Elements"][eTag][
"attributes"][
"eta"].as<
double>(1.0);
1091 parameters[2] = jsonFile[
"Elements"][eTag][
"attributes"][
"beta"].as<
double>(0.5);
1092 parameters[3] = jsonFile[
"Elements"][eTag][
"attributes"][
"gamma"].as<
double>(0.5);
1095 theElement = std::make_shared<UnxBoucWen2DLink>(nodes, parameters, variables, dim, dir, tol, nmax);
1097 else if(strcasecmp(Name.c_str(),
"UnxBoucWen3DLink") == 0){
1098 std::vector<double> variables(2, 0.0);
1099 std::vector<double> parameters(4, 0.0);
1100 double tol = jsonFile[
"Elements"][eTag][
"attributes"][
"tol"].as<
double>(1E-06);
1101 unsigned int nmax = jsonFile[
"Elements"][eTag][
"attributes"][
"nmax"].as<
int>(50);
1102 unsigned int dir = jsonFile[
"Elements"][eTag][
"attributes"][
"dir"].as<
int>();
1103 unsigned int dim = jsonFile[
"Elements"][eTag][
"attributes"][
"dim"].as<
int>();
1105 variables[0] = jsonFile[
"Elements"][eTag][
"attributes"][
"Fy"].as<
double>();
1106 variables[1] = jsonFile[
"Elements"][eTag][
"attributes"][
"k0"].as<
double>();
1107 parameters[0] = jsonFile[
"Elements"][eTag][
"attributes"][
"alpha"].as<
double>(1.0);
1108 parameters[1] = jsonFile[
"Elements"][eTag][
"attributes"][
"eta"].as<
double>(1.0);
1109 parameters[2] = jsonFile[
"Elements"][eTag][
"attributes"][
"beta"].as<
double>(0.5);
1110 parameters[3] = jsonFile[
"Elements"][eTag][
"attributes"][
"gamma"].as<
double>(0.5);
1113 theElement = std::make_shared<UnxBoucWen3DLink>(nodes, parameters, variables, dim, dir, tol, nmax);
1115 else if(strcasecmp(Name.c_str(),
"HDRBYamamoto2DLink") == 0){
1116 double De = jsonFile[
"Elements"][eTag][
"attributes"][
"De"].as<
double>(1.3);
1117 double Di = jsonFile[
"Elements"][eTag][
"attributes"][
"Di"].as<
double>(0.3);
1118 double Hr = jsonFile[
"Elements"][eTag][
"attributes"][
"Hr"].as<
double>(0.261);
1119 unsigned int dim = jsonFile[
"Elements"][eTag][
"attributes"][
"dim"].as<
int>();
1122 theElement = std::make_shared<HDRBYamamoto2DLink>(nodes, De, Di, Hr, dim);
1124 else if(strcasecmp(Name.c_str(),
"HDRBYamamoto3DLink") == 0){
1125 double De = jsonFile[
"Elements"][eTag][
"attributes"][
"De"].as<
double>(1.3);
1126 double Di = jsonFile[
"Elements"][eTag][
"attributes"][
"Di"].as<
double>(0.3);
1127 double Hr = jsonFile[
"Elements"][eTag][
"attributes"][
"Hr"].as<
double>(0.261);
1128 unsigned int dim = jsonFile[
"Elements"][eTag][
"attributes"][
"dim"].as<
int>();
1131 theElement = std::make_shared<HDRBYamamoto3DLink>(nodes, De, Di, Hr, dim);
1133 else if(strcasecmp(Name.c_str(),
"lin2DFrame2") == 0){
1134 unsigned int nGauss = jsonFile[
"Elements"][eTag][
"attributes"][
"np"].as<
int>(3);
1135 unsigned int secID = jsonFile[
"Elements"][eTag][
"attributes"][
"section"].as<
int>();
1136 std::string Quadrature = jsonFile[
"Elements"][eTag][
"attributes"][
"rule"].as<std::string>(
"GAUSS");
1137 std::string Formulation = jsonFile[
"Elements"][eTag][
"attributes"][
"formulation"].as<std::string>(
"Bernoulli");
1140 bool Condition =
false;
1141 if(strcasecmp(Formulation.c_str(),
"Timoshenko") == 0)
1145 theElement = std::make_shared<lin2DFrame2>(nodes, theMesh->GetSection(secID), Condition, Quadrature, nGauss);
1147 else if(strcasecmp(Name.c_str(),
"kin2DFrame2") == 0){
1148 unsigned int secID = jsonFile[
"Elements"][eTag][
"attributes"][
"section"].as<
int>();
1151 theElement = std::make_shared<kin2DFrame2>(nodes, theMesh->GetSection(secID));
1153 else if(strcasecmp(Name.c_str(),
"lin3DFrame2") == 0){
1154 unsigned int nGauss = jsonFile[
"Elements"][eTag][
"attributes"][
"np"].as<
int>(3);
1155 unsigned int secID = jsonFile[
"Elements"][eTag][
"attributes"][
"section"].as<
int>();
1156 std::string Quadrature = jsonFile[
"Elements"][eTag][
"attributes"][
"rule"].as<std::string>(
"GAUSS");
1157 std::string Formulation = jsonFile[
"Elements"][eTag][
"attributes"][
"formulation"].as<std::string>(
"Bernoulli");
1160 bool Condition =
false;
1161 if(strcasecmp(Formulation.c_str(),
"Timoshenko") == 0)
1165 theElement = std::make_shared<lin3DFrame2>(nodes, theMesh->GetSection(secID), Condition, Quadrature, nGauss);
1167 else if(strcasecmp(Name.c_str(),
"lin2DTria3") == 0){
1168 double thickness = jsonFile[
"Elements"][eTag][
"attributes"][
"th"].as<
double>();
1169 unsigned int nGauss = jsonFile[
"Elements"][eTag][
"attributes"][
"np"].as<
int>(4);
1170 unsigned int matID = jsonFile[
"Elements"][eTag][
"attributes"][
"material"].as<
int>();
1171 std::string Quadrature = jsonFile[
"Elements"][eTag][
"attributes"][
"rule"].as<std::string>(
"GAUSS");
1174 theElement = std::make_shared<lin2DTria3>(nodes, theMesh->GetMaterial(matID), thickness, Quadrature, nGauss);
1176 else if(strcasecmp(Name.c_str(),
"lin2DTria6") == 0){
1177 double thickness = jsonFile[
"Elements"][eTag][
"attributes"][
"th"].as<
double>();
1178 unsigned int nGauss = jsonFile[
"Elements"][eTag][
"attributes"][
"np"].as<
int>(9);
1179 unsigned int matID = jsonFile[
"Elements"][eTag][
"attributes"][
"material"].as<
int>();
1180 std::string Quadrature = jsonFile[
"Elements"][eTag][
"attributes"][
"rule"].as<std::string>(
"GAUSS");
1183 theElement = std::make_shared<lin2DTria6>(nodes, theMesh->GetMaterial(matID), thickness, Quadrature, nGauss);
1185 else if(strcasecmp(Name.c_str(),
"lin2DQuad4") == 0){
1186 double thickness = jsonFile[
"Elements"][eTag][
"attributes"][
"th"].as<
double>();
1187 unsigned int nGauss = jsonFile[
"Elements"][eTag][
"attributes"][
"np"].as<
int>(4);
1188 unsigned int matID = jsonFile[
"Elements"][eTag][
"attributes"][
"material"].as<
int>();
1189 std::string Quadrature = jsonFile[
"Elements"][eTag][
"attributes"][
"rule"].as<std::string>(
"GAUSS");
1192 theElement = std::make_shared<lin2DQuad4>(nodes, theMesh->GetMaterial(matID), thickness, Quadrature, nGauss);
1194 else if(strcasecmp(Name.c_str(),
"lin2DQuad8") == 0){
1195 double thickness = jsonFile[
"Elements"][eTag][
"attributes"][
"th"].as<
double>();
1196 unsigned int nGauss = jsonFile[
"Elements"][eTag][
"attributes"][
"np"].as<
int>(9);
1197 unsigned int matID = jsonFile[
"Elements"][eTag][
"attributes"][
"material"].as<
int>();
1198 std::string Quadrature = jsonFile[
"Elements"][eTag][
"attributes"][
"rule"].as<std::string>(
"GAUSS");
1201 theElement = std::make_shared<lin2DQuad8>(nodes, theMesh->GetMaterial(matID), thickness, Quadrature, nGauss);
1203 else if(strcasecmp(Name.c_str(),
"PML2DQuad4") == 0){
1204 std::vector<double> parameters(8);
1205 parameters[0] = jsonFile[
"Elements"][eTag][
"attributes"][
"th"].as<
double>();
1206 parameters[1] = jsonFile[
"Elements"][eTag][
"attributes"][
"n"].as<
double>();
1207 parameters[2] = jsonFile[
"Elements"][eTag][
"attributes"][
"L"].as<
double>();
1208 parameters[3] = jsonFile[
"Elements"][eTag][
"attributes"][
"R"].as<
double>();
1209 parameters[4] = jsonFile[
"Elements"][eTag][
"attributes"][
"x0"][0].as<
double>();
1210 parameters[5] = jsonFile[
"Elements"][eTag][
"attributes"][
"x0"][1].as<
double>();
1211 parameters[6] = jsonFile[
"Elements"][eTag][
"attributes"][
"npml"][0].as<
double>();
1212 parameters[7] = jsonFile[
"Elements"][eTag][
"attributes"][
"npml"][1].as<
double>();
1214 unsigned int nGauss = jsonFile[
"Elements"][eTag][
"attributes"][
"np"].as<
int>(4);
1215 unsigned int matID = jsonFile[
"Elements"][eTag][
"attributes"][
"material"].as<
int>();
1216 std::string Quadrature = jsonFile[
"Elements"][eTag][
"attributes"][
"rule"].as<std::string>(
"GAUSS");
1219 theElement = std::make_shared<PML2DQuad4>(nodes, theMesh->GetMaterial(matID), parameters, Quadrature, nGauss);
1221 else if(strcasecmp(Name.c_str(),
"PML2DQuad8") == 0){
1222 std::vector<double> parameters(8);
1223 parameters[0] = jsonFile[
"Elements"][eTag][
"attributes"][
"th"].as<
double>();
1224 parameters[1] = jsonFile[
"Elements"][eTag][
"attributes"][
"n"].as<
double>();
1225 parameters[2] = jsonFile[
"Elements"][eTag][
"attributes"][
"L"].as<
double>();
1226 parameters[3] = jsonFile[
"Elements"][eTag][
"attributes"][
"R"].as<
double>();
1227 parameters[4] = jsonFile[
"Elements"][eTag][
"attributes"][
"x0"][0].as<
double>();
1228 parameters[5] = jsonFile[
"Elements"][eTag][
"attributes"][
"x0"][1].as<
double>();
1229 parameters[6] = jsonFile[
"Elements"][eTag][
"attributes"][
"npml"][0].as<
double>();
1230 parameters[7] = jsonFile[
"Elements"][eTag][
"attributes"][
"npml"][1].as<
double>();
1232 unsigned int nGauss = jsonFile[
"Elements"][eTag][
"attributes"][
"np"].as<
int>(9);
1233 unsigned int matID = jsonFile[
"Elements"][eTag][
"attributes"][
"material"].as<
int>();
1234 std::string Quadrature = jsonFile[
"Elements"][eTag][
"attributes"][
"rule"].as<std::string>(
"GAUSS");
1237 theElement = std::make_shared<PML2DQuad8>(nodes, theMesh->GetMaterial(matID), parameters, Quadrature, nGauss);
1239 else if(strcasecmp(Name.c_str(),
"kin2DQuad4") == 0){
1240 double thickness = jsonFile[
"Elements"][eTag][
"attributes"][
"th"].as<
double>();
1241 unsigned int nGauss = jsonFile[
"Elements"][eTag][
"attributes"][
"np"].as<
int>(4);
1242 unsigned int matID = jsonFile[
"Elements"][eTag][
"attributes"][
"material"].as<
int>();
1243 std::string Quadrature = jsonFile[
"Elements"][eTag][
"attributes"][
"rule"].as<std::string>(
"GAUSS");
1246 theElement = std::make_shared<kin2DQuad4>(nodes, theMesh->GetMaterial(matID), thickness, Quadrature, nGauss);
1248 else if(strcasecmp(Name.c_str(),
"lin3DShell4") == 0){
1249 unsigned int nGauss = jsonFile[
"Elements"][eTag][
"attributes"][
"np"].as<
int>(9);
1250 unsigned int secID = jsonFile[
"Elements"][eTag][
"attributes"][
"section"].as<
int>();
1251 std::string Quadrature = jsonFile[
"Elements"][eTag][
"attributes"][
"rule"].as<std::string>(
"GAUSS");
1254 theElement = std::make_shared<lin3DShell4>(nodes, theMesh->GetSection(secID), Quadrature, nGauss);
1256 else if(strcasecmp(Name.c_str(),
"lin3DTetra4") == 0){
1257 unsigned int nGauss = jsonFile[
"Elements"][eTag][
"attributes"][
"np"].as<
int>(4);
1258 unsigned int matID = jsonFile[
"Elements"][eTag][
"attributes"][
"material"].as<
int>();
1259 std::string Quadrature = jsonFile[
"Elements"][eTag][
"attributes"][
"rule"].as<std::string>(
"GAUSS");
1262 theElement = std::make_shared<lin3DTetra4>(nodes, theMesh->GetMaterial(matID), Quadrature, nGauss);
1264 else if(strcasecmp(Name.c_str(),
"lin3DTetra10") == 0){
1265 unsigned int nGauss = jsonFile[
"Elements"][eTag][
"attributes"][
"np"].as<
int>(11);
1266 unsigned int matID = jsonFile[
"Elements"][eTag][
"attributes"][
"material"].as<
int>();
1267 std::string Quadrature = jsonFile[
"Elements"][eTag][
"attributes"][
"rule"].as<std::string>(
"GAUSS");
1270 theElement = std::make_shared<lin3DTetra10>(nodes, theMesh->GetMaterial(matID), Quadrature, nGauss);
1272 else if(strcasecmp(Name.c_str(),
"lin3DHexa8") == 0){
1273 unsigned int nGauss = jsonFile[
"Elements"][eTag][
"attributes"][
"np"].as<
int>(8);
1274 unsigned int matID = jsonFile[
"Elements"][eTag][
"attributes"][
"material"].as<
int>();
1275 std::string Quadrature = jsonFile[
"Elements"][eTag][
"attributes"][
"rule"].as<std::string>(
"GAUSS");
1278 theElement = std::make_shared<lin3DHexa8>(nodes, theMesh->GetMaterial(matID), Quadrature, nGauss);
1280 else if(strcasecmp(Name.c_str(),
"kin3DHexa8") == 0){
1281 unsigned int nGauss = jsonFile[
"Elements"][eTag][
"attributes"][
"np"].as<
int>(8);
1282 unsigned int matID = jsonFile[
"Elements"][eTag][
"attributes"][
"material"].as<
int>();
1283 std::string Quadrature = jsonFile[
"Elements"][eTag][
"attributes"][
"rule"].as<std::string>(
"GAUSS");
1286 theElement = std::make_shared<kin3DHexa8>(nodes, theMesh->GetMaterial(matID), Quadrature, nGauss);
1288 else if(strcasecmp(Name.c_str(),
"PML3DHexa8") == 0){
1289 std::vector<double> parameters(9);
1290 parameters[0] = jsonFile[
"Elements"][eTag][
"attributes"][
"n"].as<
double>();
1291 parameters[1] = jsonFile[
"Elements"][eTag][
"attributes"][
"L"].as<
double>();
1292 parameters[2] = jsonFile[
"Elements"][eTag][
"attributes"][
"R"].as<
double>();
1293 parameters[3] = jsonFile[
"Elements"][eTag][
"attributes"][
"x0"][0].as<
double>();
1294 parameters[4] = jsonFile[
"Elements"][eTag][
"attributes"][
"x0"][1].as<
double>();
1295 parameters[5] = jsonFile[
"Elements"][eTag][
"attributes"][
"x0"][2].as<
double>();
1296 parameters[6] = jsonFile[
"Elements"][eTag][
"attributes"][
"npml"][0].as<
double>();
1297 parameters[7] = jsonFile[
"Elements"][eTag][
"attributes"][
"npml"][1].as<
double>();
1298 parameters[8] = jsonFile[
"Elements"][eTag][
"attributes"][
"npml"][2].as<
double>();
1300 unsigned int nGauss = jsonFile[
"Elements"][eTag][
"attributes"][
"np"].as<
int>(8);
1301 unsigned int matID = jsonFile[
"Elements"][eTag][
"attributes"][
"material"].as<
int>();
1302 std::string Quadrature = jsonFile[
"Elements"][eTag][
"attributes"][
"rule"].as<std::string>(
"GAUSS");
1305 theElement = std::make_shared<PML3DHexa8>(nodes, theMesh->GetMaterial(matID), parameters, Quadrature, nGauss);
1307 else if(strcasecmp(Name.c_str(),
"lin3DHexa20") == 0){
1308 unsigned int nGauss = jsonFile[
"Elements"][eTag][
"attributes"][
"np"].as<
int>(27);
1309 unsigned int matID = jsonFile[
"Elements"][eTag][
"attributes"][
"material"].as<
int>();
1310 std::string Quadrature = jsonFile[
"Elements"][eTag][
"attributes"][
"rule"].as<std::string>(
"GAUSS");
1313 theElement = std::make_shared<lin3DHexa20>(nodes, theMesh->GetMaterial(matID), Quadrature, nGauss);
1315 else if(strcasecmp(Name.c_str(),
"TIEQlin2DQuad4") == 0){
1316 double cf1 = jsonFile[
"Elements"][eTag][
"attributes"][
"cf1"].as<
double>();
1317 double cf2 = jsonFile[
"Elements"][eTag][
"attributes"][
"cf2"].as<
double>();
1318 double zref = jsonFile[
"Elements"][eTag][
"attributes"][
"zref"].as<
double>();
1319 double eref = jsonFile[
"Elements"][eTag][
"attributes"][
"eref"].as<
double>();
1320 double thickness = jsonFile[
"Elements"][eTag][
"attributes"][
"th"].as<
double>();
1321 unsigned int matID = jsonFile[
"Elements"][eTag][
"attributes"][
"material"].as<
int>();
1322 std::string eType = jsonFile[
"Elements"][eTag][
"attributes"][
"type"].as<std::string>(
"Darandelli");
1323 unsigned int nGauss = jsonFile[
"Elements"][eTag][
"attributes"][
"np"].as<
int>(4);
1324 std::string Quadrature = jsonFile[
"Elements"][eTag][
"attributes"][
"rule"].as<std::string>(
"GAUSS");
1327 theElement = std::make_shared<TIEQlin2DQuad4>(nodes, theMesh->GetMaterial(matID), thickness, Quadrature, nGauss, eType, zref, cf1, cf2, eref);
1329 else if(strcasecmp(Name.c_str(),
"EQlin2DQuad4") == 0){
1330 double cf1 = jsonFile[
"Elements"][eTag][
"attributes"][
"cf1"].as<
double>();
1331 double cf2 = jsonFile[
"Elements"][eTag][
"attributes"][
"cf2"].as<
double>();
1332 double zref = jsonFile[
"Elements"][eTag][
"attributes"][
"zref"].as<
double>();
1333 double thickness = jsonFile[
"Elements"][eTag][
"attributes"][
"th"].as<
double>();
1334 unsigned int matID = jsonFile[
"Elements"][eTag][
"attributes"][
"material"].as<
int>();
1335 std::string eType = jsonFile[
"Elements"][eTag][
"attributes"][
"type"].as<std::string>(
"Darandelli");
1336 unsigned int nGauss = jsonFile[
"Elements"][eTag][
"attributes"][
"np"].as<
int>(4);
1337 std::string Quadrature = jsonFile[
"Elements"][eTag][
"attributes"][
"rule"].as<std::string>(
"GAUSS");
1340 theElement = std::make_shared<EQlin2DQuad4>(nodes, theMesh->GetMaterial(matID), thickness, Quadrature, nGauss, eType, zref, cf1, cf2);
1342 else if(strcasecmp(Name.c_str(),
"null2DFrame2") == 0){
1344 theElement = std::make_shared<null2DFrame2>(nodes);
1346 else if(strcasecmp(Name.c_str(),
"null3DFrame2") == 0){
1348 theElement = std::make_shared<null3DFrame2>(nodes);
1354 theMesh->AddElement(Tag, theElement);
1364 std::map<std::string, std::vector<unsigned int> > Tags = Entities2Update<unsigned int>(theMesh, jsonFile,
"Dampings");
1367 for(
unsigned int k = 0; k < Tags[
"add"].size(); k++){
1368 unsigned int Tag = Tags[
"add"][k];
1372 std::string Name = jsonFile[
"Dampings"][dTag][
"name"].as<std::string>();
1375 std::vector<double> parameters;
1376 if(strcasecmp(Name.c_str(),
"Free") == 0){
1377 parameters.resize(2);
1378 parameters[0] = 0.0;
1379 parameters[1] = 0.0;
1381 else if(strcasecmp(Name.c_str(),
"Rayleigh") == 0){
1382 parameters.resize(2);
1383 parameters[0] = jsonFile[
"Dampings"][dTag][
"attributes"][
"am"].as<
double>(0.0);
1384 parameters[1] = jsonFile[
"Dampings"][dTag][
"attributes"][
"ak"].as<
double>(0.0);
1386 else if(strcasecmp(Name.c_str(),
"Caughey") == 0){
1390 else if(strcasecmp(Name.c_str(),
"Capped") == 0){
1395 unsigned int n = jsonFile[
"Dampings"][dTag][
"attributes"][
"list"].size();
1396 std::vector<unsigned int> eList(n);
1398 for(
unsigned int k = 0; k < n; k++)
1399 eList[k] = jsonFile[
"Dampings"][dTag][
"attributes"][
"list"][k].as<int>();
1402 std::shared_ptr<Damping> theDamping = std::make_shared<Damping>(Name, parameters);
1405 theMesh->AddDamping(Tag, theDamping);
1408 theMesh->SetDamping(Tag, eList);
1412 if( Tags[
"mod"].
size() > 0){
1413 std::map<unsigned int, std::shared_ptr<Damping> > theDampings = theMesh->GetDampings();
1415 for(
unsigned int k = 0; k < Tags[
"mod"].size(); k++){
1416 unsigned int Tag = Tags[
"mod"][k];
1420 std::string Name = jsonFile[
"Dampings"][dTag][
"name"].as<std::string>();
1423 std::vector<double> parameters;
1424 if(strcasecmp(Name.c_str(),
"Free") == 0){
1425 parameters.resize(2);
1426 parameters[0] = 0.0;
1427 parameters[1] = 0.0;
1429 else if(strcasecmp(Name.c_str(),
"Rayleigh") == 0){
1430 parameters.resize(2);
1431 parameters[0] = jsonFile[
"Dampings"][dTag][
"attributes"][
"am"].as<
double>(0.0);
1432 parameters[1] = jsonFile[
"Dampings"][dTag][
"attributes"][
"ak"].as<
double>(0.0);
1434 else if(strcasecmp(Name.c_str(),
"Caughey") == 0){
1438 else if(strcasecmp(Name.c_str(),
"Capped") == 0){
1443 unsigned int n = jsonFile[
"Dampings"][dTag][
"attributes"][
"list"].size();
1444 std::vector<unsigned int> eList(n);
1446 for(
unsigned int k = 0; k < n; k++)
1447 eList[k] = jsonFile[
"Dampings"][dTag][
"attributes"][
"list"][k].as<int>();
1450 theDampings[Tag]->SetName(Name);
1451 theDampings[Tag]->SetParameters(parameters);
1452 theMesh->SetDamping(Tag, eList);
1463 std::map<std::string, std::vector<unsigned int> > Tags = Entities2Update<unsigned int>(theMesh, jsonFile,
"Loads");
1466 for(
unsigned int k = 0; k < Tags[
"del"].size(); k++){
1467 int Tag = Tags[
"del"][k];
1468 theMesh->DelLoad(Tag);
1472 for(
unsigned int k = 0; k < Tags[
"add"].size(); k++){
1473 unsigned int Tag = Tags[
"add"][k];
1477 std::string Name = jsonFile[
"Loads"][lTag][
"name"].as<std::string>();
1480 std::shared_ptr<Load> theLoad;
1482 if(strcasecmp(Name.c_str(),
"PointLoad") == 0){
1484 unsigned int n = jsonFile[
"Loads"][lTag][
"attributes"][
"list"].size();
1485 std::vector<unsigned int> nodes(n);
1486 for(
unsigned int k = 0; k < n; k++)
1487 nodes[k] = jsonFile[
"Loads"][lTag][
"attributes"][
"list"][k].as<int>();
1490 unsigned int ndirs = jsonFile[
"Loads"][lTag][
"attributes"][
"dir"].size();
1491 Eigen::VectorXd direction(ndirs);
1492 for(
unsigned int k = 0; k < ndirs; k++)
1493 direction(k) = jsonFile[
"Loads"][lTag][
"attributes"][
"dir"][k].as<
double>();
1496 std::vector<double> value;
1497 std::string pattern = jsonFile[
"Loads"][lTag][
"attributes"][
"type"].as<std::string>();
1498 std::string
function = jsonFile[
"Loads"][lTag][
"attributes"][
"name"].as<std::string>();
1500 if(strcasecmp(pattern.c_str(),
"CONCENTRATED") == 0){
1501 if (strcasecmp(
function.c_str(),
"CONSTANT") == 0){
1504 value[0] = jsonFile[
"Loads"][lTag][
"attributes"][
"mag"].as<
double>();
1510 theLoad->AddNodes(nodes);
1512 else if(strcasecmp(
function.c_str(),
"TIMESERIES") == 0){
1514 std::string pathfile = jsonFile[
"Loads"][lTag][
"attributes"][
"file"].as<std::string>();
1515 std::ifstream load(pathfile.c_str());
1525 for(
unsigned int j = 0; j < nt; j++)
1534 theLoad->AddNodes(nodes);
1537 else if(strcasecmp(pattern.c_str(),
"BODY") == 0){
1538 if (strcasecmp(
function.c_str(),
"CONSTANT") == 0){
1541 value[0] = jsonFile[
"Loads"][lTag][
"attributes"][
"mag"].as<
double>();
1547 theLoad->AddNodes(nodes);
1549 else if(strcasecmp(
function.c_str(),
"TIMESERIES") == 0){
1551 std::string pathfile = jsonFile[
"Loads"][lTag][
"attributes"][
"file"].as<std::string>();
1552 std::ifstream load(pathfile.c_str());
1562 for(
unsigned int j = 0; j < nt; j++)
1571 theLoad->AddNodes(nodes);
1575 else if(strcasecmp(Name.c_str(),
"ElementLoad") == 0){
1577 std::string pattern = jsonFile[
"Loads"][lTag][
"attributes"][
"type"].as<std::string>();
1578 std::string
function = jsonFile[
"Loads"][lTag][
"attributes"][
"name"].as<std::string>();
1581 unsigned int n = jsonFile[
"Loads"][lTag][
"attributes"][
"list"].size();
1582 std::vector<unsigned int> elements(n);
1583 for(
unsigned int k = 0; k < n; k++)
1584 elements[k] = jsonFile[
"Loads"][lTag][
"attributes"][
"list"][k].as<int>();
1586 if(strcasecmp(pattern.c_str(),
"SURFACE") == 0){
1588 unsigned int ndirs = jsonFile[
"Loads"][lTag][
"attributes"][
"dir"].size();
1589 Eigen::VectorXd direction(ndirs);
1590 for(
unsigned int k = 0; k < ndirs; k++)
1591 direction(k) = jsonFile[
"Loads"][lTag][
"attributes"][
"dir"][k].as<
double>();
1594 unsigned int m = jsonFile[
"Loads"][lTag][
"attributes"][
"list"].size();
1595 std::vector<unsigned int> faces(m);
1597 for(
unsigned int k = 0; k < m; k++){
1599 unsigned int sTag = jsonFile[
"Surfaces"][Tag][
"face"].as<
int>();
1600 unsigned int eTag = jsonFile[
"Surfaces"][Tag][
"element"].as<
int>();
1607 std::vector<double> value;
1608 if (strcasecmp(
function.c_str(),
"CONSTANT") == 0){
1611 value[0] = jsonFile[
"Loads"][lTag][
"attributes"][
"mag"].as<
double>();
1617 theLoad->AddFaces(faces);
1618 theLoad->AddElements(elements);
1620 else if(strcasecmp(
function.c_str(),
"TIMESERIES") == 0){
1624 else if(strcasecmp(pattern.c_str(),
"BODY") == 0){
1626 unsigned int ndirs = jsonFile[
"Loads"][lTag][
"attributes"][
"dir"].size();
1627 Eigen::VectorXd direction(ndirs);
1628 for(
unsigned int k = 0; k < ndirs; k++)
1629 direction(k) = jsonFile[
"Loads"][lTag][
"attributes"][
"dir"][k].as<
double>();
1632 std::vector<double> value;
1633 if (strcasecmp(
function.c_str(),
"CONSTANT") == 0){
1636 value[0] = jsonFile[
"Loads"][lTag][
"attributes"][
"mag"].as<
double>();
1642 theLoad->AddElements(elements);
1644 else if(strcasecmp(
function.c_str(),
"TIMESERIES") == 0){
1646 std::string pathfile = jsonFile[
"Loads"][lTag][
"attributes"][
"file"].as<std::string>();
1647 std::ifstream load(pathfile.c_str());
1657 for(
unsigned int j = 0; j < nt; j++)
1666 theLoad->AddElements(elements);
1669 else if(strcasecmp(pattern.c_str(),
"GENERALWAVE") == 0){
1672 theLoad->AddElements(elements);
1675 std::map<unsigned int, bool> nodes;
1676 std::vector<unsigned int> elemIDs = theLoad->GetElements();
1679 std::map<unsigned int, std::shared_ptr<Node> > theNodes = theMesh->GetNodes();
1680 std::map<unsigned int, std::shared_ptr<Element> > theElements = theMesh->GetElements();
1682 for(
unsigned int k = 0; k < elemIDs.size(); k++){
1683 std::vector<unsigned int> nodeIDs = theElements[elemIDs[k]]->GetNodes();
1685 for(
unsigned int j = 0; j < nodeIDs.size(); j++)
1686 nodes[nodeIDs[j]] =
true;
1690 std::string pathfile = jsonFile[
"Loads"][lTag][
"attributes"][
"file"].as<std::string>();
1692 for(
auto it : nodes){
1693 auto &ind = it.first;
1697 std::ifstream load(LoadFile.c_str());
1700 if (load.is_open()){
1703 unsigned int nt, nFields;
1704 load >> nt >> nFields >> cond;
1707 Eigen::MatrixXd Signal(nt,nFields);
1709 for(
unsigned int i = 0; i < nt; i++){
1710 for(
unsigned int j = 0; j < nFields; j++)
1711 load >> Signal(i,j);
1716 Signal = -1.00*Signal;
1718 theLoad->AddDRMCondition(ind,cond);
1719 theNodes[ind]->SetDomainReductionMotion(Signal);
1725 else if(strcasecmp(Name.c_str(),
"SupportMotion") == 0){
1729 unsigned int n = jsonFile[
"Loads"][lTag][
"attributes"][
"list"].size();
1730 std::vector<unsigned int> nodes(n);
1731 for(
unsigned int k = 0; k < n; k++)
1732 nodes[k] = jsonFile[
"Loads"][lTag][
"attributes"][
"list"][k].as<int>();
1734 theLoad->AddNodes(nodes);
1738 theMesh->AddLoad(Tag, theLoad);
1748 UpdateAnalysis(std::shared_ptr<Mesh> &theMesh, std::unique_ptr<Analysis> &theAnalysis, std::vector<std::shared_ptr<Recorder> > &Recorders, std::map<
unsigned int, std::shared_ptr<LoadCombo> > &LoadCombos, std::string InputFile){
1754 std::ifstream file2stream(file2open.c_str());
1756 if(file2stream.is_open()){
1760 std::unique_ptr<LinearSystem> theSolver;
1761 std::shared_ptr<Algorithm> theAlgorithm;
1762 std::shared_ptr<Integrator> theIntegrator;
1765 std::string solver = jsonFile[
"Simulations"][
"attributes"][
"solver"][
"name"].
as<std::string>();
1766 unsigned int Tag = jsonFile[
"Simulations"][
"combo"].
as<
int>();
1768 if(strcasecmp(solver.c_str(),
"EIGEN") == 0){
1769 bool update = jsonFile[
"Simulations"][
"attributes"][
"solver"][
"update"].
as<
bool>(
false);
1770 theSolver = std::make_unique<EigenSolver>(update);
1772 else if(strcasecmp(solver.c_str(),
"MUMPS") == 0){
1773 bool update = jsonFile[
"Simulations"][
"attributes"][
"solver"][
"update"].
as<
bool>(
false);
1774 unsigned int option = jsonFile[
"Simulations"][
"attributes"][
"solver"][
"option"].
as<
int>(2);
1775 theSolver = std::make_unique<MumpsSolver>(option, update);
1777 else if(strcasecmp(solver.c_str(),
"PETSC") == 0){
1778 unsigned int dnz = jsonFile[
"Simulations"][
"attributes"][
"solver"][
"d_nz"].
as<
int>();
1779 unsigned int onz = jsonFile[
"Simulations"][
"attributes"][
"solver"][
"o_nz"].
as<
int>();
1780 unsigned int ksp = jsonFile[
"Simulations"][
"attributes"][
"solver"][
"option"].
as<
int>(3);
1781 double tol = jsonFile[
"Simulations"][
"attributes"][
"solver"][
"tol"].
as<
double>(1e-08);
1782 theSolver = std::make_unique<PetscSolver>(dnz, onz, tol, ksp);
1786 std::string algorithm = jsonFile[
"Simulations"][
"attributes"][
"algorithm"][
"name"].
as<std::string>();
1788 if(strcasecmp(algorithm.c_str(),
"LINEAR") == 0){
1789 theAlgorithm = std::make_shared<Linear>(theSolver, theMesh);
1791 else if(strcasecmp(algorithm.c_str(),
"NEWTON") == 0){
1792 double ConvergenceTol = jsonFile[
"Simulations"][
"attributes"][
"algorithm"][
"cnvgtol"].
as<
double>(1e-06);
1793 unsigned int nMaxIteration = jsonFile[
"Simulations"][
"attributes"][
"algorithm"][
"nstep"].
as<
int>(50);
1794 unsigned int ConvergenceTest = jsonFile[
"Simulations"][
"attributes"][
"algorithm"][
"cnvgtest"].
as<
int>(4);
1795 theAlgorithm = std::make_shared<NewtonRaphson>(theSolver, theMesh, ConvergenceTol, nMaxIteration, ConvergenceTest);
1802 std::string integrator = jsonFile[
"Simulations"][
"attributes"][
"integrator"][
"name"].
as<std::string>();
1803 double dt = jsonFile[
"Simulations"][
"attributes"][
"integrator"][
"dt"].
as<
double>(0.0);
1804 double mtol = jsonFile[
"Simulations"][
"attributes"][
"integrator"][
"mtol"].
as<
double>(1e-12);
1805 double ktol = jsonFile[
"Simulations"][
"attributes"][
"integrator"][
"ktol"].
as<
double>(1e-12);
1806 double ftol = jsonFile[
"Simulations"][
"attributes"][
"integrator"][
"ftol"].
as<
double>(1e-12);
1808 if(strcasecmp(integrator.c_str(),
"STATIC") == 0){
1809 theIntegrator = std::make_shared<QuasiStatic>(theMesh, mtol, ktol, ftol);
1811 else if(strcasecmp(integrator.c_str(),
"NEWMARK") == 0){
1812 theIntegrator = std::make_shared<NewmarkBeta>(theMesh, dt, mtol, ktol, ftol);
1814 else if(strcasecmp(integrator.c_str(),
"BATHE") == 0){
1815 theIntegrator = std::make_shared<CompositeBathe>(theMesh, dt, mtol, ktol, ftol);
1817 else if(strcasecmp(integrator.c_str(),
"CENTRALDIFFERENCE") == 0){
1818 theIntegrator = std::make_shared<CentralDifference>(theMesh, dt, mtol, ktol, ftol);
1820 else if(strcasecmp(integrator.c_str(),
"EXTENDEDNEWMARK") == 0){
1821 theIntegrator = std::make_shared<ExtendedNewmarkBeta>(theMesh, dt, mtol, ktol, ftol);
1825 theIntegrator->SetAlgorithm(theAlgorithm);
1826 theAlgorithm->SetIntegrator(theIntegrator);
1829 std::string analysis = jsonFile[
"Simulations"][
"attributes"][
"analysis"][
"name"].
as<std::string>();
1830 unsigned int nt = jsonFile[
"Simulations"][
"attributes"][
"analysis"][
"nt"].
as<
int>(1);
1832 if(strcasecmp(analysis.c_str(),
"STATIC") == 0){
1833 double Factor = 1.00 / (double)nt;
1834 theAlgorithm->SetLoadFactor(Factor);
1835 theAnalysis = std::make_unique<StaticAnalysis>(theMesh, theAlgorithm, theIntegrator, LoadCombos[Tag], nt);
1837 else if(strcasecmp(analysis.c_str(),
"DYNAMIC") == 0){
1838 theAlgorithm->SetLoadFactor(1.00);
1839 theAnalysis = std::make_unique<DynamicAnalysis>(theMesh, theAlgorithm, theIntegrator, LoadCombos[Tag], nt);
1843 for(
unsigned int k = 0; k < Recorders.size(); k++)
1846 file2stream.close();
1859 UpdateRecorders(std::vector<std::shared_ptr<Recorder> > &Recorders, std::string InputFile){
1865 std::ifstream file2stream(file2open.c_str());
1867 if(file2stream.is_open()){
1871 for(
auto it = jsonFile[
"Recorders"].as_object().begin(); it != jsonFile[
"Recorders"].
as_object().end(); ++it){
1873 std::string name = it->second[
"name"].as<std::string>();
1874 std::string file = it->second[
"file"].as<std::string>();
1875 unsigned int precision = it->second[
"ndps"].as<
int>();
1876 unsigned int nsample = it->second[
"nsamp"].as<
int>();
1879 std::shared_ptr<Recorder> theRecorder;
1881 if(strcasecmp(name.c_str(),
"PARAVIEW") == 0){
1882 unsigned int features = it->second[
"features"].as<
int>();
1885 theRecorder = std::make_shared<Recorder>(file, name, features, nsample, precision);
1887 else if(strcasecmp(name.c_str(),
"SECTION") == 0){
1888 unsigned int nlist = it->second[
"list"].size();
1889 unsigned int ndims = it->second[
"coords"].size();
1890 std::string response = it->second[
"resp"].as<std::string>();
1892 std::vector<double> coord(ndims);
1893 for(
unsigned int k = 0; k < ndims; k++)
1894 coord[k] = it->second[
"coords"][k].as<
double>();
1896 std::vector<unsigned int> IDs(nlist);
1897 for(
unsigned int k = 0; k < nlist; k++)
1898 IDs[k] = it->second[
"list"][k].as<
int>();
1901 theRecorder = std::make_shared<Recorder>(file, name, response, coord, IDs, nsample, precision);
1904 std::string response = it->second[
"resp"].as<std::string>();
1905 unsigned int nlist = it->second[
"list"].size();
1906 std::vector<unsigned int> IDs(nlist);
1908 for(
unsigned int k = 0; k < nlist; k++)
1909 IDs[k] = it->second[
"list"][k].as<
int>();
1912 theRecorder = std::make_shared<Recorder>(file, name, response, IDs, nsample, precision);
1916 Recorders.push_back(theRecorder);
1919 file2stream.close();
1922 std::cout <<
"\x1B[31m ERROR: \x1B[0mThe JSON file in \'Driver::UpdateRecorders()\' in Processor [" <<
rank <<
"] couldn't be opened. \n";
1930 UpdateCombinations(std::map<
unsigned int, std::shared_ptr<LoadCombo> > &LoadCombos, std::string InputFile){
1936 std::ifstream file2stream(file2open.c_str());
1938 if(file2stream.is_open()){
1942 for(
auto it = jsonFile[
"Combinations"].as_object().begin(); it != jsonFile[
"Combinations"].
as_object().end(); ++it){
1944 unsigned int Tag = std::stoi(it->first);
1945 std::string Name = it->second[
"name"].as<std::string>();
1948 std::vector<double> factors;
1949 std::vector<unsigned int> loads;
1951 if( it->second[
"attributes"][
"load"].exists() ){
1952 unsigned int nCombs = it->second[
"attributes"][
"load"].size();
1953 loads.resize(nCombs);
1954 factors.resize(nCombs);
1956 for(
unsigned int k = 0; k < loads.size(); k++){
1957 loads[k] = it->second[
"attributes"][
"load"][k].as<
int>();
1958 factors[k] = it->second[
"attributes"][
"factor"][k].as<
double>();
1963 std::shared_ptr<LoadCombo> theCombo = std::make_unique<LoadCombo>(Name, loads, factors);
1966 LoadCombos[Tag] = theCombo;
1969 file2stream.close();
1972 std::cout <<
"\x1B[31m ERROR: \x1B[0mThe JSON file in \'Driver::UpdateCombinations()\' in Processor [" <<
rank <<
"] couldn't be opened. \n";
1981 UpdateMesh(std::shared_ptr<Mesh> &theMesh, std::string InputFile){
1987 std::ifstream file2stream(file2open.c_str());
1989 if(file2stream.is_open()){
1993 if( jsonFile[
"Global"].exists() ){
1997 UpdateOption = jsonFile[
"Global"][
"update"].
as<std::string>(
"RESTART");
1998 std::string MassForm = jsonFile[
"Global"][
"massform"].
as<std::string>(
"CONSISTENT");
2001 if(strcasecmp(MassForm.c_str(),
"LUMPED") == 0){
2004 else if(strcasecmp(MassForm.c_str(),
"CONSISTENT") == 0){
2038 file2stream.close();
2055 std::shared_ptr<Mesh> theMesh = std::make_shared<Mesh>();
2058 for(
unsigned int k = 0; k <
fileName.size(); k++){
2060 std::vector<std::shared_ptr<Recorder> > Recorders;
2063 std::map<unsigned int, std::shared_ptr<LoadCombo> > LoadCombos;
2070 theMesh->Initialize();
2079 std::unique_ptr<Analysis> theAnalysis;
2084 bool StopSimulation = theAnalysis->
Analyze();
2088 std::cout <<
" **A PROBLEM WAS ENCOUNTERED. THE ANALYSIS WILL BE TERMINATED**\n\n";
2093 std::cout <<
"\x1B[31m ERROR: \x1B[0mThe JSON file \'" <<
fileName[k] <<
"\' in Driver::UpdateAnalysis() in Processor [" <<
rank <<
"] couldn't be opened. \n";
2098 std::cout <<
"\x1B[31m ERROR: \x1B[0mThe JSON file \'" <<
fileName[k] <<
"\' in Driver::UpdateMesh() in Processor [" <<
rank <<
"] couldn't be opened. \n";
void UpdateCombinations(std::map< unsigned int, std::shared_ptr< LoadCombo > > &LoadCombos, std::string InputFile)
Updates the Combination Entities required for the Analysis.
Definition: Driver.hpp:1930
RSJobject & as_object(bool force=false)
Definition: RSJparser.hpp:653
This file contains the "Lin3DRectangular" section declarations, which defines a Rectangular geometry ...
#define POINTLOAD_CONCENTRATED_DYNAMIC
Define global load pattern time dependant concentrated load.
Definition: Definitions.hpp:122
This file contains the "lin2DQuad8" linearized eight-node element declarations, which defines an elem...
This file contains the "CentralDifference" integration method, which inncludes any damping and inerti...
This file contains the "Lin2DTee" section declarations, which defines a circular (T) geometry for 2D ...
This file contains the "Steel1DFiber" material declarations, which defines a steel material for 1D...
This file contains the "lin2DQuad4" linearized four-node element declarations, which defines an eleme...
This file contains the "kin2DQuad4" kinematic four-node element declarations, which defines an elemen...
void RunDriverFile()
Runs the User's JSON Input file.
Definition: Driver.hpp:2049
int rank
The processor number.
This file contains the "Lin3DTee" section declarations, which defines a Tee (T) geometry for 3D analy...
This file contains the "lin3DTetra10" linearized ten-node element declarations, which defines an elem...
#define POINTLOAD_CONCENTRATED_CONSTANT
Define global load pattern constant concentrated load.
Definition: Definitions.hpp:119
This file contains the "Lin2DAngle" section declarations, which defines a Angle geometry in 2D analys...
This file contains the "lin2DTria6" linearized six-node element declarations, which defines an elemen...
This file contains the "Plastic3DBA" material declarations, which defines an triaxial plastic boundin...
This file contains the "null2DFrame2" null frame element declarations, which defines a frame-like ele...
This file contains the "lin3DTruss3" linearized three-node element declarations, which defines an ele...
void UpdateMasses(std::shared_ptr< Mesh > &theMesh, RSJresource &jsonFile)
Updates the Masses in Mesh Object.
Definition: Driver.hpp:396
std::string GetPartitionName(std::string theFile, int k, bool cond)
Sets the partition subdomain tag number.
Definition: Driver.hpp:250
This file contains the "Lin3DCircularTube" section declarations, which defines a hollow circular geom...
This file contains the "Elastic1DLinear" material declarations, which defines an uniaxial isotropic l...
This file contains the "Lin3DChannel" section declarations, which defines a circular (C) geometry for...
unsigned int nDimensions
The problem dimension (1D, 2D, 3D).
This file contains the "Lin2DRectangularTube" section declarations, which defines a hollow rectangula...
This file contains the "Lin3DRectangularTube" section declarations, which defines a hollow rectangula...
#define POINTLOAD_BODY_DYNAMIC
Define global load pattern time dependant for a body load.
Definition: Definitions.hpp:128
void UpdateRecorders(std::vector< std::shared_ptr< Recorder > > &Recorders, std::string InputFile)
Updates the Recorder Entities required for the Analysis.
Definition: Driver.hpp:1859
bool UpdateAnalysis(std::shared_ptr< Mesh > &theMesh, std::unique_ptr< Analysis > &theAnalysis, std::vector< std::shared_ptr< Recorder > > &Recorders, std::map< unsigned int, std::shared_ptr< LoadCombo > > &LoadCombos, std::string InputFile)
Creates a new Analysis object from the json file.
Definition: Driver.hpp:1748
std::vector< T > GetIDsFromMESH(std::shared_ptr< Mesh > &mesh, std::string Name)
Query the MESH object and obtains the Identifier list.
Definition: Driver.hpp:213
This file contains the "Plastic3DJ2" material declarations, which defines an triaxial isotropic plast...
This file contains the "Plastic1DJ2" material declarations, which defines an uniaxial isotropic plast...
This file contains the "Plastic1DGap" material declarations, which defines a plastic gap material for...
This file contains the "Lin3DUserDefined" section declarations, which defines a general geometry for ...
This file contains the "Fib3DLineSection" section declarations, which defines a Rectangular geometry ...
void UpdateSections(std::shared_ptr< Mesh > &theMesh, RSJresource &jsonFile)
Updates the Section Entities in Mesh Object.
Definition: Driver.hpp:761
This file contains the "Static Analysis object" declarations, and updates information in the mesh...
This file contains the "PML3DHexa8" linearized four-node perfectly matched layer element declarations...
This file contains the "UnxBoucWen2DLink" two-node link declarations, which defines a uniaxial Bouc-W...
This file sets the global variables to be used during SeismoVLAB execution.
This file contains the "null2DFrame2" null frame element declarations, which defines a frame-like ele...
This file contains the "PlasticPlaneStrainBA" material declarations, which defines an biaxial plastic...
#define ELEMENTLOAD_SURFACE_CONSTANT
Define global load pattern for a constant surface load.
Definition: Definitions.hpp:131
This file contains the "lin3DHexa20" linearized twenty-node element declarations, which defines an el...
This file contains the "HDRBYamamoto3DLink" two-node link declarations, which defines a bi-directiona...
This file contains the "PML2DQuad8" linearized eight-node perfectly matched layer element declaration...
This file contains the "Lin3DCircular" section declarations, which defines a circular geometry for 3D...
This file contains the "kin2DFrame2" finite kinematic two-node element declarations, which defines a frame element in a finite element mesh.
This file contains the "Lin2DCircular" section declarations, which defines a Circular geometry to be ...
void UpdateLoads(std::shared_ptr< Mesh > &theMesh, RSJresource &jsonFile)
Updates the Loads Entities in Mesh Object.
Definition: Driver.hpp:1461
This file contains the "PML2DQuad4" linearized four-node perfectly matched layer element declarations...
std::string GetSpacedName(std::string theFile, std::string toReplace)
Fix blank spaces provided by user in path (if any).
Definition: Driver.hpp:281
This file contains the "lin2DFrame2" linearized two-node element declarations, which defines a frame ...
This file contains the "NewtonRaphson" algorithm declarations, which solves the non-linear system of ...
std::vector< T > GetIDsFromJSON(RSJresource &jsonFile, std::string Name)
Query the JSON file and obtains the Identifier list.
Definition: Driver.hpp:187
This file contains the implementation of "A Ridiculously Simple JSON Parser for C++." This great parsing class was taken from http://subhrajit.net/.
std::vector< T > setOperation(std::vector< T > &v1, std::vector< T > &v2, std::string op)
Performs union, difference or intersection operation between two vectors.
Definition: Driver.hpp:157
void UpdateElements(std::shared_ptr< Mesh > &theMesh, RSJresource &jsonFile)
Updates the Element Entities in Mesh Object.
Definition: Driver.hpp:999
This file contains the "PlasticPlaneStrainJ2" material declarations, which defines an biaxial plastic...
Definition: RSJparser.hpp:240
This file contains the "Lin2DCircularTube" section declarations, which defines a hollow circular geom...
This file contains the "Elastic2DPlaneStress" material declarations, which defines an biaxial isotrop...
This file contains the "Lin3DWideFlange" section declarations, which defines a WideFlange geometry (I...
This file contains the "EigenSolver" solver declaration; the object performs Cholesky-decomposition o...
This file contains the "lin2DTria3" linearized three-node element declarations, which defines an elem...
void SetRecorder(std::shared_ptr< Recorder > &recorder)
Sets the recorder for the analysis.
This file contains the "lin2DTruss2" linearized two-node element declarations, which defines an eleme...
std::vector< std::string > fileName
The file name to be loaded.
This file contains the "Lin2DWideFlange" section declarations, which defines a circular (I) geometry ...
This file contains the "Elastic3DLinear" material declarations, which defines a triaxial isotropic li...
This file contains the "Lin2DRectangular" section declarations, which defines a rectangular geometry ...
This file contains the "kin2DTruss2" kinematic two-node element declarations, which defines an elemen...
This file contains the "EQlin2DQuad4" equivalent linear four-node element declarations, which defines an element in a finite element mesh.
This file contains the "Hertzian1DLinear" material declarations, which defines an uniaxial isotropic ...
dataType as(const dataType &def=dataType())
Definition: RSJparser.hpp:309
void sortVector(std::vector< T > &v)
Sorts a vector of tag number form smaller to larger.
Definition: Driver.hpp:146
This file contains the "ExtendedNewmarkBeta" integration declaration, the routine includes any dampin...
This file contains the "CompositeBathe" integration declaration, the file integrator includes any dam...
#define ELEMENTLOAD_BODY_CONSTANT
Define global load pattern for a constant body load.
Definition: Definitions.hpp:137
int size
The number of partitions.
virtual bool Analyze()=0
Performs the required analysis on the domain.
std::string to_string(RSJresourceType rt)
Definition: RSJparser.hpp:65
This file contains the "lin3DTetra4" linearized eight-node element declarations, which defines an ele...
This file contains the "Lin2DChannel" section declarations, which defines a channel geometry in 2D an...
This file contains the "Linear" algorithm declarations, which solves the linear system of equations i...
bool driverFile
Whether the driver (JSON) file is provided.
This file contains the "Lin3DAngle" section declarations, which defines a circular (L) geometry for 3...
This file contains the "Elastic1DGap" material declarations, which defines an elastic gap material fo...
#define ELEMENTLOAD_DOMAIN_REDUCTION
Define global load pattern time dependant general wave load.
Definition: Definitions.hpp:143
This file contains the "ZeroLength1D" two-node element declarations, which defines an element of zero...
void UpdateSupportMotion(std::shared_ptr< Mesh > &theMesh, RSJresource &jsonFile)
Updates the Support Motions in Mesh Object.
Definition: Driver.hpp:509
#define POINTLOAD_SUPPORT_MOTION
Define global load pattern constant/time-dependant support motion load.
Definition: Definitions.hpp:146
This file contains the "Concrete1DFiber" material declarations, which defines a concrete material for...
void UpdateConstraints(std::shared_ptr< Mesh > &theMesh, RSJresource &jsonFile)
Updates the Constraint Entities in Mesh Object.
Definition: Driver.hpp:440
This file contains the "lin3DTruss2" linearized two-node element declarations, which defines an eleme...
bool MassFormulation
The element mass formulation.
This file contains the "Profiler object" declarations to compute how long it takes for a program to b...
#define POINTLOAD_BODY_CONSTANT
Define global load pattern for a node body load.
Definition: Definitions.hpp:125
This file contains the "kin3DTruss2" kinematic two-node element declarations, which defines an elemen...
This file contains the "kin3DHexa8" finite kinematic eight-node element declarations, which defines an element in a finite element mesh.
This file contains the "lin3DHexa8" linearized eight-node element declarations, which defines an elem...
This file contains the "NewmarkBeta" integration declaration, the routine include any damping and ine...
This file contains the "lin3DShell4" linearized four-node element declarations, which defines a frame...
void UpdateMaterials(std::shared_ptr< Mesh > &theMesh, RSJresource &jsonFile)
Updates the Material Entities in Mesh Object.
Definition: Driver.hpp:567
This file contains the "Dynamic Analysis object" declarations, and updates information in the mesh...
This file contains the "UnxBoucWen3DLink" two-node link declarations, which defines a uniaxial Bouc-W...
This file contains the "PetscSolver" solver declaration; this object is an iterative solver...
This file contains the "Lin2DUserDefined" section declarations, which defines a general geometry for ...
This file contains the "lin2DTruss3" linearized three-node element declarations, which defines an ele...
void UpdateNodes(std::shared_ptr< Mesh > &theMesh, RSJresource &jsonFile)
Updates the Node Entities in Mesh Object.
Definition: Driver.hpp:304
This file contains the "lin3DFrame2" linearized two-node element declarations, which defines a frame ...
void UpdateDampings(std::shared_ptr< Mesh > &theMesh, RSJresource &jsonFile)
Updates the Damping Entities in Mesh Object.
Definition: Driver.hpp:1362
#define PROFILE_FUNCTION()
Definition: Profiler.hpp:210
This file contains the "Steel1DFiber" material declarations, which defines a linear material for 1D...
std::string filePath
The folder path where the file is loaded.
This file contains the "EQlin2DQuad4" equivalent linear four-node element declarations, which defines an element in a finite element mesh.
bool UpdateMesh(std::shared_ptr< Mesh > &theMesh, std::string InputFile)
Populate the Mesh object with the json provided entities.
Definition: Driver.hpp:1981
unsigned int numberOfFreeDofs
Total number of free-degree-of-freedom.
This file contains the "HDRBYamamoto2DLink" two-node link declarations, which defines a bi-directiona...
std::map< std::string, std::vector< T > > Entities2Update(std::shared_ptr< Mesh > &mesh, RSJresource &jsonFile, std::string Name)
The Entities indexes to be updated.
Definition: Driver.hpp:230
std::string UpdateOption
The update option for member in Mesh.
This file contains the "Viscous1DLinear" material declarations, which defines an uniaxial viscous mat...
This file contains the "Lin3DThinArea" section declarations, which defines an area geometry for 3D an...
This file contains the "Elastic2DPlaneStrain" material declarations, which.
This file contains the "MumpsSolver" solver declaration; this object performs a (MU)ltifrontal (M)ass...
#define ELEMENTLOAD_BODY_DYNAMIC
Define global load pattern for a time dependant body load.
Definition: Definitions.hpp:140
This file contains the "QuasiStatic" integrator declaration, this integrator neglects any damping and...
unsigned int numberOfTotalDofs
Total number of total-degree-of-freedom.