Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using utility routines in C++ subroutines

Status
Not open for further replies.

gseidel

Mechanical
Joined
Sep 4, 2018
Messages
1
Location
BE
Hello,

Here is my problem. I need to access nodal displacement and velocity of a specific (or some specific) node(s) during the integration process and in particular in the dload and uexternaldb subroutines.

Therefore I wrote a bunch of lines in C++ for those functions as follows:

extern "C" void dload_(...a lot of parameters...)
{
// my code
}

This is actually working when I test the function by writing some dummy values in some text files. But since U, V and A are not parameters of dload, I would like to use the utility routine getvrn_(NODE,'VAR',ARRAY,JRCD,JGVBLOCK,LTRN) and I'm currently facing two problems:

- I'm unable to pass the JGVBLOCK variable which is only available in UMESHMOTION subroutine
- I'm struggling with character arrays and the magnificent "Illegal memory access" while running the simulation.

I tested to call a basic utility routine in uexternaldb following this:

extern "C" void getnumcpus_(int* NUMPROCESSES);
extern "C" void uexternaldb_(...a lot of parameters...)
{
// some code
int *lenvar;
lenvar=new int;
getnumcpus_(lenvar);
cout << *lenvar;
// some code
}

and it works. Does anyone know how I could call GETVRN utility routine in both DLOAD and UEXTERNALDB subroutines OR maybe there is an easier way to get the iterated displacement and velocities of nodes.

Thank you in advance for you advice !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top