Search found 68 matches

by stephanmg
Fri Nov 22, 2013 10:22 am
Forum: Other questions
Topic: C/C++ API
Replies: 43
Views: 11866

Re: C/C++ API

Okay, that works, but: consider my geometry from above with 103 sections and about 3000 points: I load it with hoc_valid_stmt("",0) => I have 103 sections and about 3000 points by counting n3d() in each section by iterating over all sections. Then I delete all sections and points by forall pt3dclear...
by stephanmg
Tue Nov 19, 2013 4:17 am
Forum: Other questions
Topic: C/C++ API
Replies: 43
Views: 11866

Re: C/C++ API

Hey hines, thank you very much for your efforts and help. I give an example of the common geometries we need to load and reset in hoc in the Appendix. I attached a geom.hoc file for that purpose under this post: https://www.dropbox.com/s/nm6f0hz0opttxbs/geom.hoc It would be good, if one could do it ...
by stephanmg
Sun Nov 17, 2013 10:08 am
Forum: Other questions
Topic: C/C++ API
Replies: 43
Views: 11866

Re: C/C++ API

okay, here we go. thanks again. i guess this could be enough for my purposes. :)
all the best,
Stephan

Edit: Ah no, it does not, i now iterate over all sections and do pt3dclear() :)

Sadly this does not help to delete all the points. :(
by stephanmg
Sun Nov 17, 2013 8:00 am
Forum: Other questions
Topic: C/C++ API
Replies: 43
Views: 11866

Re: C/C++ API

There is no single function that frees all variables. Instead unreferences the objects that were created and that causes the memory to be reclaimed. If there are a lot of large Vector objects and you can't unreference them completely, then you can free most of their space with objref vlist vlist = ...
by stephanmg
Thu Nov 14, 2013 11:01 am
Forum: Other questions
Topic: C/C++ API
Replies: 43
Views: 11866

Re: C/C++ API

hines wrote:if you can figure out how to send a (control)D to the stdin, that will cause ivocmain to return normally.
Ah okay, it would also be enough if i just could free all variables. :)


Thanks!

All the best,
Stephan
by stephanmg
Mon Nov 11, 2013 5:59 am
Forum: Other questions
Topic: C/C++ API
Replies: 43
Views: 11866

Re: C/C++ API

Oh i see, it does not clear all variables, i utilize:

Code: Select all

hoc_final_exit();
	ivoc_final_exit();
	ivoc_cleanup();
But that has no effect at all.

All the best,
Stephan
by stephanmg
Sat Nov 09, 2013 8:08 am
Forum: Other questions
Topic: C/C++ API
Replies: 43
Views: 11866

Re: C/C++ API

see how the hoc 'quit()' function is executed in src/oc/hoc.c via hoc_quit(). That perhaps goes to far as it executes exit(0) but you can see the two cleanup functions called. Excellent! I sticked to src/ivoc/ivoc.cpp => I just needed to cleanup the hoc environment (i. e. clear all variables etc.)....
by stephanmg
Fri Nov 08, 2013 4:49 am
Forum: Other questions
Topic: C/C++ API
Replies: 43
Views: 11866

Re: C/C++ API

One question concerning hoc_valid_stmt(..., ...): How can I make it less talky, i. e. supress the output of the executed statement? If this would be possible, it would be great. All the best, Stephan Edit: great forum! Found the (partial) answer here: http://www.neuron.yale.edu/phpBB/viewtopic.php?f...
by stephanmg
Mon Oct 28, 2013 1:17 pm
Forum: Other questions
Topic: iterating over selected sections
Replies: 5
Views: 1687

Re: iterating over selected sections

Ted, thank you so much! You just explained "my" workaround I was considering bad practice, which I already implemented exactly the way you are describing it! Perfect, thanks for your affirmation. And thanks again for your work and time supporting me. NB: Another possibilty would be if i could global...
by stephanmg
Mon Oct 28, 2013 12:19 pm
Forum: Other questions
Topic: iterating over selected sections
Replies: 5
Views: 1687

Re: iterating over selected sections

Dear hines, dear ted, I'm sorry, my question was misleading. I know that i can iterate over all sections with the "forall" construct. I tried to access a section by an index... let's say we have: objref all_sections all_sections = new SectionList() total_sections = 0 forall { all_sections.append() }...
by stephanmg
Sun Oct 27, 2013 9:16 am
Forum: Other questions
Topic: iterating over selected sections
Replies: 5
Views: 1687

iterating over selected sections

How can i translate

Code: Select all

forall for i=0,n3d()-1 fprint("%f %f %f %f\n", x3d(i), y3d(i), z3d(i), v(i)) 
to something like:

Code: Select all

for i=0, all-sections()
 for j =0, n3d() -1
fprint("%f %f %f %f\n", x3d(i), y3d(i), z3d(i), v(i)) 
Best regards,
Stephan
by stephanmg
Sat Oct 26, 2013 11:13 am
Forum: Other questions
Topic: C/C++ API
Replies: 43
Views: 11866

Re: C/C++ API

You're my hero for today. :)

All the best,
Stephan
by stephanmg
Sat Oct 26, 2013 8:53 am
Forum: Other questions
Topic: C/C++ API
Replies: 43
Views: 11866

Re: C/C++ API

Update: I managed to compile the code below (which executes valid hoc statements as expected now, yeah!). I compiled it with the line: g++ -L nrn-7.3/x86_64/lib/ nrn-7.3/src/oc/modlreg.o example.cpp nrn-7.3/x86_64/lib/nvkludge.o -lnrnoc -lnrniv -livoc -loc -lneuron_gnu -lscopmath -lsparse13 -lsundia...
by stephanmg
Sat Oct 26, 2013 4:58 am
Forum: Other questions
Topic: C/C++ API
Replies: 43
Views: 11866

Re: C/C++ API

bool test = hoc_is_double_arg(i); is out of context since it assumes the interpreter has called your main function. It looks at the argument the interpreter put on its stack. But the interpreter was never started. You would need to follow the initialization process used in nrniv/nrnmain.cpp which c...
by stephanmg
Fri Oct 25, 2013 4:29 pm
Forum: Other questions
Topic: C/C++ API
Replies: 43
Views: 11866

Re: C/C++ API

Using this linkage i arrive at that error, mh: nrn-7.3/x86_64/lib//libnrnoc.so: undefined reference to `modl_reg' I will try to figure out this, i will update my post if I could figure out for other people. My example code is (also i defined nil to be NULL since nil is otherwise undefined somehow): ...