Exemplo n.º 1
0
int OPS_Section()
{
    theActiveFiberSection2d = 0;
    theActiveFiberSection3d = 0;
    theActiveNDFiberSection2d = 0;
    theActiveNDFiberSection3d = 0;

    theActiveFiberSection2dThermal = 0;
    theActiveFiberSection3dThermal = 0;
    theActiveFiberSectionGJThermal = 0;

    if (initDone == false) {
	setUpFunctions();
	initDone = true;
    }

    // num args
    if(OPS_GetNumRemainingInputArgs() < 1) {
	opserr<<"WARNING insufficient args: pattern type ...\n";
	return -1;
    }

    const char* type = OPS_GetString();

    OPS_ParsingFunctionMap::const_iterator iter = functionMap.find(type);
    if (iter == functionMap.end()) {
	opserr<<"WARNING section type " << type << " is unknown\n";
	return -1;
    }

    SectionForceDeformation* theSection = (SectionForceDeformation*) (*iter->second)();
    if (theSection == 0) {
	return -1;
    }

    // Now add the section
    if (OPS_addSectionForceDeformation(theSection) == false) {
	opserr<<"ERROR could not add section.\n";
	theActiveFiberSection2d = 0;
	theActiveFiberSection3d = 0;
	theActiveNDFiberSection2d = 0;
	theActiveNDFiberSection3d = 0;

	theActiveFiberSection2dThermal = 0;
	theActiveFiberSection3dThermal = 0;
	theActiveFiberSectionGJThermal = 0;
	delete theSection;
	return -1;
    }

    return 0;
}
int OPS_BeamIntegration()
{
    static bool initDone = false;
    if (initDone == false) {
	setUpFunctions();
	initDone = true;
    }
    
    if (OPS_GetNumRemainingInputArgs() < 2) {
	opserr<<"WARNING too few arguments: beamIntegration type? tag? ...\n";
	return -1;
    }

    const char* type = OPS_GetString();

    OPS_ParsingFunctionMap::const_iterator iter = functionMap.find(type);
    if (iter == functionMap.end()) {
	opserr<<"WARNING beam integration type " << type << " is unknown\n";
	return -1;
    }

    int iTag;
    ID secTags;
    BeamIntegration* bi = (BeamIntegration*)(*iter->second)(iTag,secTags);
    if (bi == 0) {
	return -1;
    }
    BeamIntegrationRule* rule = new BeamIntegrationRule(iTag,bi,secTags);
    if (rule == 0) {
	return -1;
    }

    // add it
    if (OPS_addBeamIntegrationRule(rule) == false) {
	opserr << "WARNING failed to add BeamIntegration\n";
	delete rule;
	return -1;
    }

    return 0;
}