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

Function specifyConstraintHandler

SRC/runtime/commands/analysis/analysis.cpp:741–796  ·  view source on GitHub ↗

command invoked to allow the ConstraintHandler object to be built

Source from the content-addressed store, hash-verified

739// command invoked to allow the ConstraintHandler object to be built
740//
741static int
742specifyConstraintHandler(ClientData clientData, Tcl_Interp *interp, Tcl_Size argc,
743 TCL_Char ** const argv)
744{
745
746 BasicAnalysisBuilder *builder = (BasicAnalysisBuilder*)clientData;
747
748 // make sure at least one other argument to contain type name
749 if (argc < 2) {
750 opserr << OpenSees::PromptValueError << "need to specify a constraint type \n";
751 return TCL_ERROR;
752 }
753
754 ConstraintHandler *theHandler = nullptr;
755 // check argv[1] for type of handler and create the object
756 if (strcmp(argv[1], "Plain") == 0)
757 theHandler = new PlainHandler();
758
759 else if (strcmp(argv[1], "Transformation") == 0) {
760 theHandler = new TransformationConstraintHandler();
761 }
762
763 else if (strcmp(argv[1], "Penalty") == 0) {
764 if (argc < 4) {
765 opserr << "WARNING: need to specify alpha: handler Penalty alpha \n";
766 return TCL_ERROR;
767 }
768 double alpha1, alpha2;
769 if (Tcl_GetDouble(interp, argv[2], &alpha1) != TCL_OK)
770 return TCL_ERROR;
771 if (Tcl_GetDouble(interp, argv[3], &alpha2) != TCL_OK)
772 return TCL_ERROR;
773 theHandler = new PenaltyConstraintHandler(alpha1, alpha2);
774 }
775
776 else if (strcmp(argv[1], "Lagrange") == 0) {
777 double alpha1 = 1.0;
778 double alpha2 = 1.0;
779 if (argc == 4) {
780 if (Tcl_GetDouble(interp, argv[2], &alpha1) != TCL_OK)
781 return TCL_ERROR;
782 if (Tcl_GetDouble(interp, argv[3], &alpha2) != TCL_OK)
783 return TCL_ERROR;
784 }
785 theHandler = new LagrangeConstraintHandler(alpha1, alpha2);
786 }
787
788 else {
789 opserr << OpenSees::PromptValueError << "ConstraintHandler type '" << argv[1]
790 << "' does not exists \n\t(Plain, Penalty, Lagrange, Transformation) only\n";
791 return TCL_ERROR;
792 }
793
794 builder->set(theHandler);
795 return TCL_OK;
796}

Callers

nothing calls this directly

Calls 1

setMethod · 0.45

Tested by

no test coverage detected