Hi everyone,
I'm developing a new material in OpenSEES, with 3 arguments, namely, tag and two vectors: stress and strain points which define a stress-strain general path. For any new material, we need to parse the command line in order to achieve the values of the arguments. In the elementAPI there are procedures for getting double and integer from the command line, but no one for vectors... Any help about how to input a vector as an argument?
Cheers,
Alberto Navarro
Parse "vector" argument
Moderators: silvia, selimgunay, Moderators
Re: Parse "vector" argument
the getDouble does not just get one double value, it can get many at once (think vector!)
you just have to tell it the size, if you want arbitrary size for the command line, put that number as an integer after the tag in the command line.
anothe roption is to just put the 2 vectors in a file and pas the filename in and red the values from it.
you just have to tell it the size, if you want arbitrary size for the command line, put that number as an integer after the tag in the command line.
anothe roption is to just put the 2 vectors in a file and pas the filename in and red the values from it.
Re: Parse "vector" argument
So this is my command line 's definition:
GeneralElastic(int tag, int pathSize, Vector * backboneStrain, Vector * backboneStress);
I have tried this to parse the arguments:
UniaxialMaterial *theMaterial = 0;
int iData[2]; // tag in first position, number of points in second position
Vector * eData; // strain coordinates
Vector * sData; // stress coordinates
int numData;
numData = 2;
if (OPS_GetIntInput(&numData, iData) != 0) {
opserr << "WARNING invalid uniaxialMaterial ElasticPP tag" << endln;
return 0;
}
numData = iData[1];
if (OPS_GetDoubleInput(&numData, eData) != 0) {
opserr << "WARNING invalid strain coordinates";
return 0;
}
if (OPS_GetDoubleInput(&numData, sData) != 0) {
opserr << "WARNING invalid stress coordinates";
return 0;
}
theMaterial = new GeneralElastic(iData[0], iData[1], eData, sData);
But it warns me that sData and eData are arguments of type 'Vector', which is incompatible with parameter of type 'double'.
Thank you so much for your kind attention
Alberto Navarro
GeneralElastic(int tag, int pathSize, Vector * backboneStrain, Vector * backboneStress);
I have tried this to parse the arguments:
UniaxialMaterial *theMaterial = 0;
int iData[2]; // tag in first position, number of points in second position
Vector * eData; // strain coordinates
Vector * sData; // stress coordinates
int numData;
numData = 2;
if (OPS_GetIntInput(&numData, iData) != 0) {
opserr << "WARNING invalid uniaxialMaterial ElasticPP tag" << endln;
return 0;
}
numData = iData[1];
if (OPS_GetDoubleInput(&numData, eData) != 0) {
opserr << "WARNING invalid strain coordinates";
return 0;
}
if (OPS_GetDoubleInput(&numData, sData) != 0) {
opserr << "WARNING invalid stress coordinates";
return 0;
}
theMaterial = new GeneralElastic(iData[0], iData[1], eData, sData);
But it warns me that sData and eData are arguments of type 'Vector', which is incompatible with parameter of type 'double'.
Thank you so much for your kind attention
Alberto Navarro
Re: Parse "vector" argument
eData and SData as used in GetDouble must be double []. you can create a Vector that uses a double * in the constructor.
Re: Parse "vector" argument
It worked! Thank you so much!