How to get node/elements responses in my material?

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

Moderators: silvia, selimgunay, Moderators

Post Reply
huyuntian
Posts: 10
Joined: Sun Sep 28, 2014 6:41 pm

How to get node/elements responses in my material?

Post by huyuntian » Tue Mar 21, 2017 5:41 pm

Dear FMK and other friend :)

I have developed a new material by the way of compiling dll.And it works well.

Now I want to get current state of the model (the location of NodeI for example) in my material.

When I include the Domain.h and Node.h in my cpp and use:

Domain* theDomain = OPS_GetDomain();

to get the pointer. Compiling is OK, But when i use the dll, OpenSees process no response(crashed).

Then I try to use the OPS_GetNodeCrd method like:

double XYZ[3];
int nodeI=5;
int size=3;
OPS_GetNodeCrd(&nodeI,&size,XYZ);
opserr << "X of " << nodeI << " is "<< XYZ[0] <<endln;
opserr << "Y of " << nodeI << " is "<< XYZ[1] <<endln;
opserr << "Z of " << nodeI << " is "<< XYZ[2] <<endln;

Compiling is OK too, but OpenSees print :

X of 5 is 0
Y of 5 is 0
Z of 5 is 0
X of 5 is 0
Y of 5 is 0
Z of 5 is 0
X of 5 is 0
Y of 5 is 0
Z of 5 is 0
X of 5 is 0
Y of 5 is 0
Z of 5 is 0

I am sure the crd. of Node5 is not zero.I cant find out the problems here. Help ME~~

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

Re: How to get node/elements responses in my material?

Post by fmk » Wed Mar 22, 2017 9:02 pm

it's the .dll .. it will probably work on a mac or linux .. you may need to build your own version of opensees and include your material .. basically dll's have their own address space, and the global pointer is not the same as the local dll one which is why the programe crashes as pointer is pointing to garbage

Post Reply