ElasticPPcpp dll compiled but failed to run in OpenSees

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

Moderators: silvia, selimgunay, Moderators

FBeckwith
Posts: 4
Joined: Fri Feb 08, 2013 10:21 am
Location: University of California, San Diego

ElasticPPcpp dll compiled but failed to run in OpenSees

Post by FBeckwith » Mon Sep 15, 2014 4:22 pm

I've been working with OpenSees for roughly a year now and am attempting to create my own material. However, I can't even get past the example ElasticPPcpp on the SVN.

I followed all the steps to a tee and successfully compiled a ElasticPPcpp.dll file using Visual Studio Express 2013. After I copied the .dll file to the ..\DEVELOPER\material\cpp directory, I ran the example file in OpenSees from the command prompt and changed directories accordingly. It spat out "WARNING could not create uniaxialMaterial ElasticPPcpp," like the dll didn't even exist.

I recompiled the file a couple of times (by deleting everything and starting over) but to no avail and I'm at my wits end. I would appreciate any help if possible. Some more information:
IDE - Visual Studio Express 2013
OpenSees v2.4.4 (latest)
SVN Build 5814

Thanks in advance.

FBeckwith
Posts: 4
Joined: Fri Feb 08, 2013 10:21 am
Location: University of California, San Diego

Re: ElasticPPcpp dll compiled but failed to run in OpenSees

Post by FBeckwith » Tue Sep 23, 2014 9:54 am

Shameless bump. Long story short, following steps 1-24 of the windows instructions successfully compiled the ElasticPPcpp.dll. Following steps 25-28 to load the new ElasticPPcpp.dll into OpenSees failed. I don't know what could be the issue, and I would really appreciate any advice.

Thanks

mtsonicc
Posts: 55
Joined: Wed Mar 14, 2012 6:27 pm
Location: Hanyang University

Re: ElasticPPcpp dll compiled but failed to run in OpenSees

Post by mtsonicc » Sat Sep 27, 2014 8:33 pm

are you using 64-bit version of OpenSees?

I had same problem with you. but after using 32-bit version of OpenSees, it worked perfectly fine.

FBeckwith
Posts: 4
Joined: Fri Feb 08, 2013 10:21 am
Location: University of California, San Diego

Re: ElasticPPcpp dll compiled but failed to run in OpenSees

Post by FBeckwith » Tue Sep 30, 2014 2:41 pm

Thanks, that did the trick. Works exactly as in the tutorial. Now to write my own material...

mtsonicc
Posts: 55
Joined: Wed Mar 14, 2012 6:27 pm
Location: Hanyang University

Re: ElasticPPcpp dll compiled but failed to run in OpenSees

Post by mtsonicc » Fri Oct 03, 2014 5:13 pm

I, too, have been trying to write my own material. but it didn't work out as i intended.

so i tried existing material in OpenSees SVN.

all i did was modify every words (which was, 'ElasticMaterial') to "MyTestMaterial" in "ElasticMaterial.cpp" and "ElasticMaterial.h" to see if new OpenSees command is working.
(e.g. uniaxialMaterial MyTestMaterial $matTag $E <$eta> <$Eneg> )

I successfully created "MyTestMaterial.dll" by following the tutorial, but OpenSees spat out like : WARNING could not create uniaxialMaterial MyTestMaterial
(I also tried modifying Steel01 OpenSees command: Steel01 to trialMat01, but it didn't work also.)

I have no idea what is wrong with 'MyTestMaterial.dll'.

mtsonicc
Posts: 55
Joined: Wed Mar 14, 2012 6:27 pm
Location: Hanyang University

Re: ElasticPPcpp dll compiled but failed to run in OpenSees

Post by mtsonicc » Fri Oct 03, 2014 10:06 pm

I feel so shamed that i didn't read the entire manual.

All i need to do was to change 'OPS_ElasticPPcpp' to 'OPS_MyMat' to implement my material to OpenSees, instead of changing every 'ElasticPPcpp' to 'MyMat'.

and i also solved the problem for other materials (such as, Steel01)

#ifdef _USRDLL
#define OPS_Export extern "C" _declspec(dllexport)
#elif _MACOSX
#define OPS_Export extern "C" __attribute__((visibility("default")))
#else
#define OPS_Export extern "C"
#endif

should be included before 'OPS_MyMat' starts, as masual said.


and now I have another question.
for some existing materials(such as, Pinching4Material and ElasticMaterial, etc.), external procedure is not included.
How do i modify OpenSees material command from 'Pinching4' to 'MyMat' for cases like this?

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

Re: ElasticPPcpp dll compiled but failed to run in OpenSees

Post by fmk » Mon Oct 06, 2014 9:35 am

you simply have to look at what arguments the constuctor takes, i.e. order of ints and doubles, and then modify one of the exsiting OPS routines you have now working

mtsonicc
Posts: 55
Joined: Wed Mar 14, 2012 6:27 pm
Location: Hanyang University

Re: ElasticPPcpp dll compiled but failed to run in OpenSees

Post by mtsonicc » Tue Oct 07, 2014 12:13 am

Thank you for your reply, fmk
I'm very much apprreciated with your kind advice.

for Pinching4 material, external procedure is not included.
so i added one from "elasticPPcpp", as fmk adviced.

finally, modified 'Pinching4' (which is 'MyMat') seems to work well.

and i have one more question.
I'm trying to save a variable included in 'Pinching4'.(it can be any variables. in this case, Tstrain)
I tried
======================================================
ofstream outputFile(myString, ios::out | ios::app);
sprintf(myString, "%20.8e", Tstrain);
outputFile << myString << endln;
outputFile.close();
=====================================================
procedure during "int Pinching4Material::commitState(void)".
I successfully saved variable 'Tstrain' as 'Tstrain.txt'.

but when i used this method, analysis time greatly increased.
is this because i implemented this code in "commitState"?

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

Re: ElasticPPcpp dll compiled but failed to run in OpenSees

Post by fmk » Tue Oct 07, 2014 3:29 pm

you could try it before you modify the code .. the extra time could be because of the dll as opposed to your different code. i am curious if it is the dll.

Sanjeema
Posts: 14
Joined: Tue Nov 17, 2015 4:37 am
Location: Tokyo Institute of Technology

Re: ElasticPPcpp dll compiled but failed to run in OpenSees

Post by Sanjeema » Sun Dec 13, 2015 11:02 pm

Dear All,

I tried building a DLL for ElasticPPcpp as demonstrated in the example with the latest Developer in MS Visual Studio 2010. But I got two error messages:

Error 2 error C2733: second C linkage of overloaded function 'ops_getstring' not allowed i:\2015\c plus plus practice\3_elasticppcpp with new developer\developer\core\win32functions.cpp 217
Error 31 error C1083: Cannot open include file: 'EigenSOE.h': No such file or directory i:\2015\c plus plus practice\3_elasticppcpp with new developer\developer\core\incrementalintegrator.cpp 41

The code for win32functions.cpp in the trunk
http://opensees.berkeley.edu/WebSVN/fil ... ctions.cpp is a little different from the one I got downloaded from svn in the following lines:

typedef const char *(*OPS_GetStringType)();

extern "C" const char *OPS_GetString()
{
return (*OPS_GetStringPtr)();
}

I could not find this declaration and definitions in any of the previous versions of revision or the current version in the trunk.

As for the IncrementalIntegrator.cpp, do I need to download EigenSOE.h? It isn't in the core directory.

So, what I did was to use an older Developer. win32functions.cpp did not give the C2733 error; OPS_GetString had a different declaration and definition. And, IncrementalIntegrator.cpp did not icnlude a EigneSOE.h.

On doing so, I successfully compiled the dll. But when I run it in the command prompt, it gives the error:

WARNING could not create uniaxialMaterial ElasticPPcpp

while executing
"uniaxialMaterial ElasticPPcpp 1 3000 0.001"
(file "example1.tcl" line 22)

The tcl script, ElasticPPcpp.dll and OpenSees.exe are in the same folder.

I did see the recommendation to use 32-bit OpenSees.exe. But can't I get around this problem with a 64-bit OpenSees.exe?

Please suggest.

Sanjeema

mtsonicc
Posts: 55
Joined: Wed Mar 14, 2012 6:27 pm
Location: Hanyang University

Re: ElasticPPcpp dll compiled but failed to run in OpenSees

Post by mtsonicc » Sun Dec 13, 2015 11:33 pm

I could't understand your question.

you successfully created dll, but failed to run it on OpenSEES 64-bit?

how about using 32-bit OpenSEES to see if dll has error?

and for downloading missing files, my problem solved when I added missing files.

Sanjeema
Posts: 14
Joined: Tue Nov 17, 2015 4:37 am
Location: Tokyo Institute of Technology

Re: ElasticPPcpp dll compiled but failed to run in OpenSees

Post by Sanjeema » Mon Dec 14, 2015 2:52 am

Hi,

Yes, I successfully created dll but failed to run it in OpenSees 64-bit. I'd prefer it if I can run it in the 64-bit, without resorting to 34-bit.

As for the missing files, they aren't in the core directory. You mean to say, I could just use a different filepath and download from svn? I actually copied those files from the OpenSees/trunk/src/system_of_eqn/eigenSOE/EigenSOE.h and added whatever file popped up as missing, but it just kept asking for another file until I couldn't find the last one.

Sanjeema

mtsonicc
Posts: 55
Joined: Wed Mar 14, 2012 6:27 pm
Location: Hanyang University

Re: ElasticPPcpp dll compiled but failed to run in OpenSees

Post by mtsonicc » Mon Dec 14, 2015 5:19 am

for more details about missing files :
Visual studio : I drag & dropped missing files in the 'Source Files' folder located in the solution explorer.

OS X :
method one - simply copy missing files in the same folder where "makefile" exists.
or method two - add more file path to the variable "INCLUDE" in the makefile.def.



and here's some questions i would like to ask.
1) is 64-bit OpenSees any better than 32-bit one? if not, it'd be better to use 32-bit OpenSees
2) how did you successfully created dll, while some files are missing?

Sanjeema
Posts: 14
Joined: Tue Nov 17, 2015 4:37 am
Location: Tokyo Institute of Technology

Re: ElasticPPcpp dll compiled but failed to run in OpenSees

Post by Sanjeema » Mon Dec 14, 2015 5:58 pm

Hi,

Where did you get those missing files? I copied and pasted the code(which I found in the Opensees/trunk/src) and created a header or a cpp file by myself as required. But I guess there's another way around it. I am using VisualStudio 2010.

I used an older Developer/core to build the dll, which didnot give me any error for the win32functions.cpp nor the IncrementalIntegrator.cpp(EigenSOE.h was included within this cpp in the latest Developer; I checked in the older one, it was not there.). That's how I built the dll.

As for the 64-bit or 32-bit, just wanted to know if I could get around the problem with 64-bit. Sure, I will go for 32-bit.

Sanjeema

mtsonicc
Posts: 55
Joined: Wed Mar 14, 2012 6:27 pm
Location: Hanyang University

Re: ElasticPPcpp dll compiled but failed to run in OpenSees

Post by mtsonicc » Mon Dec 14, 2015 6:14 pm

I remember that i had problem compiling example material(elasticPPcpp) with core directory alone.
but searching missing files and then pasting into my additional library (or core folder) solved the issue.

first of all, I downloaded whole files from OpenSees svn. (http://opensees.berkeley.edu/OpenSees/developer/svn.php)

while building custom materials, whenever error messages('missing files') pop up, i searched the whole svn directory and copied necessary files into my library.


i believe 'EigneSOE.h.' is located in /SRC/system_of_eqn

Post Reply