CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (http://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   Cloning a case without the GUI using cloneCase function (http://www.cfd-online.com/Forums/openfoam-pre-processing/62165-cloning-case-without-gui-using-clonecase-function.html)

muerzo September 25, 2006 15:50

Hello, this is my first attemp
 
Hello, this is my first attempt in the "thread" world you have here, I've seen pretty useful things, but nothing about this.
I don't know if i'm looking in the wrong thread... anyway...sorry if i am, I need to clone a case straight from the code, without using FoamX->Clone Case app.

I need this because I'm working with a slightly modified version of icoFoam that allows me to change BC's; Once a BC has changed, I pretend to set up a new cloned case and just edit the changed BC's, run the solver again, keeping the old case running in another process in the background, and starting to run the new one (the cloned one).
I know I'm a OpenFOAM beginner, and probably asking way more over me.. but does anyone know how to do it??
I've been checking the FoamX.C code, and theres a function

" void FoamXServer::CaseBrowser::ICaseBrowser_stub::clone Case( const FoamXServer::CaseDescriptor& _par_caseDesc, const char* _par_newCaseRootDir, const char* _par_newCaseName, const char* _par_newAppClassName, const char* _par_timeSel ) "

that i think is the one responsible for that, but i'm not quite sure which is the FoamXServer::CaseDescriptor& and how to obtain it.
Remember.. anything but using the GUI..thanks so much.

mattijs September 26, 2006 04:57

Can't you just do a 'cp' inste
 
Can't you just do a 'cp' instead? Just call e.g. system("cp -r cavity-orig cavity")

(Or use the 'cp' function in OSspecific.H but that has a bug in it in 1.3 when copying subdirectories)

muerzo September 26, 2006 12:14

Thanks Matttijs for the quick
 
Thanks Matttijs for the quick response, but is there no way to do it the way I intend to? the system calls were the thing i didn't want to do, but probably I'll end up doing that. Thanks again.

Even so, do you know how can i obtain the information from the caseDescriptor?

Thanks a lot,

mattijs September 27, 2006 04:17

caseDescriptor : see idl/FoamX
 
caseDescriptor : see idl/FoamX.idl in the FoamX source directory. In the ICaseBrowserImpl.C there are enough examples how to use it.

muerzo September 27, 2006 13:35

Thanks again, I'll look into i
 
Thanks again, I'll look into it...

muerzo September 27, 2006 16:44

Hi again, I'm still not there
 
Hi again, I'm still not there yet, I checked the code you told me to.
In the FoamX.idl file (which is newer than C++ to me...*sigh*) they define CaseDescriptor as a structure, ok so far.
Then in the ICaseBrowserImpl.C caseDescriptor is mentioned in several functions, in the .H file one can see how its created ( I think, please correct me if I'm wrong)

FoamXServer::CaseDescriptor* FoamX::ICaseBrowserImpl::caseDescriptor
(
const fileName& rootDir,
const fileName& rawRootDir,
const fileName& caseName
)

That in the ICaseBrowserImpl.C file. The questions remain: is this created when FoamX is started, or when i double click on a case? how can I have the caseDescriptor available for me without starting FoamX? any piece of advice to have a function or something that returns me this?

Sorry for the persistence, thanks!

PS. Why in FoamX.C the cloneCase funtion is called like this:

void FoamXServer::CaseBrowser::ICaseBrowser_stub::clone Case(...)

why a stub.. hehe and what does that mean?

mattijs September 29, 2006 05:51

This is all Corba stuff. Haven
 
This is all Corba stuff. Haven't looked at it for a while. If you insist on going this way have a look at IHostBrowserImpl::openCaseBrowser. This function gets called by the Java client when you click on a machine.

So you'll have to do something similar, then get the reference of the started caseBrowser from the name server ('nsd', has to be running) and then you'll be able to construct one of those caseDescriptors and call cloneCase somehow.

muerzo September 29, 2006 12:07

Thanks.. I will look into it..
 
Thanks.. I will look into it... probably it will take me a while, so thanks a lot for the really useful tips you have given me. Will be back with more questions.. hehe


All times are GMT -4. The time now is 01:42.