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

Method setParameter

SRC/domain/node/Node.cpp:1935–1992  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1933
1934
1935int
1936Node::setParameter(const char **argv, int argc, Parameter &param)
1937{
1938 // The following parameterID map is being used:
1939 // 1: nodal mass in direction 1
1940 // 2: nodal mass in direction 2
1941 // 3: nodal mass in direction 3
1942 // 4: coordinate in direction 1
1943 // 5: coordinate in direction 2
1944 // 6: coordinate in direction 3
1945
1946 if (argc < 2)
1947 return -1;
1948
1949 if ((strstr(argv[0],"mass") != 0) || (strstr(argv[0],"-mass") != 0)) {
1950 int direction = 0; // atoi(argv[1]);
1951 if ((strcmp(argv[1],"x") == 0)||(strcmp(argv[1],"X") == 0)||(strcmp(argv[1],"1") == 0)) {
1952 direction = 1;
1953 if (mass != 0)
1954 param.setValue((*mass)(0,0));
1955 }
1956 else if ((strcmp(argv[1],"y") == 0)||(strcmp(argv[1],"Y") == 0)||(strcmp(argv[1],"2") == 0)) {
1957 direction = 2;
1958 if (mass != 0)
1959 param.setValue((*mass)(1,1));
1960 }
1961 else if ((strcmp(argv[1],"z") == 0)||(strcmp(argv[1],"Z") == 0)||(strcmp(argv[1],"3") == 0)) {
1962 direction = 3;
1963 if (mass != 0)
1964 param.setValue((*mass)(2,2));
1965 }
1966 else if ((strcmp(argv[1],"xy") == 0)||(strcmp(argv[1],"XY") == 0)) {
1967 direction = 7;
1968 if (mass != 0)
1969 param.setValue((*mass)(0,0));
1970 }
1971 else if ((strcmp(argv[1],"xyz") == 0)||(strcmp(argv[1],"XYZ") == 0)) {
1972 direction = 8;
1973 if (mass != 0)
1974 param.setValue((*mass)(0,0));
1975 }
1976
1977 if ((direction >= 1 && direction <= 3) || direction == 7 || direction == 8)
1978 return param.addObject(direction, this);
1979 }
1980 else if (strstr(argv[0],"coord") != 0) {
1981 int direction = atoi(argv[1]);
1982 if (direction >= 1 && direction <= 3) {
1983 if (Crd != 0)
1984 param.setValue((*Crd)(direction-1));
1985 return param.addObject(direction+3, this);
1986 }
1987 }
1988 else
1989 opserr << "WARNING: Could not set parameter in Node. " << endln;
1990
1991 return -1;
1992}

Callers 6

setDomainMethod · 0.45
setDomainMethod · 0.45
setDomainMethod · 0.45
ParameterMethod · 0.45
addComponentMethod · 0.45
setParameterMethod · 0.45

Calls 2

setValueMethod · 0.45
addObjectMethod · 0.45

Tested by

no test coverage detected