question on adding new material

For developers writing C++, Fortran, Java, code who have questions or comments to make.

Moderators: silvia, selimgunay, Moderators

Post Reply
baozai
Posts: 212
Joined: Tue Jan 04, 2011 3:39 am
Location: Southeast University

question on adding new material

Post by baozai » Fri Jul 11, 2014 5:18 pm

Hi:

I followed the tutorial on adding new material. I wrote the new rule of judging criterion with the name 'TSCriterion.cpp', and a new material has relation to this rule with the name 'TSLimitStateMaterial.cpp'.
I wrote the first part of the cpp following the way PinchingLimitStateMaterial.cpp, so I had

void *
OPS_PinchingLimitState(void) {
xxxxxxx
}
in 'TSLimitStateMaterial.cpp' and

void *
OPS_TSCriterion(void)
{xxxxxxx
}
in 'TSCriterion.cpp' .

Then I wrote the

} else if (strcmp(argv[1],"TSLimitStateMaterial") == 0) {
void *theMat = OPS_TSLimitStateMaterial();
if (theMat != 0)
theMaterial = (UniaxialMaterial *)theMat;
else
return TCL_ERROR;
in 'TclModelBuilderUniaxialMaterialCommand.cpp' for calling 'TSLimitStateMaterial.cpp' and

else if (strcmp(argv[1],"TSCriterion") == 0) {
void *theRSC = OPS_TSCriterion();
if (theRSC != 0) {
theCurve = (LimitCurve *)theRSC;
} else
return TCL_ERROR;
}
in 'TclLimitState.cpp' for calling 'TSCriterion.cpp'

Then when I Rebuilt the OpenSees, I got the following error:
Error 1690 error LNK2019: unresolved external symbol "void * __cdecl OPS_TSLimitStateMaterial(void)" (?OPS_TSLimitStateMaterial@@YAPAXXZ) referenced in function "int __cdecl TclModelBuilderUniaxialMaterialCommand(void *,struct Tcl_Interp *,int,char const * *,class Domain *)" (?TclModelBuilderUniaxialMaterialCommand@@YAHPAXPAUTcl_Interp@@HPAPBDPAVDomain@@@Z) material.lib
Error 1691 error LNK2019: unresolved external symbol "void * __cdecl OPS_TSCriterion(void)" (?OPS_TSCriterion@@YAPAXXZ) referenced in function "int __cdecl Tcl_AddLimitCurveCommand(void *,struct Tcl_Interp *,int,char const * *,class Domain *)" (?Tcl_AddLimitCurveCommand@@YAHPAXPAUTcl_Interp@@HPAPBDPAVDomain@@@Z) material.lib
Error 1692 fatal error LNK1120: 2 unresolved externals d:\Rev 5621\Win32\bin\openSees.exe 1
Error 1695 error LNK2019: unresolved external symbol "void * __cdecl OPS_TSLimitStateMaterial(void)" (?OPS_TSLimitStateMaterial@@YAPAXXZ) referenced in function "int __cdecl TclModelBuilderUniaxialMaterialCommand(void *,struct Tcl_Interp *,int,char const * *,class Domain *)" (?TclModelBuilderUniaxialMaterialCommand@@YAHPAXPAUTcl_Interp@@HPAPBDPAVDomain@@@Z) material.lib
Error 1696 error LNK2019: unresolved external symbol "void * __cdecl OPS_TSCriterion(void)" (?OPS_TSCriterion@@YAPAXXZ) referenced in function "int __cdecl Tcl_AddLimitCurveCommand(void *,struct Tcl_Interp *,int,char const * *,class Domain *)" (?Tcl_AddLimitCurveCommand@@YAHPAXPAUTcl_Interp@@HPAPBDPAVDomain@@@Z) material.lib
Error 1697 fatal error LNK1120: 2 unresolved externals d:\Rev 5621\Win32\bin\openSeesTk.exe 1

It seems there is something wrong with the command I wrote in TclModelBuilderUniaxialMaterialCommand.cpp and TclLimitState.cpp. But I did think I wrote the new commands as the existed ones. Could anybody help me with this?
Thank you and best wishes.
Baozai

fmk
Site Admin
Posts: 5883
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: question on adding new material

Post by fmk » Fri Jul 11, 2014 9:30 pm

the material you are writing appears to need more than the typical functions .. it will not work using the .dll approach as these functions are not defined in the api .. you will need to add to the main .exe instead . which means downloading the whole source code using svn, adding the material to the material project and makking changes to the TclModelBuilderUniaxialMaterialCommand.cpp file

baozai
Posts: 212
Joined: Tue Jan 04, 2011 3:39 am
Location: Southeast University

Re: question on adding new material

Post by baozai » Sat Jul 12, 2014 12:37 am

Hi, Frank, thank you very much for replying.

Sorry, please let me explain the steps I did first: the material I wrote is added to the whole source code which downloaded from website. It is R5621. I added TSCriterion.h and TSCriterion.cpp to the folder 'limitCurve', and I added TSLimitStateMaterial.cpp and TSLimitStateMaterial.h to the folder 'limitState'. Then I added relative commands in TclLimitState.cpp and TclModelBuilderUniaxialMaterialCommand.cpp. And after that, I got the errors as posted.

I am sorry I didn't get your reply very well. Is that mean that only adding the commands in the TclModelBuilderUniaxialMaterialCommand.cpp is not enough? If so, what should I do for making changes for TclModelBuilderUniaxialMaterialCommand.cpp? I think for the material PinchingLimitState, it is also only add the the judging commans in TclModelBuilderUniaxialMaterialCommand.cpp, and for RotationShearCruve, it is also only add commands in TclLimitState.cpp. And they worked. Would you please explain a little bit more on your comments? I am very appreciate for your help.
Baozai

fmk
Site Admin
Posts: 5883
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: question on adding new material

Post by fmk » Wed Jul 16, 2014 9:16 am

can't say off the top of mmy head. build OpenSees without any modifications to make sure it compiles. if it compiles then add your code in stages.

baozai
Posts: 212
Joined: Tue Jan 04, 2011 3:39 am
Location: Southeast University

Re: question on adding new material

Post by baozai » Wed Jul 16, 2014 10:19 am

Hi, Frank, Thank you for the reply. I did compile OpenSees successfully before adding the code. May I send my source code and relative changes in other files to you to see if you have time to have a look at it? I appreciate the help.
Baozai

fmk
Site Admin
Posts: 5883
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: question on adding new material

Post by fmk » Mon Jul 21, 2014 11:35 am

i am busy through next week .. conference in Alaska .. after that you can send

baozai
Posts: 212
Joined: Tue Jan 04, 2011 3:39 am
Location: Southeast University

Re: question on adding new material

Post by baozai » Tue Jul 22, 2014 7:34 am

Hi, Frank. Thank you very much for this help. Have a good time in Alaska.
Baozai

fmk
Site Admin
Posts: 5883
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: question on adding new material

Post by fmk » Tue Sep 23, 2014 7:40 am

don't put www.XXX.com in a message . they will get deleted.

Post Reply