mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
removing FoamX
This commit is contained in:
@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -x
|
||||
|
||||
(cd Idl ; make)
|
||||
(cd C++ ; ./Allwmake)
|
||||
(cd Java ; wmake jar)
|
||||
@ -1,17 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -x
|
||||
|
||||
case $WM_ARCH in
|
||||
linux*)
|
||||
CMD="wmake libso"
|
||||
;;
|
||||
*)
|
||||
CMD="wmake lib"
|
||||
esac
|
||||
|
||||
(cd FoamXServer; $CMD)
|
||||
(cd FoamXLib; $CMD)
|
||||
(cd FoamXHostBrowser ; wmake)
|
||||
(cd FoamXCaseBrowser ; wmake)
|
||||
(cd FoamXCaseServer ; wmake)
|
||||
#(cd FoamXCasePostServer ; wmake)
|
||||
@ -1,145 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// Foam header files.
|
||||
#include "argList.H"
|
||||
#include "OSspecific.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamXErrors.H"
|
||||
#include "ICaseBrowserImpl.H"
|
||||
#include "LogManager.H"
|
||||
#include "LogEntry.H"
|
||||
#include "Paths.H"
|
||||
#include "Orb.H"
|
||||
|
||||
// Declare all the namespaces used by FoamX
|
||||
#include "FoamXNameSpaces.H"
|
||||
|
||||
using namespace FoamX;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamXCaseBrowser::main(int argc, char **argv)";
|
||||
|
||||
try
|
||||
{
|
||||
FatalError.throwExceptions();
|
||||
FatalIOError.throwExceptions();
|
||||
|
||||
// Make copy of raw args (since Orb modifies them)
|
||||
stringList args(argc);
|
||||
forAll(args, argI)
|
||||
{
|
||||
args[argI] = argv[argI];
|
||||
}
|
||||
|
||||
// Initialise the log manager object.
|
||||
LogManager logManager(Paths::tmp/"CaseBrowserLog.xml");
|
||||
|
||||
// Register the root function call.
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
// Construct the ORB.
|
||||
FoamX::Orb orb(argc, argv);
|
||||
|
||||
// Construct argList so job gets registered.
|
||||
argList::validArgs.clear();
|
||||
argList dummyArgs(argc, argv);
|
||||
|
||||
// Allocate the ICaseBrowserImpl object on the heap.
|
||||
// This is a reference counted object and will be deleted by
|
||||
// the POA when it is no longer needed.
|
||||
ICaseBrowserImpl* caseBrowserPtr = new ICaseBrowserImpl(orb, args);
|
||||
|
||||
if (caseBrowserPtr == NULL)
|
||||
{
|
||||
FatalErrorIn(functionName)
|
||||
<< "Failed to instantiate ICaseBrowserImpl object."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
log << "Created ICaseBrowserImpl object" << endl;
|
||||
|
||||
// Emit the IOR.
|
||||
log << "IOR : " << orb.ior(caseBrowserPtr->_this()) << endl;
|
||||
|
||||
Info << "CaseBrowser running....." << endl;
|
||||
|
||||
// Go! Go! Go!
|
||||
orb.run();
|
||||
}
|
||||
catch (Foam::IOerror& fIOErr)
|
||||
{
|
||||
Serr<< "Caught Foam IOerror in " << functionName << " : "
|
||||
<< nl << fIOErr << endl;
|
||||
}
|
||||
catch (Foam::error& fErr)
|
||||
{
|
||||
Serr<< "Caught Foam error in " << functionName << " : "
|
||||
<< nl << fErr << endl;
|
||||
}
|
||||
catch (FoamXServer::FoamXIOError& fIOErr)
|
||||
{
|
||||
Serr<< "Caught FoamXIOError exception in " << functionName << " : "
|
||||
<< nl << fIOErr << endl;
|
||||
}
|
||||
catch (FoamXServer::FoamXError& ex)
|
||||
{
|
||||
Serr<< "Caught FoamXError exception in " << functionName << " : "
|
||||
<< nl << ex << endl;
|
||||
}
|
||||
catch (CORBA::COMM_FAILURE& ex)
|
||||
{
|
||||
Serr<< "Caught CORBA::COMM_FAILURE exception in "
|
||||
<< functionName << endl;
|
||||
}
|
||||
catch (CORBA::SystemException& ex)
|
||||
{
|
||||
Serr<< "Caught CORBA::SystemException exception in "
|
||||
<< functionName << endl;
|
||||
}
|
||||
catch (CORBA::Exception& ex)
|
||||
{
|
||||
Serr<< "Caught CORBA::Exception exception in "
|
||||
<< functionName << endl;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
Serr<< "Caught system exception in "
|
||||
<< functionName << endl;
|
||||
}
|
||||
|
||||
Info<< "Finishing " << functionName << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,396 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::ICaseServerImpl
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
ICaseBrowserImpl.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef ICaseBrowserImpl_H
|
||||
#define ICaseBrowserImpl_H
|
||||
|
||||
// Foam header files.
|
||||
#include "fileName.H"
|
||||
#include "HashPtrTable.H"
|
||||
#include "long.H"
|
||||
#include "stringList.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "ProcessControl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
inline bool operator==
|
||||
(
|
||||
const FoamXServer::JobID& jid1,
|
||||
const FoamXServer::JobID& jid2
|
||||
)
|
||||
{
|
||||
return
|
||||
(
|
||||
jid1.processID == jid2.processID
|
||||
&& Foam::word(jid1.hostName) == Foam::word(jid2.hostName)
|
||||
);
|
||||
}
|
||||
|
||||
inline Ostream& operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const FoamXServer::JobID& jid
|
||||
)
|
||||
{
|
||||
os << Foam::word(jid.hostName) << '.' << jid.processID;
|
||||
|
||||
return os;
|
||||
}
|
||||
};
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
// Forward declaration of classes.
|
||||
class IPropertiesImpl;
|
||||
class Orb;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class ICaseBrowserImpl Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class ICaseBrowserImpl
|
||||
:
|
||||
public POA_FoamXServer::CaseBrowser::ICaseBrowser,
|
||||
public PortableServer::RefCountServantBase
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Context name for name server registration.
|
||||
Foam::fileName hostContext_;
|
||||
|
||||
//- Object name for name server registration.
|
||||
Foam::fileName objectName_;
|
||||
|
||||
//- Reference to the ORB
|
||||
Orb& orb_;
|
||||
|
||||
//- Argument list
|
||||
Foam::stringList args_;
|
||||
|
||||
//- Reference to the host browser
|
||||
FoamXServer::HostBrowser::IHostBrowser_var hostBrowser_;
|
||||
|
||||
//- Foam system properties for this server.
|
||||
IPropertiesImpl* foamProperties_;
|
||||
|
||||
//- Case list.
|
||||
Foam::HashPtrTable<FoamXServer::CaseDescriptor, Foam::string> cases_;
|
||||
|
||||
class hashJobID
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
hashJobID()
|
||||
{}
|
||||
|
||||
Foam::label operator()
|
||||
(
|
||||
const FoamXServer::JobID& key,
|
||||
const Foam::label tableSize
|
||||
) const
|
||||
{
|
||||
return Foam::mag(Foam::label(key.processID%tableSize));
|
||||
}
|
||||
};
|
||||
|
||||
typedef Foam::HashPtrTable
|
||||
<FoamXServer::JobDescriptor, FoamXServer::JobID, hashJobID>
|
||||
JobHashTable;
|
||||
|
||||
//- Running jobs list.
|
||||
JobHashTable runningJobs_;
|
||||
|
||||
//- Finished jobs list.
|
||||
JobHashTable finishedJobs_;
|
||||
|
||||
//- Process controls
|
||||
FoamX::ProcessControl procControl_;
|
||||
|
||||
|
||||
// Private member functions.
|
||||
|
||||
// Return the case server key for the given root and case
|
||||
static Foam::fileName caseServerKey
|
||||
(
|
||||
const char* rootDir,
|
||||
const char* caseName
|
||||
);
|
||||
|
||||
void getCaseServerReference
|
||||
(
|
||||
const Foam::fileName& lockFile,
|
||||
FoamXServer::CaseServer::ICaseServer_out caseObj
|
||||
);
|
||||
|
||||
static FoamXServer::CaseDescriptor* caseDescriptor
|
||||
(
|
||||
const Foam::fileName& rootDir,
|
||||
const Foam::fileName& rawRootDir,
|
||||
const Foam::fileName& caseFileName
|
||||
);
|
||||
|
||||
//- Get dictionary entry or default value.
|
||||
static Foam::label getEntry
|
||||
(
|
||||
const Foam::dictionary&,
|
||||
const Foam::word& key,
|
||||
const Foam::label defaultValue
|
||||
);
|
||||
|
||||
//- Get dictionary entry or default value.
|
||||
static Foam::string getEntry
|
||||
(
|
||||
const Foam::dictionary&,
|
||||
const Foam::word& key,
|
||||
const Foam::string& defaultValue
|
||||
);
|
||||
|
||||
static void readJobs
|
||||
(
|
||||
JobHashTable& jobsList,
|
||||
const Foam::fileName& dir,
|
||||
const bool throwOnError
|
||||
);
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
ICaseBrowserImpl(Orb& orb, const Foam::stringList& args);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~ICaseBrowserImpl();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Implemented ICaseBrowser methods.
|
||||
|
||||
//- Foam system properties (user data editable).
|
||||
virtual FoamXServer::CaseServer::IFoamProperties_ptr
|
||||
foamProperties();
|
||||
|
||||
//- Managed cases list.
|
||||
virtual FoamXServer::CaseDescriptorList* cases();
|
||||
|
||||
//- Running jobs list.
|
||||
virtual FoamXServer::JobDescriptorList* runningJobs();
|
||||
|
||||
//- Finished jobs list.
|
||||
virtual FoamXServer::JobDescriptorList* finishedJobs();
|
||||
|
||||
virtual void getEnv
|
||||
(
|
||||
const char* envName,
|
||||
CORBA::String_out enval
|
||||
);
|
||||
|
||||
virtual void getHostName(CORBA::String_out hostName);
|
||||
|
||||
virtual void getUserName(CORBA::String_out userName);
|
||||
|
||||
virtual CORBA::Long fileModificationDate(const char* fName);
|
||||
|
||||
virtual void readFile
|
||||
(
|
||||
const char* fName,
|
||||
CORBA::String_out contents
|
||||
);
|
||||
|
||||
virtual void writeFile
|
||||
(
|
||||
const char* fName,
|
||||
const char* contents
|
||||
);
|
||||
|
||||
virtual CORBA::Long invokeUtility
|
||||
(
|
||||
const char* hostName,
|
||||
const char* utilityName,
|
||||
const FoamXServer::StringList& arguments,
|
||||
const char* logName,
|
||||
CORBA::Boolean background
|
||||
);
|
||||
|
||||
virtual void openCase
|
||||
(
|
||||
const FoamXServer::CaseDescriptor& caseDesc
|
||||
);
|
||||
|
||||
virtual void openCasePost
|
||||
(
|
||||
const FoamXServer::CaseDescriptor& caseDesc,
|
||||
const CORBA::Long nProcs
|
||||
);
|
||||
|
||||
virtual void newCase
|
||||
(
|
||||
const char* rootDir,
|
||||
const char* caseName,
|
||||
const char* app
|
||||
);
|
||||
|
||||
virtual void importCase
|
||||
(
|
||||
const char* rootDir,
|
||||
const char* caseName,
|
||||
const char* app
|
||||
);
|
||||
|
||||
virtual void deleteCase
|
||||
(
|
||||
const FoamXServer::CaseDescriptor& caseDesc
|
||||
);
|
||||
|
||||
virtual void cloneCase
|
||||
(
|
||||
const FoamXServer::CaseDescriptor& caseDesc,
|
||||
const char* newRootDir,
|
||||
const char* newCaseName,
|
||||
const char* newAppClassName,
|
||||
const char* timeSel
|
||||
);
|
||||
|
||||
virtual CORBA::Boolean getCaseServerReference
|
||||
(
|
||||
const char* rootDir,
|
||||
const char* caseName,
|
||||
FoamXServer::CaseServer::ICaseServer_out caseObj
|
||||
);
|
||||
|
||||
virtual CORBA::Boolean getCasePostServerReference
|
||||
(
|
||||
const char* rootDir,
|
||||
const char* caseName,
|
||||
CORBA::Long nProcs,
|
||||
FoamXServer::CasePostServer::ICasePostServer_out caseObj
|
||||
);
|
||||
|
||||
virtual CORBA::Boolean caseLocked
|
||||
(
|
||||
const FoamXServer::CaseDescriptor& caseDesc
|
||||
);
|
||||
|
||||
virtual void unlockCase
|
||||
(
|
||||
const char* rootDir,
|
||||
const char* caseName
|
||||
);
|
||||
|
||||
virtual void unlockCaseDescriptor
|
||||
(
|
||||
const FoamXServer::CaseDescriptor& caseDesc
|
||||
);
|
||||
|
||||
virtual void addCase
|
||||
(
|
||||
const char* rootDir,
|
||||
const char* rawRootDir,
|
||||
const char* caseName,
|
||||
const char* appName
|
||||
);
|
||||
|
||||
virtual void caseOpen
|
||||
(
|
||||
const char* rootDir,
|
||||
const char* caseName
|
||||
);
|
||||
|
||||
virtual CORBA::Boolean isCaseInError
|
||||
(
|
||||
const FoamXServer::CaseDescriptor& caseDesc
|
||||
);
|
||||
|
||||
virtual void caseIsInError
|
||||
(
|
||||
const FoamXServer::CaseDescriptor& caseDesc
|
||||
);
|
||||
|
||||
virtual void refreshCaseList();
|
||||
|
||||
virtual void addToCaseList(const char* rootDir);
|
||||
|
||||
|
||||
// Process control
|
||||
|
||||
virtual void refreshJobsLists();
|
||||
virtual void checkRunningJobs();
|
||||
virtual void purgeRunningJobs();
|
||||
virtual void purgeFinishedJob(const FoamXServer::JobID& jobID);
|
||||
virtual void purgeFinishedJobs(CORBA::Long nDays);
|
||||
virtual void kill(const FoamXServer::JobID& jobID);
|
||||
virtual void suspend(const FoamXServer::JobID& jobID);
|
||||
virtual void cont(const FoamXServer::JobID& jobID);
|
||||
virtual void end
|
||||
(
|
||||
const FoamXServer::JobID& jobID,
|
||||
const char* rootDir,
|
||||
const char* caseName,
|
||||
const CORBA::Boolean now
|
||||
);
|
||||
virtual void setStatus
|
||||
(
|
||||
const FoamXServer::JobID& jobID,
|
||||
FoamXServer::JobStatus jobStatus
|
||||
);
|
||||
|
||||
|
||||
// IO
|
||||
|
||||
virtual void validate();
|
||||
virtual void save();
|
||||
virtual void close();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,4 +0,0 @@
|
||||
ICaseBrowserImpl.C
|
||||
FoamXCaseBrowser.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/FoamXCaseBrowser
|
||||
@ -1,13 +0,0 @@
|
||||
#include "../../FoamXLib/Make/orbOptions"
|
||||
|
||||
EXE_INC = \
|
||||
$(ORB_INC) \
|
||||
-I../FoamXLib/lnInclude \
|
||||
-I../FoamXServer \
|
||||
|
||||
EXE_LIBS = \
|
||||
-lFoamX \
|
||||
-lFoamXServer \
|
||||
$(ORB_LIBS)
|
||||
|
||||
|
||||
@ -1,225 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// Foam header files.
|
||||
#include "dictionary.H"
|
||||
#include "argList.H"
|
||||
#include "OSspecific.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamXErrors.H"
|
||||
#include "ICaseServerImpl.H"
|
||||
#include "LogManager.H"
|
||||
#include "LogEntry.H"
|
||||
#include "Orb.H"
|
||||
|
||||
// Declare all the namespaces used by FoamX
|
||||
#include "FoamXNameSpaces.H"
|
||||
|
||||
using namespace FoamX;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamXCaseServer::main(int argc, char **argv)";
|
||||
|
||||
fileName lockFileName;
|
||||
|
||||
try
|
||||
{
|
||||
FatalError.throwExceptions();
|
||||
FatalIOError.throwExceptions();
|
||||
|
||||
// Construct the ORB, remove ORB arguments
|
||||
Orb orb(argc, argv);
|
||||
|
||||
argList::validOptions.insert("open", "");
|
||||
argList::validOptions.insert("create", "app");
|
||||
argList::validOptions.insert("import", "app");
|
||||
//argList::validOptions.insert("test", "");
|
||||
argList args(argc, argv);
|
||||
|
||||
lockFileName = args.path()/".fxLock";
|
||||
|
||||
// Initialise the log manager object.
|
||||
// Write the log into the case directory.
|
||||
LogManager logMgr(args.path()/"CaseServerLog.xml");
|
||||
|
||||
// Register the root function call.
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
word mode;
|
||||
word app;
|
||||
if (args.options().found("open"))
|
||||
{
|
||||
mode = "open";
|
||||
}
|
||||
else if (args.options().found("create"))
|
||||
{
|
||||
mode = "create";
|
||||
app = args.options()["create"];
|
||||
}
|
||||
else if (args.options().found("import"))
|
||||
{
|
||||
mode = "import";
|
||||
app = args.options()["import"];
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn(functionName)
|
||||
<< "Essential option not given" << endl;
|
||||
args.printUsage();
|
||||
FatalError.abort();
|
||||
}
|
||||
|
||||
// Allocate the ICaseServerImpl object on the heap.
|
||||
// This is a reference counted object and will be deleted by
|
||||
// the POA when it is no longer needed.
|
||||
ICaseServerImpl* caseServerPtr = new ICaseServerImpl
|
||||
(
|
||||
orb,
|
||||
args.rootPath(),
|
||||
args.caseName(),
|
||||
mode,
|
||||
app
|
||||
);
|
||||
|
||||
if (caseServerPtr == NULL)
|
||||
{
|
||||
FatalErrorIn(functionName)
|
||||
<< "Failed to instantiate ICaseServerImpl object."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
log << "Created ICaseServerImpl object." << endl;
|
||||
|
||||
// Get the object IOR and write to lock file.
|
||||
string ior = orb.ior(caseServerPtr->_this());
|
||||
|
||||
log << "IOR : " << ior << "." << endl;
|
||||
|
||||
{
|
||||
OFstream ofLock(lockFileName);
|
||||
|
||||
if (ofLock.good())
|
||||
{
|
||||
ofLock << ior.c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw FoamX::FoamXError
|
||||
(
|
||||
E_FAIL,
|
||||
"Failed to open lock file " + lockFileName,
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (args.options().found("test"))
|
||||
{
|
||||
caseServerPtr->readMesh();
|
||||
caseServerPtr->save();
|
||||
}
|
||||
else
|
||||
{
|
||||
log << "CaseServer running....." << endl;
|
||||
Info << "CaseServer running....." << endl;
|
||||
|
||||
// Go!
|
||||
orb.run();
|
||||
|
||||
// Clean up all the resources.
|
||||
log << "Shutting down Case Server." << endl;
|
||||
}
|
||||
}
|
||||
catch (Foam::IOerror& fIOErr)
|
||||
{
|
||||
Serr<< "Caught Foam IOerror in " << functionName << " : "
|
||||
<< nl << fIOErr << endl;
|
||||
|
||||
writeException(fIOErr, lockFileName);
|
||||
}
|
||||
catch (Foam::error& fErr)
|
||||
{
|
||||
Serr<< "Caught Foam error in " << functionName << " : "
|
||||
<< nl << fErr << endl;
|
||||
|
||||
writeException(fErr, lockFileName);
|
||||
}
|
||||
catch (FoamXServer::FoamXIOError& fIOErr)
|
||||
{
|
||||
Serr<< "Caught FoamXIOError exception in " << functionName << " : "
|
||||
<< nl << fIOErr << endl;
|
||||
|
||||
writeException(fIOErr, lockFileName);
|
||||
}
|
||||
catch (FoamXServer::FoamXError& ex)
|
||||
{
|
||||
Serr<< "Caught FoamXError exception in " << functionName << " : "
|
||||
<< nl << ex << endl;
|
||||
|
||||
writeException(ex, lockFileName);
|
||||
}
|
||||
catch (CORBA::COMM_FAILURE& ex)
|
||||
{
|
||||
Serr<< "Caught CORBA::COMM_FAILURE exception in "
|
||||
<< functionName << endl;
|
||||
|
||||
writeException(ex, lockFileName);
|
||||
}
|
||||
catch (CORBA::SystemException& ex)
|
||||
{
|
||||
Serr<< "Caught CORBA::SystemException exception in "
|
||||
<< functionName << endl;
|
||||
|
||||
writeException(ex, lockFileName);
|
||||
}
|
||||
catch (CORBA::Exception& ex)
|
||||
{
|
||||
Serr<< "Caught CORBA::Exception exception in "
|
||||
<< functionName << endl;
|
||||
|
||||
writeException(ex, lockFileName);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
Serr<< "Caught system exception in "
|
||||
<< functionName << endl;
|
||||
|
||||
writeException(systemError(), lockFileName);
|
||||
}
|
||||
|
||||
Info<< "Finishing " << functionName << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,280 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::ICaseServerImpl
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
ICaseServerImpl.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef ICaseServerImpl_H
|
||||
#define ICaseServerImpl_H
|
||||
|
||||
// Foam header files.
|
||||
#include "word.H"
|
||||
#include "stringList.H"
|
||||
#include "fileName.H"
|
||||
#include "Dictionary.H"
|
||||
#include "Time.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "ProcessControl.H"
|
||||
#include "ObjRefHashTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
// Forward declaration of classes.
|
||||
class IGeometricFieldImpl;
|
||||
class RootDictionary;
|
||||
class PatchProperties;
|
||||
class Orb;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class ICaseServerImpl Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class ICaseServerImpl
|
||||
:
|
||||
public POA_FoamXServer::CaseServer::ICaseServer,
|
||||
public PortableServer::RefCountServantBase
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Case root directory.
|
||||
Foam::fileName rootDir_;
|
||||
|
||||
//- Case name.
|
||||
Foam::fileName caseName_;
|
||||
|
||||
//- Context name for name server registration.
|
||||
Foam::fileName hostContext_;
|
||||
|
||||
//- Context name for name server registration.
|
||||
Foam::fileName userContext_;
|
||||
|
||||
//- Object name for name server registration.
|
||||
Foam::fileName objectName_;
|
||||
|
||||
//- Case dictionary filename.
|
||||
Foam::fileName caseDictName_;
|
||||
|
||||
//- Name of the application class for this case.
|
||||
Foam::word appName_;
|
||||
|
||||
//- Reference to the ORB
|
||||
Orb& orb_;
|
||||
|
||||
//- Current database (only in 'open' mode)
|
||||
Foam::Time* dbPtr_;
|
||||
|
||||
//- Reference to the case browser
|
||||
FoamXServer::CaseBrowser::ICaseBrowser_var caseBrowser_;
|
||||
|
||||
//- Reference to the FoamProperties object.
|
||||
FoamXServer::CaseServer::IFoamProperties_var foamProperties_;
|
||||
|
||||
//- Reference to the Application object for this case.
|
||||
FoamXServer::CaseServer::IApplication_var app_;
|
||||
|
||||
//- Managed flag.
|
||||
bool managed_;
|
||||
|
||||
//- Process controls
|
||||
FoamX::ProcessControl procControl_;
|
||||
|
||||
//- Pid of running case.
|
||||
pid_t pid_;
|
||||
|
||||
//- Managed Dictionary of patch name to PatchProperties objects.
|
||||
Foam::Dictionary<PatchProperties> patchMap_;
|
||||
|
||||
//- Map of field name to FieldValues objects.
|
||||
ObjRefHashTable<IGeometricFieldImpl*> fieldValueMap_;
|
||||
|
||||
//- Map of dictionary name to Dictionary objects.
|
||||
ObjRefHashTable<RootDictionary*> dictionaryMap_;
|
||||
|
||||
|
||||
// Private member functions.
|
||||
|
||||
//- Access database
|
||||
Foam::Time& time();
|
||||
|
||||
//- Save (default) controlDict
|
||||
void saveControlDict();
|
||||
|
||||
void writePatchData();
|
||||
void addPatch(PatchProperties* patchProps);
|
||||
bool fieldsMatchPatchPhysicalType(const Foam::word& patchPhysicalType);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
ICaseServerImpl
|
||||
(
|
||||
Orb& orb,
|
||||
const Foam::fileName& rootDir,
|
||||
const Foam::fileName& caseName,
|
||||
const Foam::word& mode,
|
||||
const Foam::word& app
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~ICaseServerImpl();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Implemented ICaseServerImpl functions.
|
||||
|
||||
virtual CORBA::Boolean managed();
|
||||
virtual void managed(CORBA::Boolean);
|
||||
virtual char* caseRoot();
|
||||
virtual char* caseName();
|
||||
|
||||
|
||||
//- Application class for this case (read only).
|
||||
virtual FoamXServer::CaseServer::IApplication_ptr application();
|
||||
|
||||
//- Foam system properties (read only).
|
||||
virtual FoamXServer::CaseServer::IFoamProperties_ptr foamProperties();
|
||||
|
||||
//- Time-steps.
|
||||
virtual FoamXServer::StringList* availableTimeSteps();
|
||||
virtual char* getTime();
|
||||
virtual void setTime(const char*, const CORBA::Long);
|
||||
|
||||
// Mesh.
|
||||
|
||||
virtual CORBA::Boolean meshDefined();
|
||||
virtual void readMesh();
|
||||
virtual void importMesh
|
||||
(
|
||||
const char* hostname,
|
||||
const char* rootDir,
|
||||
const char* caseName
|
||||
);
|
||||
|
||||
|
||||
//- Field values.
|
||||
virtual void getFieldValues
|
||||
(
|
||||
const char* fieldName,
|
||||
FoamXServer::CaseServer::IGeometricField_out fieldValues
|
||||
);
|
||||
|
||||
|
||||
// Patches.
|
||||
|
||||
virtual FoamXServer::StringList* patchNames();
|
||||
|
||||
virtual void addPatch
|
||||
(
|
||||
const char* patchName,
|
||||
const char* patchPhysicalType
|
||||
);
|
||||
|
||||
virtual void deletePatch(const char* patchName);
|
||||
|
||||
virtual void deleteAllPatches();
|
||||
|
||||
|
||||
// Patch boundary conditions.
|
||||
|
||||
virtual void setPatchPhysicalType
|
||||
(
|
||||
const char* patchName,
|
||||
const char* patchPhysicalType
|
||||
);
|
||||
|
||||
virtual void getPatchPhysicalType
|
||||
(
|
||||
const char* patchName,
|
||||
CORBA::String_out patchPhysicalType
|
||||
);
|
||||
|
||||
|
||||
// Dictionaries.
|
||||
|
||||
virtual void getDictionary
|
||||
(
|
||||
const char* dictionaryName,
|
||||
CORBA::Boolean,
|
||||
FoamXServer::IDictionaryEntry_out dictRoot
|
||||
);
|
||||
|
||||
virtual CORBA::Long fileModificationDate(const char* dictName);
|
||||
|
||||
virtual void readFile
|
||||
(
|
||||
const char* name,
|
||||
CORBA::String_out contents
|
||||
);
|
||||
|
||||
virtual void writeFile
|
||||
(
|
||||
const char* name,
|
||||
const char* contents
|
||||
);
|
||||
|
||||
//- Calculation control.
|
||||
virtual CORBA::Long runCase(const char* arguments);
|
||||
|
||||
virtual void killCase();
|
||||
|
||||
//- Validation.
|
||||
virtual void validate();
|
||||
|
||||
//- Has it been modified?
|
||||
virtual CORBA::Boolean modified();
|
||||
|
||||
//- Persistence.
|
||||
virtual void save();
|
||||
|
||||
//- Lifetime management.
|
||||
virtual void close();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,4 +0,0 @@
|
||||
ICaseServerImpl.C
|
||||
FoamXCaseServer.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/FoamXCaseServer
|
||||
@ -1,12 +0,0 @@
|
||||
#include "../../FoamXLib/Make/orbOptions"
|
||||
|
||||
EXE_INC = \
|
||||
$(ORB_INC) \
|
||||
-I../FoamXLib/lnInclude \
|
||||
-I../FoamXServer
|
||||
|
||||
|
||||
EXE_LIBS = \
|
||||
-lFoamX \
|
||||
-lFoamXServer \
|
||||
$(ORB_LIBS)
|
||||
@ -1,155 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// Foam header files.
|
||||
#include "argList.H"
|
||||
#include "OSspecific.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamXErrors.H"
|
||||
#include "IHostBrowserImpl.H"
|
||||
#include "LogManager.H"
|
||||
#include "LogEntry.H"
|
||||
#include "Paths.H"
|
||||
#include "Orb.H"
|
||||
|
||||
// Declare all the namespaces used by FoamX
|
||||
#include "FoamXNameSpaces.H"
|
||||
|
||||
using namespace FoamX;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamXHostBrowser::main(int argc, char **argv)";
|
||||
|
||||
try
|
||||
{
|
||||
FatalError.throwExceptions();
|
||||
FatalIOError.throwExceptions();
|
||||
|
||||
// Make copy of raw args (since Orb modifies them)
|
||||
stringList args(argc);
|
||||
forAll(args, argI)
|
||||
{
|
||||
args[argI] = argv[argI];
|
||||
}
|
||||
|
||||
fileName logFile(Paths::tmp/"HostBrowserLog.xml");
|
||||
|
||||
// Initialise the log manager object.
|
||||
LogManager logManager(logFile);
|
||||
|
||||
// Register the root function call.
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
// Construct the ORB, remove ORB arguments
|
||||
Orb orb(argc, argv);
|
||||
|
||||
// Construct argList so job gets registered.
|
||||
argList::validArgs.clear();
|
||||
argList dummyArgs(argc, argv);
|
||||
|
||||
// Allocate the IHostBrowserImpl object on the heap.
|
||||
// This is a reference counted object and will be deleted by
|
||||
// the POA when it is no longer needed.
|
||||
IHostBrowserImpl* hostBrowserPtr =
|
||||
new IHostBrowserImpl(orb, args);
|
||||
|
||||
if (hostBrowserPtr == NULL)
|
||||
{
|
||||
FatalErrorIn(functionName)
|
||||
<< "Failed to instantiate IHostBrowserImpl object."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
log << "Created IHostBrowserImpl object" << endl;
|
||||
|
||||
// Emit the IOR.
|
||||
log << "IOR : " << orb.ior(hostBrowserPtr->_this()) << endl;
|
||||
|
||||
Info << "HostBrowser running....." << endl;
|
||||
|
||||
// Make sure the log file exists even if debugging switched off.
|
||||
// (Is used to signal to start the java part)
|
||||
if (!exists(logFile))
|
||||
{
|
||||
OFstream logStream(logFile);
|
||||
}
|
||||
|
||||
// Go! Go! Go!
|
||||
orb.run();
|
||||
}
|
||||
catch (Foam::IOerror& fIOErr)
|
||||
{
|
||||
Serr<< "Caught Foam IOerror in " << functionName << " : "
|
||||
<< nl << fIOErr << endl;
|
||||
}
|
||||
catch (Foam::error& fErr)
|
||||
{
|
||||
Serr<< "Caught Foam error in " << functionName << " : "
|
||||
<< nl << fErr << endl;
|
||||
}
|
||||
catch (FoamXServer::FoamXIOError& fIOErr)
|
||||
{
|
||||
Serr<< "Caught FoamXIOError exception in " << functionName << " : "
|
||||
<< nl << fIOErr << endl;
|
||||
}
|
||||
catch (FoamXServer::FoamXError& ex)
|
||||
{
|
||||
Serr<< "Caught FoamXError exception in " << functionName << " : "
|
||||
<< nl << ex << endl;
|
||||
}
|
||||
catch (CORBA::COMM_FAILURE& ex)
|
||||
{
|
||||
Serr<< "Caught CORBA::COMM_FAILURE exception in "
|
||||
<< functionName << endl;
|
||||
}
|
||||
catch (CORBA::SystemException& ex)
|
||||
{
|
||||
Serr<< "Caught CORBA::SystemException exception in "
|
||||
<< functionName << endl;
|
||||
}
|
||||
catch (CORBA::Exception& ex)
|
||||
{
|
||||
Serr<< "Caught CORBA::Exception exception in "
|
||||
<< functionName << endl;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
Serr<< "Caught system exception in "
|
||||
<< functionName << endl;
|
||||
}
|
||||
|
||||
Info<< "Finishing " << functionName << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,442 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// Foam header files.
|
||||
#include "dictionary.H"
|
||||
#include "wordList.H"
|
||||
#include "stringList.H"
|
||||
#include "fileNameList.H"
|
||||
#include "IFstream.H"
|
||||
#include "OSspecific.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamXErrors.H"
|
||||
#include "IHostBrowserImpl.H"
|
||||
#include "LogEntry.H"
|
||||
#include "NameServer.H"
|
||||
#include "Orb.H"
|
||||
#include "Paths.H"
|
||||
|
||||
// Declare all the namespaces used by FoamX.
|
||||
#include "FoamXNameSpaces.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::IHostBrowserImpl::IHostBrowserImpl
|
||||
(
|
||||
Orb& orb,
|
||||
const stringList& args
|
||||
)
|
||||
:
|
||||
orb_(orb),
|
||||
args_(args),
|
||||
objectName_("FoamXHostBrowser"),
|
||||
procControl_(dotFoam("apps/FoamX/FoamX.cfg"))
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IHostBrowserImpl::IHostBrowserImpl(Orb& orb)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
wordList hosts(1, hostName());
|
||||
|
||||
// Open the user's Foam control dictionary.
|
||||
fileName controlDictFileName = dotFoam("controlDict");
|
||||
if (exists(controlDictFileName))
|
||||
{
|
||||
dictionary controlDict((IFstream(controlDictFileName)()));
|
||||
|
||||
// Read hosts list
|
||||
if (controlDict.found("hosts"))
|
||||
{
|
||||
wordList controlDictHosts(controlDict.lookup("hosts"));
|
||||
if (controlDictHosts.size())
|
||||
{
|
||||
hosts = controlDictHosts;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
forAll(hosts, i)
|
||||
{
|
||||
FoamXServer::HostDescriptor* hostDescPtr =
|
||||
new FoamXServer::HostDescriptor();
|
||||
|
||||
hostDescPtr->name = hosts[i].c_str();
|
||||
hostDescPtr->alive = true;
|
||||
|
||||
hosts_.insert(hosts[i], hostDescPtr);
|
||||
}
|
||||
|
||||
// Register this object with the name server.
|
||||
// Will throw an exception if any error occurs.
|
||||
NameServer fxNameServer(orb_.orbPtr_);
|
||||
FoamXServer::HostBrowser::IHostBrowser_var ref = _this();
|
||||
|
||||
// Rebind if necessary.
|
||||
fxNameServer.bindObject(objectName_, ref, true);
|
||||
|
||||
// Decrement the reference count of the object implementation, so
|
||||
// that it will be properly cleaned up when the POA has determined
|
||||
// that it is no longer needed.
|
||||
_remove_ref();
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::IHostBrowserImpl::~IHostBrowserImpl()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IHostBrowserImpl::~IHostBrowserImpl()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamXServer::HostDescriptorList* FoamX::IHostBrowserImpl::hosts()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamXServer::StringList* FoamX::IHostBrowserImpl::hosts()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
|
||||
HostDescriptorList* hostListPtr = new HostDescriptorList();
|
||||
hostListPtr->length(hosts_.size());
|
||||
|
||||
label i = 0;
|
||||
for
|
||||
(
|
||||
Foam::HashPtrTable<FoamXServer::HostDescriptor, string>::iterator
|
||||
iter = hosts_.begin();
|
||||
iter != hosts_.end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
(*hostListPtr)[i++] = *iter();
|
||||
}
|
||||
|
||||
return hostListPtr;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::IHostBrowserImpl::refreshHostList()
|
||||
{
|
||||
static const char* functionName =
|
||||
"void FoamX::IHostBrowserImpl::refreshHostList()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
for
|
||||
(
|
||||
Foam::HashPtrTable<FoamXServer::HostDescriptor, string>::
|
||||
iterator iter = hosts_.begin();
|
||||
iter != hosts_.end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
try
|
||||
{
|
||||
iter()->alive =
|
||||
ping(word(iter()->name), procControl_.timeOut());
|
||||
}
|
||||
catch (error& fErr)
|
||||
{
|
||||
/* even ping gives problems so rsh/ssh will certainly fail */
|
||||
iter()->alive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
CORBA::Boolean FoamX::IHostBrowserImpl::isHostAlive(const char* hostName)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IHostBrowserImpl::isHostAlive(const char* hostName)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
Foam::HashPtrTable<FoamXServer::HostDescriptor, string>::iterator
|
||||
iter = hosts_.find(hostName);
|
||||
|
||||
if (iter != hosts_.end())
|
||||
{
|
||||
return iter()->alive;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Note: don't throw FoamXSYSError since whole host is unknown.
|
||||
throw FoamXError
|
||||
(
|
||||
E_FAIL,
|
||||
"Cannot find host '" + word(hostName)
|
||||
+ "' in list of licenced hosts",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::IHostBrowserImpl::hostIsAlive(const char* hostName)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IHostBrowserImpl::hostIsAlive(const char* hostName)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
Foam::HashPtrTable<FoamXServer::HostDescriptor, string>::iterator
|
||||
iter = hosts_.find(hostName);
|
||||
|
||||
if (iter != hosts_.end())
|
||||
{
|
||||
iter()->alive = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_FAIL,
|
||||
"Cannot find host '" + word(hostName)
|
||||
+ "' in list of licenced hosts",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::IHostBrowserImpl::hostIsDead(const char* hostName)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IHostBrowserImpl::hostIsDead(const char* hostName)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
Foam::HashPtrTable<FoamXServer::HostDescriptor, string>::iterator
|
||||
iter = hosts_.find(hostName);
|
||||
|
||||
if (iter != hosts_.end())
|
||||
{
|
||||
iter()->alive = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_FAIL,
|
||||
"Cannot find host '" + word(hostName)
|
||||
+ "' in list of licenced hosts",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::IHostBrowserImpl::openCaseBrowser
|
||||
(
|
||||
const char* hostName
|
||||
)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IHostBrowserImpl::openCaseBrowser"
|
||||
"(const char* hostName)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
// Case browser will register itself with the name server under
|
||||
// a "hostName/"FoamXCaseBrowser"" key.
|
||||
fileName caseBrowserObjectName = fileName(hostName)/"FoamXCaseBrowser";
|
||||
|
||||
|
||||
if (orb_.isObjectBound(caseBrowserObjectName))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_FAIL,
|
||||
string("CaseBrowser already running on ") + hostName
|
||||
+ " according to nameserver",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
// Start a case browser process on the specified host. Pass through
|
||||
// arguments with which HostBrowser was called.
|
||||
stringList browserArgs(args_);
|
||||
|
||||
browserArgs[0] = "FoamXCaseBrowser";
|
||||
|
||||
stringList argList
|
||||
(
|
||||
procControl_.remoteShellArgs
|
||||
(
|
||||
userName(),
|
||||
hostName,
|
||||
browserArgs,
|
||||
"", // no log file
|
||||
true // run in background
|
||||
)
|
||||
);
|
||||
|
||||
if (procControl_.system(argList) != 0)
|
||||
{
|
||||
hostIsDead(hostName);
|
||||
|
||||
throw FoamXSYSError
|
||||
(
|
||||
E_FAIL,
|
||||
"Server '" + caseBrowserObjectName + "' timed-out.",
|
||||
hostName,
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
CORBA::Boolean FoamX::IHostBrowserImpl::getCaseBrowserReference
|
||||
(
|
||||
const char *hostName,
|
||||
FoamXServer::CaseBrowser::ICaseBrowser_out browserObj
|
||||
)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IHostBrowserImpl::getCaseBrowserReference"
|
||||
"(const char *hostName, "
|
||||
"FoamXServer::CaseBrowser::ICaseBrowser_out browserObj)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
fileName browserKey(fileName(hostName)/"FoamXCaseBrowser");
|
||||
|
||||
try
|
||||
{
|
||||
// Connect to name server.
|
||||
NameServer fxNameServer(orb_.orbPtr_);
|
||||
|
||||
if (fxNameServer.isObjectBound(browserKey))
|
||||
{
|
||||
// Return server reference.
|
||||
browserObj =
|
||||
fxNameServer.resolve<FoamXServer::CaseBrowser::ICaseBrowser>
|
||||
(browserKey);
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::IHostBrowserImpl::validate()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IHostBrowserImpl::validate()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::IHostBrowserImpl::save()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IHostBrowserImpl::save()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::IHostBrowserImpl::close()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IHostBrowserImpl::close()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
// Unregister object from the naming service.
|
||||
NameServer fxNameServer(orb_.orbPtr_);
|
||||
fxNameServer.unbindObject(objectName_);
|
||||
fxNameServer.disconnect();
|
||||
|
||||
// Shutdown th'Orb.
|
||||
// Remove for Java 1.4 since it messes up CORBA connectionx
|
||||
orb_.orbPtr_->shutdown(false);
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,138 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::ICaseServerImpl
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
IHostBrowserImpl.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef IHostBrowserImpl_H
|
||||
#define IHostBrowserImpl_H
|
||||
|
||||
// Foam header files.
|
||||
#include "HashPtrTable.H"
|
||||
#include "stringList.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXWordList.H"
|
||||
#include "ProcessControl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
// Forward declaration of classes.
|
||||
class Orb;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class IHostBrowserImpl Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class IHostBrowserImpl
|
||||
:
|
||||
public POA_FoamXServer::HostBrowser::IHostBrowser,
|
||||
public PortableServer::RefCountServantBase
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference to the ORB
|
||||
Orb& orb_;
|
||||
|
||||
//- Command line arguments
|
||||
Foam::stringList args_;
|
||||
|
||||
//- Object name for name server registration.
|
||||
Foam::fileName objectName_;
|
||||
|
||||
//- List of licenced host names.
|
||||
Foam::HashPtrTable<FoamXServer::HostDescriptor, Foam::string> hosts_;
|
||||
|
||||
//- Process controls
|
||||
FoamX::ProcessControl procControl_;
|
||||
|
||||
|
||||
// Protected member functions.
|
||||
|
||||
void getServerReference
|
||||
(
|
||||
const char *hostName,
|
||||
const Foam::fileName& objectKey,
|
||||
FoamXServer::CaseBrowser::ICaseBrowser_out caseBrowser
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
IHostBrowserImpl(Orb& orb, const Foam::stringList& args);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~IHostBrowserImpl();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Implemented IHostBrowser methods.
|
||||
|
||||
virtual FoamXServer::HostDescriptorList* hosts();
|
||||
virtual void refreshHostList();
|
||||
virtual CORBA::Boolean isHostAlive(const char* hostname);
|
||||
virtual void hostIsAlive(const char* hostname);
|
||||
virtual void hostIsDead(const char* hostname);
|
||||
virtual void validate();
|
||||
virtual void save();
|
||||
virtual void close();
|
||||
|
||||
virtual void openCaseBrowser
|
||||
(
|
||||
const char* hostname
|
||||
);
|
||||
|
||||
virtual CORBA::Boolean getCaseBrowserReference
|
||||
(
|
||||
const char* hostname,
|
||||
FoamXServer::CaseBrowser::ICaseBrowser_out browserObj
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,4 +0,0 @@
|
||||
FoamXHostBrowser.C
|
||||
IHostBrowserImpl.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/FoamXHostBrowser
|
||||
@ -1,12 +0,0 @@
|
||||
#include "../../FoamXLib/Make/orbOptions"
|
||||
|
||||
EXE_INC = \
|
||||
$(ORB_INC) \
|
||||
-I../FoamXLib/lnInclude \
|
||||
-I../FoamXServer \
|
||||
|
||||
|
||||
EXE_LIBS = \
|
||||
-lFoamX \
|
||||
-lFoamXServer \
|
||||
$(ORB_LIBS)
|
||||
@ -1,555 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// Foam header files.
|
||||
#include "fileName.H"
|
||||
#include "OFstream.H"
|
||||
#include "IOobject.H"
|
||||
#include "OSspecific.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
#include "DictionaryWriter.H"
|
||||
|
||||
// Namespaces
|
||||
#include "FoamXNameSpaces.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::DictionaryWriter::DictionaryWriter(const fileName& fileName)
|
||||
:
|
||||
pFileStream_(NULL),
|
||||
fileName_(fileName),
|
||||
caseRoot_(""),
|
||||
caseName_(""),
|
||||
instance_(fileName_.path()),
|
||||
object_(fileName_.name()),
|
||||
entryNameSize_(20)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::DictionaryWriter::DictionaryWriter(const fileName& fileName)";
|
||||
|
||||
try
|
||||
{
|
||||
// Make directory if required.
|
||||
if (!dir(fileName_.path()) && !mkDir(fileName_.path()))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Failed to create directory '" + fileName_.path() + "'.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
// Backup existing file. TODO : Make this behaviour configurable.
|
||||
if (Foam::file(fileName_))
|
||||
{
|
||||
mv(fileName_, fileName_ + ".bak");
|
||||
}
|
||||
|
||||
// Open the file stream.
|
||||
pFileStream_ = new OFstream(fileName_);
|
||||
|
||||
if (!pFileStream_)
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Failed to open file '" + fileName_ + "'.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::DictionaryWriter::DictionaryWriter
|
||||
(
|
||||
const fileName& caseRoot,
|
||||
const fileName& caseName,
|
||||
const fileName& instance,
|
||||
const fileName& object
|
||||
)
|
||||
:
|
||||
pFileStream_(NULL),
|
||||
caseRoot_(caseRoot),
|
||||
caseName_(caseName),
|
||||
instance_(instance),
|
||||
object_(object),
|
||||
entryNameSize_(20)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::DictionaryWriter::DictionaryWriter"
|
||||
"(const fileName& caseRoot, const fileName& caseName, "
|
||||
"const fileName& instance, const fileName& object)";
|
||||
|
||||
try
|
||||
{
|
||||
// Make directory if required.
|
||||
fileName_ = caseRoot_ / caseName_ / instance_ / object_;
|
||||
if (!dir(fileName_.path()) && !mkDir(fileName_.path()))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Failed to create directory '" + fileName_.path() + "'.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
// Backup existing file. TODO : Make this behaviour configurable.
|
||||
if (Foam::file(fileName_))
|
||||
{
|
||||
mv(fileName_, fileName_ + ".bak");
|
||||
}
|
||||
|
||||
// Open the file stream.
|
||||
pFileStream_ = new OFstream(fileName_);
|
||||
|
||||
if (!pFileStream_)
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Failed to open file '" + fileName_ + "'.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::DictionaryWriter::~DictionaryWriter()
|
||||
{
|
||||
if (pFileStream_ != NULL)
|
||||
{
|
||||
delete pFileStream_;
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::writeHeader
|
||||
(
|
||||
const string& title,
|
||||
const word& className
|
||||
)
|
||||
{
|
||||
IOobject::writeBanner(file());
|
||||
file() << endl;
|
||||
writeComment(title);
|
||||
writeEndl();
|
||||
startSubDict("FoamFile");
|
||||
writeEntry("version", IOstream::currentVersion.str().c_str());
|
||||
writeEntry("format", word("ascii"));
|
||||
writeEndl();
|
||||
writeEntry("root", caseRoot_);
|
||||
writeEntry("case", caseName_);
|
||||
writeEntry("instance", instance_);
|
||||
writeEntry("local", string(""));
|
||||
writeEndl();
|
||||
writeEntry("class", className);
|
||||
writeEntry("object", fileName_.name());
|
||||
endSubDict();
|
||||
writeEndl();
|
||||
writeBar();
|
||||
writeEndl();
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::writeSectionHeader(const string& name)
|
||||
{
|
||||
file() << endl << "// " << name.c_str() << endl << "// ";
|
||||
writeChars('~', name.size());
|
||||
writeEndl();
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::writeKeyword(const word& name)
|
||||
{
|
||||
file().writeKeyword(name);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::writeKeywordOnly(const word& name)
|
||||
{
|
||||
file().indent();
|
||||
file() << name;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::writeEntry
|
||||
(
|
||||
const word& name,
|
||||
const char* value
|
||||
)
|
||||
{
|
||||
writeKeyword(name);
|
||||
file() << value;
|
||||
endEntry();
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::writeEntry
|
||||
(
|
||||
const word& name,
|
||||
const FoamXString& value
|
||||
)
|
||||
{
|
||||
writeKeyword(name);
|
||||
value.write(file());
|
||||
endEntry();
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::writeEntry
|
||||
(
|
||||
const word& name,
|
||||
const string& value
|
||||
)
|
||||
{
|
||||
writeKeyword(name);
|
||||
file() << value;
|
||||
endEntry();
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::writeEntry(const word& name, const word& value)
|
||||
{
|
||||
writeKeyword(name);
|
||||
file() << value;
|
||||
endEntry();
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::writeEntry(const word& name, const label& value)
|
||||
{
|
||||
writeKeyword(name);
|
||||
file() << value;
|
||||
endEntry();
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::writeEntry
|
||||
(
|
||||
const word& name,
|
||||
const scalar& value
|
||||
)
|
||||
{
|
||||
writeKeyword(name);
|
||||
file() << value;
|
||||
endEntry();
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::writeEntry
|
||||
(
|
||||
const word& name,
|
||||
const bool& value
|
||||
)
|
||||
{
|
||||
writeKeyword(name);
|
||||
file() << value;
|
||||
endEntry();
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::writeEntry
|
||||
(
|
||||
const word& name,
|
||||
const FoamX::FoamXAny& value
|
||||
)
|
||||
{
|
||||
writeKeyword(name);
|
||||
writeValue(value);
|
||||
endEntry();
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::writeEntry
|
||||
(
|
||||
const word& name,
|
||||
const FoamXServer::DimensionSet& entry
|
||||
)
|
||||
{
|
||||
writeKeyword(name);
|
||||
file() << token::BEGIN_SQR
|
||||
<< entry.mass
|
||||
<< " " << entry.length
|
||||
<< " " << entry.time
|
||||
<< " " << entry.temperature
|
||||
<< " " << entry.moles
|
||||
<< " " << entry.current
|
||||
<< " " << entry.luminousIntensity
|
||||
<< token::END_SQR;
|
||||
endEntry();
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::startFixedList()
|
||||
{
|
||||
file() << token::BEGIN_LIST;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::endFixedList()
|
||||
{
|
||||
file() << token::END_LIST;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::startList(const label& numElements)
|
||||
{
|
||||
file() << nl;
|
||||
|
||||
if (numElements > 100)
|
||||
{
|
||||
file() << Foam::indent << numElements << nl;
|
||||
}
|
||||
|
||||
file() << Foam::indent << token::BEGIN_LIST << incrIndent;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::endList()
|
||||
{
|
||||
file() << nl << decrIndent << Foam::indent << token::END_LIST;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::writeEntry
|
||||
(
|
||||
const word& name,
|
||||
const FoamXServer::StringList& list
|
||||
)
|
||||
{
|
||||
writeKeyword(name);
|
||||
|
||||
startList(list.length());
|
||||
|
||||
for (unsigned int i = 0; i <list.length(); i++)
|
||||
{
|
||||
file() << Foam::indent << string(list[i]) << nl;
|
||||
}
|
||||
|
||||
endList();
|
||||
endEntry();
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::writeEntry
|
||||
(
|
||||
const word& name,
|
||||
const FoamX::FoamXStringList& list
|
||||
)
|
||||
{
|
||||
writeKeyword(name);
|
||||
|
||||
startList(list.length());
|
||||
|
||||
for (unsigned int i = 0; i <list.length(); i++)
|
||||
{
|
||||
file() << Foam::indent << string(list[i]) << nl;
|
||||
}
|
||||
|
||||
endList();
|
||||
endEntry();
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::writeEntry
|
||||
(
|
||||
const word& name,
|
||||
const FoamX::FoamXWordList& list
|
||||
)
|
||||
{
|
||||
writeKeyword(name);
|
||||
|
||||
startList(list.length());
|
||||
|
||||
for (unsigned int i = 0; i <list.length(); i++)
|
||||
{
|
||||
file() << Foam::indent << word(list[i]) << nl;
|
||||
}
|
||||
|
||||
endList();
|
||||
endEntry();
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::writeEntry
|
||||
(
|
||||
const word& name,
|
||||
const FoamX::FoamXAnyList& list
|
||||
)
|
||||
{
|
||||
writeKeyword(name);
|
||||
|
||||
startList(list.size());
|
||||
|
||||
forAll(list, i)
|
||||
{
|
||||
file().indent();
|
||||
list[i].write(file());
|
||||
file() << nl;
|
||||
}
|
||||
|
||||
endList();
|
||||
endEntry();
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::startSubDict()
|
||||
{
|
||||
file() << endl << Foam::indent << token::BEGIN_BLOCK << endl << incrIndent;
|
||||
}
|
||||
|
||||
void FoamX::DictionaryWriter::startSubDict(const word& name)
|
||||
{
|
||||
file() << Foam::indent << name;
|
||||
startSubDict();
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::endDict()
|
||||
{
|
||||
file() << decrIndent << Foam::indent << token::END_BLOCK;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::endSubDict()
|
||||
{
|
||||
endDict();
|
||||
file() << endl;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::writeString(const string& text)
|
||||
{
|
||||
file() << text.c_str();
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::writeLine(const string& text)
|
||||
{
|
||||
file() << Foam::indent << text.c_str() << endl;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::writeComment(const string& text)
|
||||
{
|
||||
file() << Foam::indent << "// " << text.c_str() << endl;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::writeBar()
|
||||
{
|
||||
writeLine
|
||||
(
|
||||
"// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //"
|
||||
);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::writeEndBar()
|
||||
{
|
||||
writeLine
|
||||
(
|
||||
"\n// ************************************************************************* //"
|
||||
);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::writeEndl()
|
||||
{
|
||||
file() << endl;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::endEntry()
|
||||
{
|
||||
file() << token::END_STATEMENT << endl;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::indent()
|
||||
{
|
||||
file().indent();
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::DictionaryWriter::writeChars(char ch, int count)
|
||||
{
|
||||
for (register int i = 0; i < count; i++)
|
||||
{
|
||||
file() << ch;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,269 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::DictionaryWriter.H
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
DictionaryWriter.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef DictionaryWriter_H
|
||||
#define DictionaryWriter_H
|
||||
|
||||
// Foam header files.
|
||||
#include "word.H"
|
||||
#include "wordList.H"
|
||||
#include "string.H"
|
||||
#include "stringList.H"
|
||||
#include "fileName.H"
|
||||
#include "OFstream.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
#include "FoamXString.H"
|
||||
#include "FoamXStringList.H"
|
||||
#include "FoamXWordList.H"
|
||||
#include "FoamXFileNameList.H"
|
||||
#include "FoamXAnyList.H"
|
||||
|
||||
// Namespaces
|
||||
#include "FoamXNameSpaces.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class DictionaryWriter Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class DictionaryWriter
|
||||
{
|
||||
// Private data
|
||||
|
||||
OFstream* pFileStream_;
|
||||
fileName fileName_;
|
||||
fileName caseRoot_;
|
||||
fileName caseName_;
|
||||
fileName instance_;
|
||||
fileName object_;
|
||||
int entryNameSize_;
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
||||
OFstream& file()
|
||||
{
|
||||
return (*pFileStream_);
|
||||
}
|
||||
|
||||
void writeChars(char ch, int count);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
DictionaryWriter(const fileName& fileName);
|
||||
|
||||
DictionaryWriter
|
||||
(
|
||||
const fileName& caseRoot,
|
||||
const fileName& caseName,
|
||||
const fileName& instance,
|
||||
const fileName& object
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~DictionaryWriter();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
const fileName& pathName() const
|
||||
{
|
||||
return fileName_;
|
||||
}
|
||||
|
||||
|
||||
// Header methods.
|
||||
|
||||
void writeHeader
|
||||
(
|
||||
const Foam::string& title,
|
||||
const word& className
|
||||
);
|
||||
|
||||
void writeSectionHeader(const Foam::string& name);
|
||||
|
||||
|
||||
// Entry name formatting methods.
|
||||
|
||||
void writeKeyword(const word& name);
|
||||
void writeKeywordOnly(const word& name);
|
||||
|
||||
|
||||
// Entry value formatting methods.
|
||||
|
||||
void writeValue(const FoamXString& value)
|
||||
{
|
||||
value.write(file());
|
||||
}
|
||||
|
||||
void writeValue(const Foam::token& value)
|
||||
{
|
||||
file() << value;
|
||||
}
|
||||
|
||||
void writeValue(const Foam::string& value)
|
||||
{
|
||||
file() << value;
|
||||
}
|
||||
|
||||
void writeValue(const word& value)
|
||||
{
|
||||
file() << value;
|
||||
}
|
||||
|
||||
void writeValue(const scalar& value)
|
||||
{
|
||||
file() << value;
|
||||
}
|
||||
|
||||
void writeValue(const label& value)
|
||||
{
|
||||
file() << value;
|
||||
}
|
||||
|
||||
void writeValue(const bool& value)
|
||||
{
|
||||
file() << value;
|
||||
}
|
||||
|
||||
void writeValue(const FoamXAny& value)
|
||||
{
|
||||
value.write(file());
|
||||
}
|
||||
|
||||
void writeValue
|
||||
(
|
||||
const FoamXServer::DimensionSet& value
|
||||
);
|
||||
|
||||
|
||||
// Entry methods.
|
||||
|
||||
void writeEntry(const word& name, const char* value);
|
||||
void writeEntry(const word& name, const FoamXString& value);
|
||||
void writeEntry(const word& name, const Foam::string& value);
|
||||
void writeEntry(const word& name, const word& value);
|
||||
void writeEntry(const word& name, const scalar& value);
|
||||
void writeEntry(const word& name, const label& value);
|
||||
void writeEntry(const word& name, const bool& value);
|
||||
void writeEntry(const word& name, const FoamXAny& value);
|
||||
void writeEntry
|
||||
(
|
||||
const word& name,
|
||||
const FoamXServer::DimensionSet& value
|
||||
);
|
||||
|
||||
|
||||
// FixedList methods
|
||||
|
||||
void startFixedList();
|
||||
void endFixedList();
|
||||
|
||||
|
||||
// List methods.
|
||||
|
||||
void startList(const label& numElements);
|
||||
void endList();
|
||||
|
||||
void writeEntry
|
||||
(
|
||||
const word& name,
|
||||
const FoamXServer::StringList& list
|
||||
);
|
||||
|
||||
void writeEntry
|
||||
(
|
||||
const word& name,
|
||||
const FoamXStringList& list
|
||||
);
|
||||
|
||||
void writeEntry
|
||||
(
|
||||
const word& name,
|
||||
const FoamXWordList& list
|
||||
);
|
||||
|
||||
void writeEntry
|
||||
(
|
||||
const word& name,
|
||||
const FoamXAnyList& list
|
||||
);
|
||||
|
||||
|
||||
// Sub dictionary methods.
|
||||
|
||||
void startSubDict();
|
||||
void startSubDict(const word& name);
|
||||
void endDict();
|
||||
void endSubDict();
|
||||
|
||||
// Miscellaneous methods.
|
||||
void writeString(const Foam::string& text);
|
||||
void writeLine(const Foam::string& text);
|
||||
void writeComment(const Foam::string& text);
|
||||
void writeBar();
|
||||
void writeEndBar();
|
||||
void writeEndl();
|
||||
void endEntry();
|
||||
|
||||
|
||||
// General formatting
|
||||
|
||||
void indent();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,50 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "DimensionSet.H"
|
||||
|
||||
// Namespaces
|
||||
#include "FoamXNameSpaces.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::operator==
|
||||
(
|
||||
FoamXServer::DimensionSet& fxDs,
|
||||
const dimensionSet& ds
|
||||
)
|
||||
{
|
||||
fxDs.mass = ds[dimensionSet::MASS];
|
||||
fxDs.length = ds[dimensionSet::LENGTH];
|
||||
fxDs.time = ds[dimensionSet::TIME];
|
||||
fxDs.temperature = ds[dimensionSet::TEMPERATURE];
|
||||
fxDs.moles = ds[dimensionSet::MOLES];
|
||||
fxDs.current = ds[dimensionSet::CURRENT];
|
||||
fxDs.luminousIntensity = ds[dimensionSet::LUMINOUS_INTENSITY];
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,64 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::DimensionSet
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
DimensionSet.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef DimensionSet_H
|
||||
#define DimensionSet_H
|
||||
|
||||
#include "dimensionSet.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void operator==
|
||||
(
|
||||
FoamXServer::DimensionSet& fxDs,
|
||||
const Foam::dimensionSet& ds
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,816 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// Foam header files
|
||||
#include "dimensionSet.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamXAny.H"
|
||||
#include "FoamXTypes.H"
|
||||
#include "DimensionSet.H"
|
||||
|
||||
// Namespaces
|
||||
#include "FoamXNameSpaces.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
// Copy constructor.
|
||||
|
||||
FoamX::FoamXAny::FoamXAny(const FoamXAny& any)
|
||||
:
|
||||
FoamXServer::FoamXAny()
|
||||
{
|
||||
// Copy value and type via assignment operator.
|
||||
(*this) = any;
|
||||
}
|
||||
|
||||
// Default type is Type_Undefined.
|
||||
FoamX::FoamXAny::FoamXAny(FoamXServer::FoamXType t)
|
||||
{
|
||||
type = t;
|
||||
setDefaultValue();
|
||||
}
|
||||
|
||||
// Read constructor given type
|
||||
FoamX::FoamXAny::FoamXAny(FoamXServer::FoamXType t, Foam::Istream& is)
|
||||
{
|
||||
type = t;
|
||||
read(is);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::FoamXAny::~FoamXAny()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::FoamXAny::setType(FoamXServer::FoamXType t)
|
||||
{
|
||||
type = t;
|
||||
setDefaultValue();
|
||||
}
|
||||
|
||||
|
||||
void FoamX::FoamXAny::setValue(const FoamXServer::FoamXAny& any)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::FoamXAny::SetValue(const FoamXServer::FoamXAny& any)";
|
||||
|
||||
try
|
||||
{
|
||||
if (type != any.type)
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_INVALID_ARG,
|
||||
"Type mismatch, expected " + FoamXTypes::typeName(type)
|
||||
+ ", got " + FoamXTypes::typeName(any.type),
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
FoamXServer::FoamXAny::operator=(any);
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
|
||||
void FoamX::FoamXAny::setMin()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::FoamXAny::setMin()";
|
||||
|
||||
try
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case Type_Label:
|
||||
{
|
||||
value <<= CORBA::Long(Foam::labelMin);
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_Scalar:
|
||||
{
|
||||
value <<= CORBA::Double(-VGREAT);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Invalid type for setMin: "
|
||||
"expected a scalar or label, found "
|
||||
+ FoamXTypes::typeName(type),
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
|
||||
void FoamX::FoamXAny::setMax()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::FoamXAny::setMin()";
|
||||
|
||||
try
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case Type_Label:
|
||||
{
|
||||
value <<= CORBA::Long(Foam::labelMax);
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_Scalar:
|
||||
{
|
||||
value <<= CORBA::Double(VGREAT);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Invalid type for setMax: "
|
||||
"expected a scalar or label, found "
|
||||
+ FoamXTypes::typeName(type),
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
|
||||
void FoamX::FoamXAny::read(Istream& is)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::FoamXAny::read(Istream& is)";
|
||||
|
||||
try
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case Type_Boolean:
|
||||
{
|
||||
token t(is);
|
||||
// Boolean -> tk_boolean any type.
|
||||
value <<= CORBA::Any::from_boolean(bool(t.labelToken()));
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_Char:
|
||||
case Type_Word:
|
||||
{
|
||||
token t(is);
|
||||
// Char, Word -> tk_string any type.
|
||||
value <<= t.wordToken().c_str();
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_String:
|
||||
case Type_RootDir:
|
||||
case Type_RootAndCase:
|
||||
case Type_CaseName:
|
||||
case Type_HostName:
|
||||
case Type_File:
|
||||
case Type_Directory:
|
||||
case Type_Time:
|
||||
{
|
||||
token t(is);
|
||||
// String -> tk_string any type.
|
||||
value <<= t.stringToken().c_str();
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_Label:
|
||||
{
|
||||
token t(is);
|
||||
// Label -> tk_long any type.
|
||||
value <<= CORBA::Long(t.labelToken());
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_Scalar:
|
||||
{
|
||||
token t(is);
|
||||
// Scalar -> tk_double any type.
|
||||
value <<= t.number();
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_DimensionSet:
|
||||
{
|
||||
// Construct a dimensionSet object and copy into
|
||||
// DimensionSet structure.
|
||||
DimensionSet fdm;
|
||||
fdm == dimensionSet(is);
|
||||
value <<= fdm;
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_FixedList:
|
||||
case Type_List:
|
||||
case Type_Dictionary:
|
||||
case Type_Compound:
|
||||
case Type_Selection:
|
||||
case Type_Undefined:
|
||||
case Type_Field:
|
||||
default:
|
||||
throw FoamXError
|
||||
(
|
||||
E_INVALID_ARG,
|
||||
"Invalid type " + FoamXTypes::typeName(type),
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
// Check stream status.
|
||||
is.check("FoamX::FoamXAny::read(Istream&)");
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
|
||||
void FoamX::FoamXAny::write(Foam::Ostream& os) const
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::FoamXAny::write(Foam::Ostream& os) const";
|
||||
|
||||
try
|
||||
{
|
||||
if (!IsSet())
|
||||
{
|
||||
os << "<UnsetValue>";
|
||||
return;
|
||||
}
|
||||
|
||||
// Write current value.
|
||||
switch(type)
|
||||
{
|
||||
case Type_Boolean:
|
||||
{
|
||||
// Extract into a boolean.
|
||||
CORBA::Boolean b = 0;
|
||||
CORBA::Any::to_boolean tb(b);
|
||||
if (!(value >>= tb))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Invalid type for Boolean output.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
os << Foam::label(b);
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_Char:
|
||||
case Type_Word:
|
||||
{
|
||||
// Extract into a string.
|
||||
const char* str = NULL;
|
||||
if (!(value >>= str))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Invalid type for Char/Word output.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
os << Foam::word(str);
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_String:
|
||||
case Type_RootDir:
|
||||
case Type_RootAndCase:
|
||||
case Type_CaseName:
|
||||
case Type_HostName:
|
||||
case Type_File:
|
||||
case Type_Time:
|
||||
{
|
||||
// Extract into a string.
|
||||
const char* str = NULL;
|
||||
if (!(value >>= str))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Invalid type for String output.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
os << Foam::string(str);
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_Label:
|
||||
{
|
||||
// Extract into a long int.
|
||||
CORBA::Long lb = 0;
|
||||
if (!(value >>= lb))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Invalid type for Label output.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
os << Foam::label(lb);
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_Scalar:
|
||||
{
|
||||
// Extract into a scalar.
|
||||
CORBA::Double sc = 0.0;
|
||||
if (!(value >>= sc))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Invalid type for Scalar output.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
os << Foam::scalar(sc);
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_DimensionSet:
|
||||
{
|
||||
// Extract into dimension set.
|
||||
const DimensionSet* fdm = NULL;
|
||||
if (!(value >>= fdm))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Invalid type for DimensionSet output.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
os << token::BEGIN_SQR
|
||||
<< fdm->mass
|
||||
<< " " << fdm->length
|
||||
<< " " << fdm->time
|
||||
<< " " << fdm->temperature
|
||||
<< " " << fdm->moles
|
||||
<< " " << fdm->current
|
||||
<< " " << fdm->luminousIntensity
|
||||
<< token::END_SQR;
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_FixedList:
|
||||
case Type_List:
|
||||
case Type_Dictionary:
|
||||
case Type_Compound:
|
||||
case Type_Selection:
|
||||
case Type_Undefined:
|
||||
default:
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Invalid type.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
// Check stream status.
|
||||
os.check("FoamX::FoamXAny::write(Ostream&)");
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
|
||||
void FoamX::FoamXAny::setDefaultValue()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::FoamXAny::setDefaultValue()";
|
||||
|
||||
try
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case Type_Boolean:
|
||||
{
|
||||
value <<= CORBA::Any::from_boolean(false);
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_Char:
|
||||
{
|
||||
value <<= static_cast<const char*>("?");
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_Word:
|
||||
{
|
||||
value <<= static_cast<const char*>("<>");
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_String:
|
||||
case Type_RootDir:
|
||||
case Type_RootAndCase:
|
||||
case Type_CaseName:
|
||||
case Type_HostName:
|
||||
case Type_File:
|
||||
case Type_Time:
|
||||
{
|
||||
value <<= static_cast<const char*>("");
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_Label:
|
||||
{
|
||||
value <<= CORBA::Long(0);
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_Scalar:
|
||||
{
|
||||
value <<= CORBA::Double(0.0);
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_DimensionSet:
|
||||
{
|
||||
DimensionSet fdm;
|
||||
fdm.mass = 0;
|
||||
fdm.length = 0;
|
||||
fdm.time = 0;
|
||||
fdm.temperature = 0;
|
||||
fdm.moles = 0;
|
||||
fdm.current = 0;
|
||||
fdm.luminousIntensity = 0;
|
||||
|
||||
value <<= fdm;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// No default value required for any other types.
|
||||
break;
|
||||
}
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::FoamXAny::operator=(const FoamXServer::FoamXAny& any)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::FoamXAny::operator=(const FoamXServer::FoamXAny& any)";
|
||||
|
||||
try
|
||||
{
|
||||
if (type != any.type)
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_INVALID_ARG,
|
||||
"Type mismatch, expected " + FoamXTypes::typeName(type)
|
||||
+ ", got " + FoamXTypes::typeName(any.type),
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
FoamXServer::FoamXAny::operator=(any);
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
|
||||
void FoamX::FoamXAny::operator=(const FoamXAny& any)
|
||||
{
|
||||
// Check for assignment to self.
|
||||
if (this != & any)
|
||||
{
|
||||
// Copy type.
|
||||
type = any.type;
|
||||
|
||||
// Copy value
|
||||
value = any.value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool FoamX::FoamXAny::operator==(const FoamXServer::FoamXAny& any) const
|
||||
{
|
||||
return (type == any.type && value == any.value);
|
||||
}
|
||||
|
||||
|
||||
bool FoamX::FoamXAny::operator!=(const FoamXServer::FoamXAny& any) const
|
||||
{
|
||||
return !operator==(any);
|
||||
}
|
||||
|
||||
|
||||
void FoamX::operator>
|
||||
(
|
||||
const FoamXServer::FoamXAny& any1,
|
||||
const FoamXServer::FoamXAny& any2
|
||||
)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::operator>"
|
||||
"(const FoamXServer::FoamXAny& any1 const FoamXServer::FoamXAny& any2)";
|
||||
|
||||
try
|
||||
{
|
||||
if (any1.type != any2.type)
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Incompatible types for operation >. "
|
||||
"Expected scalars or labels, found a "
|
||||
+ FoamXTypes::typeName(any1.type) + " and a "
|
||||
+ FoamXTypes::typeName(any2.type),
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
switch(any1.type)
|
||||
{
|
||||
case Type_Label:
|
||||
{
|
||||
// Extract this into a long int.
|
||||
CORBA::Long lb1 = 0;
|
||||
if (!(any1.value >>= lb1))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Invalid type for Label output.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
// Extract the any into a long int.
|
||||
CORBA::Long lb2 = 0;
|
||||
if (!(any2.value >>= lb2))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Invalid type for Label output.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
if (lb1 > lb2)
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Label value " + name(label(lb1))
|
||||
+ " is greater than the maximum " + name(label(lb2)),
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_Scalar:
|
||||
{
|
||||
// Extract this into a scalar.
|
||||
CORBA::Double sc1 = 0.0;
|
||||
if (!(any1.value >>= sc1))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Invalid type for Scalar output.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
// Extract the any into a scalar.
|
||||
CORBA::Double sc2 = 0.0;
|
||||
if (!(any2.value >>= sc2))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Invalid type for Scalar output.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
if (sc1 > sc2)
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Label value " + name(scalar(sc1))
|
||||
+ " is greater than the maximum " + name(scalar(sc2)),
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Invalid type for operation >. "
|
||||
"Expected scalars or labels, found "
|
||||
+ FoamXTypes::typeName(any1.type),
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
|
||||
void FoamX::operator<
|
||||
(
|
||||
const FoamXServer::FoamXAny& any1,
|
||||
const FoamXServer::FoamXAny& any2
|
||||
)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::operator<"
|
||||
"(const FoamXServer::FoamXAny& any1 const FoamXServer::FoamXAny& any2)";
|
||||
|
||||
try
|
||||
{
|
||||
if (any1.type != any2.type)
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Incompatible types for operation <. "
|
||||
"Expected scalars or labels, found a "
|
||||
+ FoamXTypes::typeName(any1.type) + " and a "
|
||||
+ FoamXTypes::typeName(any2.type),
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
switch(any1.type)
|
||||
{
|
||||
case Type_Label:
|
||||
{
|
||||
// Extract this into a long int.
|
||||
CORBA::Long lb1 = 0;
|
||||
if (!(any1.value >>= lb1))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Invalid type for Label output.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
// Extract the any into a long int.
|
||||
CORBA::Long lb2 = 0;
|
||||
if (!(any2.value >>= lb2))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Invalid type for Label output.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
if (lb1 < lb2)
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Label value " + name(label(lb1))
|
||||
+ " is greater than the maximum " + name(label(lb2)),
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_Scalar:
|
||||
{
|
||||
// Extract this into a scalar.
|
||||
CORBA::Double sc1 = 0.0;
|
||||
if (!(any1.value >>= sc1))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Invalid type for Scalar output.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
// Extract the any into a scalar.
|
||||
CORBA::Double sc2 = 0.0;
|
||||
if (!(any2.value >>= sc2))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Invalid type for Scalar output.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
if (sc1 < sc2)
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Label value " + name(scalar(sc1))
|
||||
+ " is greater than the maximum " + name(scalar(sc2)),
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Invalid type for operation <. "
|
||||
"Expected scalars or labels, found "
|
||||
+ FoamXTypes::typeName(any1.type),
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,158 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
FoamXAny
|
||||
|
||||
Description
|
||||
Class to manage the mapping between Foam types, FoamX types and the
|
||||
CORBA Any type.
|
||||
|
||||
SourceFiles
|
||||
FoamXAny.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef FoamX_H
|
||||
#define FoamX_H
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
class FoamXAny;
|
||||
|
||||
void operator>
|
||||
(
|
||||
const FoamXServer::FoamXAny& any1,
|
||||
const FoamXServer::FoamXAny& any2
|
||||
);
|
||||
|
||||
void operator<
|
||||
(
|
||||
const FoamXServer::FoamXAny& any1,
|
||||
const FoamXServer::FoamXAny& any2
|
||||
);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class Any Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class FoamXAny
|
||||
:
|
||||
public FoamXServer::FoamXAny
|
||||
{
|
||||
// Private member functions
|
||||
|
||||
void setDefaultValue();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Default constructor
|
||||
FoamXAny(FoamXServer::FoamXType type = FoamXServer::Type_Undefined);
|
||||
|
||||
//- Read constructor given type
|
||||
FoamXAny(FoamXServer::FoamXType type, Foam::Istream& is);
|
||||
|
||||
//- Copy constructor
|
||||
FoamXAny(const FoamXAny& any);
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
virtual ~FoamXAny();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
void setType(FoamXServer::FoamXType type);
|
||||
|
||||
//- Sets the value of this object. Throws an exception if the types
|
||||
// are incompatible.
|
||||
void setValue(const FoamXServer::FoamXAny& any);
|
||||
|
||||
//- Returns true if the value of this object has been set.
|
||||
bool IsSet() const
|
||||
{
|
||||
return (value.type()->kind() != CORBA::tk_null);
|
||||
}
|
||||
|
||||
void setMin();
|
||||
void setMax();
|
||||
|
||||
|
||||
// Read
|
||||
|
||||
void read(Foam::Istream& is);
|
||||
|
||||
|
||||
// Write
|
||||
|
||||
void write(Foam::Ostream& os) const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
void operator=(const FoamXServer::FoamXAny& any);
|
||||
void operator=(const FoamXAny& any);
|
||||
|
||||
bool operator==(const FoamXServer::FoamXAny& any) const;
|
||||
bool operator!=(const FoamXServer::FoamXAny& any) const;
|
||||
|
||||
friend void operator>
|
||||
(
|
||||
const FoamXServer::FoamXAny& any1,
|
||||
const FoamXServer::FoamXAny& any2
|
||||
);
|
||||
|
||||
friend void operator<
|
||||
(
|
||||
const FoamXServer::FoamXAny& any1,
|
||||
const FoamXServer::FoamXAny& any2
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,54 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Type
|
||||
FoamXAnyList
|
||||
|
||||
Description
|
||||
List of FoamXAny.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
// -------------------------------------------------------------------------- //
|
||||
|
||||
#ifndef FoamXAnyList_H
|
||||
#define FoamXAnyList_H
|
||||
|
||||
// Foam header files.
|
||||
#include "List.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamXAny.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
typedef Foam::List<FoamXAny> FoamXAnyList;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,380 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "long.H"
|
||||
#include "string.H"
|
||||
#include "fileName.H"
|
||||
#include "dictionary.H"
|
||||
#include "LogEntry.H"
|
||||
|
||||
// Project header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
|
||||
// Namespaces
|
||||
#include "FoamXNameSpaces.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(FoamX::FoamXError, 0);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::FoamXError::FoamXError
|
||||
(
|
||||
FoamXServer::ErrorCode errCode,
|
||||
const string& message,
|
||||
const char* function,
|
||||
const char* fName,
|
||||
label lineNo
|
||||
)
|
||||
:
|
||||
FoamXServer::FoamXError
|
||||
(
|
||||
errCode,
|
||||
message.c_str(),
|
||||
function,
|
||||
fName,
|
||||
lineNo
|
||||
)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::FoamXError::FoamXError"
|
||||
"(FoamXServer::ErrorCode errCode, const string& message,"
|
||||
"const char* functionName, const char* fName, label lineNo)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
log << *this << endl;
|
||||
}
|
||||
|
||||
FoamX::FoamXError::FoamXError(const FoamXServer::FoamXError& fErr)
|
||||
:
|
||||
FoamXServer::FoamXError(fErr)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::FoamXError::FoamXError(const FoamXServer::FoamXError& fErr)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
log << *this << endl;
|
||||
}
|
||||
|
||||
FoamX::FoamXError::FoamXError(const error& fErr)
|
||||
:
|
||||
FoamXServer::FoamXError
|
||||
(
|
||||
FoamXServer::E_FOAM,
|
||||
fErr.message().c_str(),
|
||||
fErr.functionName().c_str(),
|
||||
fErr.sourceFileName().c_str(),
|
||||
fErr.sourceFileLineNumber()
|
||||
)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::FoamXError::FoamXError(const error& fErr)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
log << *this << endl;
|
||||
}
|
||||
|
||||
|
||||
Foam::Ostream& FoamX::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const FoamXServer::FoamXError& fxErr
|
||||
)
|
||||
{
|
||||
os << "FoamXError " << string(fxErr.errorMessage) << nl
|
||||
<< "In function " << string(fxErr.methodName) << nl
|
||||
<< "in file " << fileName(fxErr.fileName)
|
||||
<< " at line " << fxErr.lineNo;
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
FoamX::FoamXSYSError::FoamXSYSError
|
||||
(
|
||||
FoamXServer::ErrorCode errCode,
|
||||
const string& message,
|
||||
const string& hostName,
|
||||
const char* function,
|
||||
const char* fName,
|
||||
label lineNo
|
||||
)
|
||||
:
|
||||
FoamXServer::FoamXSYSError
|
||||
(
|
||||
errCode,
|
||||
message.c_str(),
|
||||
hostName.c_str(),
|
||||
function,
|
||||
fName,
|
||||
lineNo
|
||||
)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::FoamXError::FoamXSYSError"
|
||||
"(FoamXServer::ErrorCode errCode, const string& messsage, "
|
||||
"const string& hostName, "
|
||||
"const char* functionName, const char* fName, label lineNo)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
log << *this << endl;
|
||||
}
|
||||
|
||||
FoamX::FoamXSYSError::FoamXSYSError(const FoamXServer::FoamXSYSError& sysErr)
|
||||
:
|
||||
FoamXServer::FoamXSYSError(sysErr)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::FoamXError::FoamXError"
|
||||
"(const FoamXServer::FoamXSYSError& sysErr)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
log << *this << endl;
|
||||
}
|
||||
|
||||
Foam::Ostream& FoamX::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const FoamXServer::FoamXSYSError& sysErr
|
||||
)
|
||||
{
|
||||
os << "FoamXSYSError " << string(sysErr.errorMessage) << nl
|
||||
<< "Problem with machine " << string(sysErr.hostName) << nl
|
||||
<< "In function " << string(sysErr.methodName) << nl
|
||||
<< "in file " << fileName(sysErr.fileName)
|
||||
<< " at line " << sysErr.lineNo;
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
FoamX::FoamXIOError::FoamXIOError
|
||||
(
|
||||
const string& message,
|
||||
const string& ioFileName,
|
||||
label ioStartLineNumber,
|
||||
label ioEndLineNumber,
|
||||
const char* function,
|
||||
const char* fName,
|
||||
label lineNo
|
||||
)
|
||||
:
|
||||
FoamXServer::FoamXIOError
|
||||
(
|
||||
message.c_str(),
|
||||
ioFileName.c_str(),
|
||||
ioStartLineNumber,
|
||||
ioEndLineNumber,
|
||||
function,
|
||||
fName,
|
||||
lineNo
|
||||
)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::FoamXError::FoamXError"
|
||||
"(const string& message, const string& ioFileName, "
|
||||
"label ioStartLineNumber, label ioEndLineNumber, "
|
||||
"const char* functionName, const char* fName, label lineNo)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
log << *this << endl;
|
||||
}
|
||||
|
||||
FoamX::FoamXIOError::FoamXIOError(const FoamXServer::FoamXIOError& fErr)
|
||||
:
|
||||
FoamXServer::FoamXIOError(fErr)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::FoamXIOError::FoamXIOError"
|
||||
"(const FoamXServer::FoamXIOError& fErr)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
log << *this << endl;
|
||||
}
|
||||
|
||||
FoamX::FoamXIOError::FoamXIOError(const IOerror& fIOErr)
|
||||
:
|
||||
FoamXServer::FoamXIOError
|
||||
(
|
||||
fIOErr.message().c_str(),
|
||||
fIOErr.ioFileName().c_str(),
|
||||
fIOErr.ioStartLineNumber(),
|
||||
fIOErr.ioEndLineNumber(),
|
||||
fIOErr.functionName().c_str(),
|
||||
fIOErr.sourceFileName().c_str(),
|
||||
fIOErr.sourceFileLineNumber()
|
||||
)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::foamXError(const IOerror& fIOErr)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
log << *this << endl;
|
||||
}
|
||||
|
||||
|
||||
Foam::Ostream& FoamX::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const FoamXServer::FoamXIOError& fIOErr
|
||||
)
|
||||
{
|
||||
os << "FoamXIOError " << string(fIOErr.errorMessage) << nl
|
||||
<< "File " << fileName(fIOErr.ioFileName)
|
||||
<< " starting at line " << fIOErr.ioStartLineNo
|
||||
<< " ending at line " << fIOErr.ioEndLineNo << nl
|
||||
<< "In function " << string(fIOErr.methodName) << nl
|
||||
<< "in file " << fileName(fIOErr.fileName)
|
||||
<< " at line " << fIOErr.lineNo;
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Foam::dictionary FoamX::dict(const error& fErr)
|
||||
{
|
||||
return fErr;
|
||||
}
|
||||
|
||||
Foam::dictionary FoamX::dict(const IOerror& fIOErr)
|
||||
{
|
||||
return fIOErr;
|
||||
}
|
||||
|
||||
Foam::dictionary FoamX::dict(const FoamXServer::FoamXError& fxErr)
|
||||
{
|
||||
dictionary fxErrDict;
|
||||
fxErrDict.add("type", word("FoamXServer::FoamXError"));
|
||||
fxErrDict.add("errorCode", label(fxErr.errorCode));
|
||||
fxErrDict.add("message", string(fxErr.errorMessage));
|
||||
fxErrDict.add("function", string(fxErr.methodName));
|
||||
fxErrDict.add("sourceFile", fileName(fxErr.fileName));
|
||||
fxErrDict.add("sourceFileLineNumber", fxErr.lineNo);
|
||||
|
||||
return fxErrDict;
|
||||
}
|
||||
|
||||
Foam::dictionary FoamX::dict(const FoamXServer::FoamXIOError& fIOErr)
|
||||
{
|
||||
dictionary fIOErrDict;
|
||||
fIOErrDict.add("type", word("FoamXServer::FoamXIOError"));
|
||||
fIOErrDict.add("message", string(fIOErr.errorMessage));
|
||||
fIOErrDict.add("ioFileName", fileName(fIOErr.ioFileName));
|
||||
fIOErrDict.add("ioStartLineNumber", fIOErr.ioStartLineNo);
|
||||
fIOErrDict.add("ioEndLineNumber", fIOErr.ioEndLineNo);
|
||||
fIOErrDict.add("function", string(fIOErr.methodName));
|
||||
fIOErrDict.add("sourceFile", fileName(fIOErr.fileName));
|
||||
fIOErrDict.add("sourceFileLineNumber", fIOErr.lineNo);
|
||||
|
||||
return fIOErrDict;
|
||||
}
|
||||
|
||||
Foam::dictionary FoamX::dict(const CORBA::COMM_FAILURE& ex)
|
||||
{
|
||||
dictionary exDict;
|
||||
exDict.add("type", word("CORBA::COMM_FAILURE"));
|
||||
return exDict;
|
||||
}
|
||||
|
||||
Foam::dictionary FoamX::dict(const CORBA::SystemException& ex)
|
||||
{
|
||||
dictionary exDict;
|
||||
exDict.add("type", word("CORBA::SystemException"));
|
||||
return exDict;
|
||||
}
|
||||
|
||||
Foam::dictionary FoamX::dict(const CORBA::Exception& ex)
|
||||
{
|
||||
dictionary exDict;
|
||||
exDict.add("type", word("CORBA::Exception"));
|
||||
return exDict;
|
||||
}
|
||||
|
||||
Foam::dictionary FoamX::dict(const FoamX::systemError& ex)
|
||||
{
|
||||
dictionary exDict;
|
||||
exDict.add("type", word("::systemError"));
|
||||
return exDict;
|
||||
}
|
||||
|
||||
|
||||
void FoamX::reThrow(const dictionary& errorDict)
|
||||
{
|
||||
word errorType(errorDict.lookup("type"));
|
||||
|
||||
if (errorType == "error")
|
||||
{
|
||||
throw FoamXError(error(errorDict));
|
||||
}
|
||||
else if (errorType == "IOerror")
|
||||
{
|
||||
throw FoamXIOError(IOerror(errorDict));
|
||||
}
|
||||
else if (errorType == "FoamXServer::FoamXError")
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
FoamXServer::ErrorCode
|
||||
(
|
||||
readLabel(errorDict.lookup("errorCode"))
|
||||
),
|
||||
string(errorDict.lookup("message")),
|
||||
string(errorDict.lookup("function")).c_str(),
|
||||
string(errorDict.lookup("sourceFile")).c_str(),
|
||||
readLabel(errorDict.lookup("sourceFileLineNumber"))
|
||||
);
|
||||
}
|
||||
else if (errorType == "FoamXServer::FoamXIOError")
|
||||
{
|
||||
throw FoamXIOError
|
||||
(
|
||||
string(errorDict.lookup("message")),
|
||||
string(errorDict.lookup("ioFileName")),
|
||||
readLabel(errorDict.lookup("ioStartLineNumber")),
|
||||
readLabel(errorDict.lookup("ioEndLineNumber")),
|
||||
string(errorDict.lookup("function")).c_str(),
|
||||
string(errorDict.lookup("sourceFile")).c_str(),
|
||||
readLabel(errorDict.lookup("sourceFileLineNumber"))
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
FoamXServer::E_UNEXPECTED,
|
||||
"Unexpected error: " + errorType,
|
||||
"FoamX::reThrow(const dictionary& errorDict)",
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,249 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
FoamXError
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
FoamXErrors.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef FoamXError_H
|
||||
#define FoamXError_H
|
||||
|
||||
// Foam header files.
|
||||
#include "error.H"
|
||||
#include "dictionaryEntry.H"
|
||||
#include "OSstream.H"
|
||||
#include "OFstream.H"
|
||||
#include "className.H"
|
||||
|
||||
// Project header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
class systemError
|
||||
{};
|
||||
|
||||
|
||||
class FoamXError
|
||||
:
|
||||
public FoamXServer::FoamXError
|
||||
{
|
||||
public:
|
||||
|
||||
// Declare name of the class and it's debug switch
|
||||
ClassName("FoamXError");
|
||||
|
||||
FoamXError
|
||||
(
|
||||
FoamXServer::ErrorCode,
|
||||
const Foam::string& message,
|
||||
const char* functionName,
|
||||
const char* sourceName,
|
||||
Foam::label sourceLineNo
|
||||
);
|
||||
|
||||
FoamXError(const FoamXServer::FoamXError&);
|
||||
|
||||
FoamXError(const Foam::error&);
|
||||
};
|
||||
|
||||
Foam::Ostream& operator<<
|
||||
(
|
||||
Foam::Ostream& os,
|
||||
const FoamXServer::FoamXError& fxErr
|
||||
);
|
||||
|
||||
|
||||
class FoamXSYSError
|
||||
:
|
||||
public FoamXServer::FoamXSYSError
|
||||
{
|
||||
public:
|
||||
|
||||
FoamXSYSError
|
||||
(
|
||||
FoamXServer::ErrorCode,
|
||||
const Foam::string& message,
|
||||
const Foam::string& hostName,
|
||||
const char* functionName,
|
||||
const char* sourceName,
|
||||
Foam::label sourceLineNo
|
||||
);
|
||||
|
||||
FoamXSYSError(const FoamXServer::FoamXSYSError&);
|
||||
|
||||
FoamXSYSError(const Foam::error&);
|
||||
};
|
||||
|
||||
Foam::Ostream& operator<<
|
||||
(
|
||||
Foam::Ostream& os,
|
||||
const FoamXServer::FoamXSYSError& fIOErr
|
||||
);
|
||||
|
||||
|
||||
class FoamXIOError
|
||||
:
|
||||
public FoamXServer::FoamXIOError
|
||||
{
|
||||
public:
|
||||
|
||||
FoamXIOError
|
||||
(
|
||||
const Foam::string& message,
|
||||
const Foam::string& ioFileName,
|
||||
Foam::label ioStartLineNumber,
|
||||
Foam::label ioEndLineNumber,
|
||||
const char* functionName,
|
||||
const char* sourceName,
|
||||
Foam::label sourceLineNo
|
||||
);
|
||||
|
||||
FoamXIOError(const FoamXServer::FoamXIOError&);
|
||||
|
||||
FoamXIOError(const Foam::IOerror&);
|
||||
};
|
||||
|
||||
Foam::Ostream& operator<<
|
||||
(
|
||||
Foam::Ostream& os,
|
||||
const FoamXServer::FoamXIOError& fIOErr
|
||||
);
|
||||
|
||||
|
||||
Foam::dictionary dict(const Foam::error& fErr);
|
||||
Foam::dictionary dict(const Foam::IOerror& fIOErr);
|
||||
Foam::dictionary dict(const FoamXServer::FoamXError& fxErr);
|
||||
Foam::dictionary dict(const FoamXServer::FoamXIOError& fxIOErr);
|
||||
Foam::dictionary dict(const CORBA::COMM_FAILURE& ex);
|
||||
Foam::dictionary dict(const CORBA::SystemException& ex);
|
||||
Foam::dictionary dict(const CORBA::Exception& ex);
|
||||
Foam::dictionary dict(const FoamX::systemError& ex);
|
||||
|
||||
|
||||
void reThrow(const Foam::dictionary& errorDict);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template <class Exception>
|
||||
inline void writeException(const Exception& ex, const Foam::fileName& fName)
|
||||
{
|
||||
if (fName.size())
|
||||
{
|
||||
Foam::OFstream ofStream(fName);
|
||||
|
||||
if (ofStream.good())
|
||||
{
|
||||
ofStream
|
||||
<< Foam::dictionaryEntry
|
||||
(
|
||||
"FatalError",
|
||||
Foam::dictionary::null,
|
||||
dict(ex)
|
||||
)
|
||||
<< Foam::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End of namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#define CATCH_ALL(functionName) \
|
||||
\
|
||||
catch (Foam::IOerror& fIOErr) \
|
||||
{ \
|
||||
/* Convert the Foam::IOerror into a FoamX::IOerror error \
|
||||
and re-throw */ \
|
||||
throw FoamX::FoamXIOError(fIOErr); \
|
||||
} \
|
||||
catch (Foam::error& fErr) \
|
||||
{ \
|
||||
/* Convert the Foam error into a FoamX error and re-throw */ \
|
||||
throw FoamX::FoamXError(fErr); \
|
||||
} \
|
||||
catch (FoamX::FoamXError& fxErr) \
|
||||
{ \
|
||||
/* Bounce exception up to client */ \
|
||||
throw fxErr; \
|
||||
} \
|
||||
catch (FoamXServer::FoamXError& fxErr) \
|
||||
{ \
|
||||
/* Convert into FoamX error and bounce up to client */ \
|
||||
throw FoamX::FoamXError(fxErr); \
|
||||
} \
|
||||
catch (FoamX::FoamXSYSError& sysErr) \
|
||||
{ \
|
||||
/* Bounce exception up to client */ \
|
||||
throw sysErr; \
|
||||
} \
|
||||
catch (FoamXServer::FoamXSYSError& sysErr) \
|
||||
{ \
|
||||
/* Convert into FoamX error and bounce up to client */ \
|
||||
throw FoamX::FoamXSYSError(sysErr); \
|
||||
} \
|
||||
catch (FoamX::FoamXIOError& fIOErr) \
|
||||
{ \
|
||||
/* Bounce exception up to client */ \
|
||||
throw fIOErr; \
|
||||
} \
|
||||
catch (FoamXServer::FoamXIOError& fIOErr) \
|
||||
{ \
|
||||
/* Convert into FoamX error and bounce up to client */ \
|
||||
throw FoamX::FoamXIOError(fIOErr); \
|
||||
} \
|
||||
catch (...) \
|
||||
{ \
|
||||
throw FoamX::FoamXError \
|
||||
( \
|
||||
FoamXServer::E_UNEXPECTED, \
|
||||
"Unexpected error.", \
|
||||
functionName, \
|
||||
__FILE__, __LINE__ \
|
||||
); \
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,82 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXFileNameList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::FoamXFileNameList::FoamXFileNameList()
|
||||
{}
|
||||
|
||||
FoamX::FoamXFileNameList::FoamXFileNameList(const Foam::fileNameList& list)
|
||||
{
|
||||
// Reset list length.
|
||||
length(list.size());
|
||||
|
||||
// Copy list elements.
|
||||
forAll(list, i)
|
||||
{
|
||||
(*this)[i] = (const char*)list[i].c_str();
|
||||
}
|
||||
}
|
||||
|
||||
FoamX::FoamXFileNameList::FoamXFileNameList(Foam::Istream& is)
|
||||
:
|
||||
FoamXStringList(is)
|
||||
{}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::FoamXFileNameList& FoamX::FoamXFileNameList::operator=
|
||||
(
|
||||
const FoamXServer::StringList& list
|
||||
)
|
||||
{
|
||||
// Copy string values. Need to call base classes assignment operator.
|
||||
FoamXServer::StringList::operator=(list);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
FoamX::FoamXFileNameList& FoamX::FoamXFileNameList::operator=
|
||||
(
|
||||
const Foam::fileNameList& list
|
||||
)
|
||||
{
|
||||
length(list.size());
|
||||
|
||||
forAll(list, i)
|
||||
{
|
||||
operator[](i) = list[i].c_str();
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,84 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
FoamXString
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
FoamXFileNameList.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef FoamXFileNameList_H
|
||||
#define FoamXFileNameList_H
|
||||
|
||||
// Foam header files.
|
||||
#include "fileNameList.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamXStringList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class FoamXFileNameList Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class FoamXFileNameList
|
||||
:
|
||||
public FoamXStringList
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
FoamXFileNameList();
|
||||
|
||||
FoamXFileNameList(const Foam::fileNameList&);
|
||||
|
||||
FoamXFileNameList(Foam::Istream& is);
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
FoamXFileNameList& operator=(const FoamXServer::StringList&);
|
||||
FoamXFileNameList& operator=(const Foam::fileNameList&);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,59 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Namespace
|
||||
FoamXNameSpaces
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef FoamXNameSpaces_H
|
||||
#define FoamXNameSpaces_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam {}
|
||||
|
||||
namespace FoamXServer
|
||||
{
|
||||
namespace CaseServer {}
|
||||
namespace CasePostServer {}
|
||||
}
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
using namespace Foam;
|
||||
|
||||
using namespace FoamXServer;
|
||||
using namespace FoamXServer::CaseServer;
|
||||
using namespace FoamXServer::CasePostServer;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,190 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
#include "FoamXString.H"
|
||||
|
||||
// Namespaces
|
||||
#include "FoamXNameSpaces.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::FoamXString::FoamXString()
|
||||
{
|
||||
tokenType_ = token::STRING;
|
||||
foamXType_ = FoamXServer::Type_String;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::FoamXString::FoamXString(const FoamX::FoamXString& str)
|
||||
:
|
||||
String_var(str)
|
||||
{
|
||||
tokenType_ = str.tokenType_;
|
||||
foamXType_ = str.foamXType_;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::FoamXString::FoamXString(const Foam::word& str)
|
||||
:
|
||||
String_var(str.c_str())
|
||||
{
|
||||
tokenType_ = token::WORD;
|
||||
foamXType_ = FoamXServer::Type_Word;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::FoamXString::FoamXString(const Foam::string& str)
|
||||
:
|
||||
String_var(str.c_str())
|
||||
{
|
||||
tokenType_ = token::STRING;
|
||||
foamXType_ = FoamXServer::Type_String;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::FoamXString::FoamXString(const char* str)
|
||||
:
|
||||
String_var(str)
|
||||
{
|
||||
tokenType_ = token::STRING;
|
||||
foamXType_ = FoamXServer::Type_String;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::FoamXString::FoamXString(Foam::Istream& is)
|
||||
{
|
||||
read(is);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::FoamXString::~FoamXString()
|
||||
{}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::FoamXString& FoamX::FoamXString::operator=(const FoamXString& str)
|
||||
{
|
||||
tokenType_ = str.tokenType_;
|
||||
foamXType_ = str.foamXType_;
|
||||
|
||||
// Copy string value. Need to call base classes assignment operator.
|
||||
CORBA::String_var::operator=(str);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::FoamXString& FoamX::FoamXString::operator=(const Foam::string& str)
|
||||
{
|
||||
tokenType_ = token::STRING;
|
||||
foamXType_ = FoamXServer::Type_String;
|
||||
|
||||
// Copy string value. Need to call base classes assignment operator.
|
||||
CORBA::String_var::operator=(str.c_str());
|
||||
return *this;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::FoamXString& FoamX::FoamXString::operator=(const Foam::word& str)
|
||||
{
|
||||
tokenType_ = token::WORD;
|
||||
foamXType_ = FoamXServer::Type_Word;
|
||||
|
||||
// Copy string value. Need to call base classes assignment operator.
|
||||
CORBA::String_var::operator=(str.c_str());
|
||||
return *this;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::FoamXString& FoamX::FoamXString::operator=(const char* str)
|
||||
{
|
||||
// Do not reset the type.
|
||||
|
||||
// Copy string value. Need to call base classes assignment operator.
|
||||
CORBA::String_var::operator=(str);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::FoamXString::read(Foam::Istream& is)
|
||||
{
|
||||
// Construct token from Istream.
|
||||
token tok(is);
|
||||
|
||||
// Store the token type.
|
||||
tokenType_ = tok.type();
|
||||
|
||||
if (tokenType_ == token::WORD)
|
||||
{
|
||||
CORBA::String_var::operator=(tok.wordToken().c_str());
|
||||
foamXType_ = FoamXServer::Type_Word;
|
||||
}
|
||||
else if (tokenType_ == token::STRING)
|
||||
{
|
||||
CORBA::String_var::operator=(tok.stringToken().c_str());
|
||||
foamXType_ = FoamXServer::Type_String;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::FoamXString::write(Foam::Ostream& os) const
|
||||
{
|
||||
// Convert this string to the appropriate token type and output.
|
||||
|
||||
if (tokenType_ == token::WORD)
|
||||
{
|
||||
os << Foam::word(this->in()); // In method returns const char*.
|
||||
}
|
||||
else if (tokenType_ == token::STRING)
|
||||
{
|
||||
os << Foam::string(this->in()); // In method returns const char*.
|
||||
}
|
||||
else
|
||||
{
|
||||
WarningIn("FoamX::FoamXString::write(Foam::Ostream& os) const")
|
||||
<< "Expected word or string token."
|
||||
<< Foam::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,124 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
FoamXString
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
FoamXString.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef FoamXString_H
|
||||
#define FoamXString_H
|
||||
|
||||
// Foam header files.
|
||||
#include "Istream.H"
|
||||
#include "Ostream.H"
|
||||
#include "token.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class FoamXString Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class FoamXString
|
||||
:
|
||||
public CORBA::String_var
|
||||
{
|
||||
// Private data
|
||||
|
||||
// Additional information to allow mapping between CORBA and Foam types.
|
||||
|
||||
//- Foam type - WORD or STRING.
|
||||
Foam::token::tokenType tokenType_;
|
||||
|
||||
//- FoamX type - Type_Char, Type_Word or Type_String.
|
||||
FoamXServer::FoamXType foamXType_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
FoamXString();
|
||||
|
||||
FoamXString(const FoamXString&);
|
||||
|
||||
FoamXString(const Foam::string&);
|
||||
|
||||
FoamXString(const Foam::word&);
|
||||
|
||||
FoamXString(const char* str);
|
||||
|
||||
FoamXString(Foam::Istream& is);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~FoamXString();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// I/O methods.
|
||||
|
||||
void write(Foam::Ostream& os) const;
|
||||
|
||||
void read(Foam::Istream& is);
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
// Assignment operators.
|
||||
|
||||
FoamXString& operator=(const FoamXString&);
|
||||
|
||||
FoamXString& operator=(const Foam::string&);
|
||||
|
||||
FoamXString& operator=(const Foam::word&);
|
||||
|
||||
FoamXString& operator=(const char*);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,169 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXStringList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::FoamXStringList::FoamXStringList()
|
||||
{}
|
||||
|
||||
FoamX::FoamXStringList::FoamXStringList(const FoamX::FoamXStringList& list)
|
||||
:
|
||||
StringSequenceTmpl<CORBA::String_var>()
|
||||
{
|
||||
// Copy string values. Need to call base classes assignment operator.
|
||||
FoamXServer::StringList::operator=(list);
|
||||
}
|
||||
|
||||
FoamX::FoamXStringList::FoamXStringList(const Foam::stringList& list)
|
||||
{
|
||||
// Reset list length.
|
||||
length(list.size());
|
||||
|
||||
// Copy list elements.
|
||||
forAll(list, i)
|
||||
{
|
||||
(*this)[i] = list[i].c_str();
|
||||
}
|
||||
}
|
||||
|
||||
FoamX::FoamXStringList::FoamXStringList(Foam::Istream& is)
|
||||
{
|
||||
read(is);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::FoamXStringList& FoamX::FoamXStringList::operator=
|
||||
(
|
||||
const FoamXServer::StringList& list
|
||||
)
|
||||
{
|
||||
// Copy string values. Need to call base classes assignment operator.
|
||||
FoamXServer::StringList::operator=(list);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
FoamX::FoamXStringList& FoamX::FoamXStringList::operator=
|
||||
(
|
||||
const Foam::stringList& list
|
||||
)
|
||||
{
|
||||
length(list.size());
|
||||
|
||||
forAll(list, i)
|
||||
{
|
||||
operator[](i) = list[i].c_str();
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::FoamXStringList::append(const char* str)
|
||||
{
|
||||
// Append string to list.
|
||||
length(length() + 1);
|
||||
(*this)[length() - 1] = str;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int FoamX::FoamXStringList::find(const char* str)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
for (unsigned int i = 0; i <length(); i++)
|
||||
{
|
||||
if (strcmp((*this)[i], str) == 0)
|
||||
{
|
||||
ret = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
bool FoamX::FoamXStringList::remove(const char* str)
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
// See if this list contains the specified entry.
|
||||
int index = find(str);
|
||||
|
||||
// Remove name from list.
|
||||
if (index != -1)
|
||||
{
|
||||
FoamXServer::StringList* newList = new FoamXServer::StringList();
|
||||
newList->length(length() - 1);
|
||||
for (unsigned int i = 0, j = 0; i <length(); i++)
|
||||
{
|
||||
if (i != (unsigned int)(index))
|
||||
{
|
||||
(*newList)[j++] = (*this)[i];
|
||||
}
|
||||
}
|
||||
FoamXServer::StringList::operator=(*newList);
|
||||
delete newList;
|
||||
bRet = true;
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::FoamXStringList::read(Foam::Istream& is)
|
||||
{
|
||||
operator=(static_cast<const Foam::stringList&>(Foam::stringList(is)));
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::FoamXStringList::write(Foam::Ostream& os) const
|
||||
{
|
||||
//os << Foam::label(length());
|
||||
|
||||
os << Foam::token::BEGIN_LIST;
|
||||
|
||||
for (unsigned int i = 0; i < length(); i++)
|
||||
{
|
||||
os << Foam::string(operator[](i));
|
||||
}
|
||||
|
||||
os << Foam::token::END_LIST;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,115 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
FoamXString
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
FoamXStringList.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef FoamXStringList_H
|
||||
#define FoamXStringList_H
|
||||
|
||||
// Foam header files.
|
||||
#include "stringList.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class FoamXStringList Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class FoamXStringList
|
||||
:
|
||||
public FoamXServer::StringList
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
FoamXStringList();
|
||||
|
||||
FoamXStringList(const FoamXStringList&);
|
||||
|
||||
FoamXStringList(const Foam::stringList&);
|
||||
|
||||
FoamXStringList(Foam::Istream& is);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Utility functions.
|
||||
|
||||
Foam::label size() const
|
||||
{
|
||||
return length();
|
||||
}
|
||||
|
||||
void append(const char*);
|
||||
|
||||
//- Returns -1 if string not found on list, or the index otherwise.
|
||||
int find(const char*);
|
||||
|
||||
bool found(const char* name)
|
||||
{
|
||||
return (find(name) != -1);
|
||||
}
|
||||
|
||||
bool remove(const char*);
|
||||
|
||||
|
||||
// Input/Output.
|
||||
|
||||
void write(Foam::Ostream& os) const;
|
||||
|
||||
void read(Foam::Istream& is);
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
FoamXStringList& operator=(const FoamXServer::StringList&);
|
||||
FoamXStringList& operator=(const Foam::stringList&);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,149 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "FoamXTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
Foam::wordList FoamX::FoamXTypes::typeNames_;
|
||||
Foam::HashTable<FoamXServer::FoamXType> FoamX::FoamXTypes::types_;
|
||||
Foam::word FoamX::FoamXTypes::invalidTypeName_("invalidType");
|
||||
|
||||
//- Construct dummy FoamXTypes to initialise static data
|
||||
FoamX::FoamXTypes FoamXTypes_;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
//- Construct null
|
||||
FoamX::FoamXTypes::FoamXTypes()
|
||||
{
|
||||
typeNames_.setSize(FoamXServer::Type_Field + 1);
|
||||
|
||||
typeNames_[FoamXServer::Type_Boolean] = "boolean";
|
||||
typeNames_[FoamXServer::Type_Label] = "label";
|
||||
typeNames_[FoamXServer::Type_Scalar] = "scalar";
|
||||
typeNames_[FoamXServer::Type_Char] = "char";
|
||||
typeNames_[FoamXServer::Type_Word] = "word";
|
||||
typeNames_[FoamXServer::Type_String] = "string";
|
||||
typeNames_[FoamXServer::Type_RootDir] = "rootDir";
|
||||
typeNames_[FoamXServer::Type_RootAndCase] = "rootAndCase";
|
||||
typeNames_[FoamXServer::Type_CaseName] = "caseName";
|
||||
typeNames_[FoamXServer::Type_HostName] = "hostName";
|
||||
typeNames_[FoamXServer::Type_File] = "file";
|
||||
typeNames_[FoamXServer::Type_Directory] = "directory";
|
||||
typeNames_[FoamXServer::Type_Time] = "time";
|
||||
typeNames_[FoamXServer::Type_DimensionSet] = "dimensionSet";
|
||||
typeNames_[FoamXServer::Type_FixedList] = "fixedList";
|
||||
typeNames_[FoamXServer::Type_List] = "list";
|
||||
typeNames_[FoamXServer::Type_Dictionary] = "dictionary";
|
||||
typeNames_[FoamXServer::Type_Selection] = "selection";
|
||||
typeNames_[FoamXServer::Type_Compound] = "compound";
|
||||
typeNames_[FoamXServer::Type_Field] = "field";
|
||||
|
||||
forAll(typeNames_, i)
|
||||
{
|
||||
types_.insert(typeNames_[i], FoamXServer::FoamXType(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool FoamX::FoamXTypes::found(const Foam::word& typeName)
|
||||
{
|
||||
return types_.found(typeName);
|
||||
}
|
||||
|
||||
const Foam::word& FoamX::FoamXTypes::typeName(FoamXServer::FoamXType fxType)
|
||||
{
|
||||
if
|
||||
(
|
||||
fxType >= FoamXServer::Type_Boolean
|
||||
&& fxType <= FoamXServer::Type_Field
|
||||
)
|
||||
{
|
||||
return typeNames_[fxType];
|
||||
}
|
||||
else
|
||||
{
|
||||
return invalidTypeName_;
|
||||
}
|
||||
}
|
||||
|
||||
FoamXServer::FoamXType FoamX::FoamXTypes::lookupType(const Foam::word& typeName)
|
||||
{
|
||||
return types_[typeName];
|
||||
}
|
||||
|
||||
bool FoamX::FoamXTypes::isNumber(FoamXServer::FoamXType type)
|
||||
{
|
||||
return
|
||||
(
|
||||
type == FoamXServer::Type_Label || type == FoamXServer::Type_Scalar
|
||||
);
|
||||
}
|
||||
|
||||
bool FoamX::FoamXTypes::isPrimitive(FoamXServer::FoamXType type)
|
||||
{
|
||||
return (type <= FoamXServer::Type_DimensionSet);
|
||||
}
|
||||
|
||||
bool FoamX::FoamXTypes::isPrimitive(const Foam::word& typeName)
|
||||
{
|
||||
if (types_.found(typeName))
|
||||
{
|
||||
return isPrimitive(*(types_.find(typeName)));
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool FoamX::FoamXTypes::isCompound(FoamXServer::FoamXType type)
|
||||
{
|
||||
return
|
||||
(
|
||||
type >= FoamXServer::Type_FixedList
|
||||
&& type <= FoamXServer::Type_Compound
|
||||
);
|
||||
}
|
||||
|
||||
bool FoamX::FoamXTypes::isCompound(const Foam::word& typeName)
|
||||
{
|
||||
if (types_.found(typeName))
|
||||
{
|
||||
return isCompound(*(types_.find(typeName)));
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,94 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
FoamXTypes
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef FoamXTypes_H
|
||||
#define FoamXTypes_H
|
||||
|
||||
// Foam header files
|
||||
#include "HashTable.H"
|
||||
#include "wordList.H"
|
||||
|
||||
// FoamX header files
|
||||
#include "FoamX.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class FoamXTypes Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class FoamXTypes
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- The names of the types
|
||||
static Foam::wordList typeNames_;
|
||||
|
||||
//- Lookup table of types
|
||||
static Foam::HashTable<FoamXServer::FoamXType> types_;
|
||||
|
||||
//- Return this name when the type is invalid
|
||||
static Foam::word invalidTypeName_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
FoamXTypes();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
static bool found(const Foam::word& typeName);
|
||||
static const Foam::word& typeName(FoamXServer::FoamXType fxType);
|
||||
static FoamXServer::FoamXType lookupType(const Foam::word& typeName);
|
||||
static bool isNumber(FoamXServer::FoamXType type);
|
||||
static bool isPrimitive(FoamXServer::FoamXType type);
|
||||
static bool isPrimitive(const Foam::word& typeName);
|
||||
static bool isCompound(FoamXServer::FoamXType type);
|
||||
static bool isCompound(const Foam::word& typeName);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,105 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXWordList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::FoamXWordList::FoamXWordList()
|
||||
{}
|
||||
|
||||
FoamX::FoamXWordList::FoamXWordList(const Foam::wordList& list)
|
||||
{
|
||||
// Reset list length.
|
||||
length(list.size());
|
||||
|
||||
// Copy list elements.
|
||||
forAll(list, i)
|
||||
{
|
||||
(*this)[i] = list[i].c_str();
|
||||
}
|
||||
}
|
||||
|
||||
FoamX::FoamXWordList::FoamXWordList(Foam::Istream& is)
|
||||
{
|
||||
read(is);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::FoamXWordList& FoamX::FoamXWordList::operator=
|
||||
(
|
||||
const FoamXServer::StringList& list
|
||||
)
|
||||
{
|
||||
// Copy string values. Need to call base classes assignment operator.
|
||||
FoamXServer::StringList::operator=(list);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
FoamX::FoamXWordList& FoamX::FoamXWordList::operator=
|
||||
(
|
||||
const Foam::wordList& list
|
||||
)
|
||||
{
|
||||
length(list.size());
|
||||
|
||||
forAll(list, i)
|
||||
{
|
||||
operator[](i) = list[i].c_str();
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::FoamXWordList::read(Foam::Istream& is)
|
||||
{
|
||||
operator=(static_cast<const Foam::wordList&>(Foam::wordList(is)));
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::FoamXWordList::write(Foam::Ostream& os) const
|
||||
{
|
||||
//os << (int)length();
|
||||
|
||||
os << Foam::token::BEGIN_LIST;
|
||||
|
||||
for (unsigned int i = 0; i < length(); i++)
|
||||
{
|
||||
os << Foam::word(operator[](i));
|
||||
}
|
||||
|
||||
os << Foam::token::END_LIST;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,93 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
FoamXString
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
FoamXWordList.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef FoamXWordList_H
|
||||
#define FoamXWordList_H
|
||||
|
||||
// Foam header files.
|
||||
#include "wordList.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamXStringList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class FoamXWordList Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class FoamXWordList
|
||||
:
|
||||
public FoamXStringList
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
FoamXWordList();
|
||||
|
||||
FoamXWordList(const Foam::wordList&);
|
||||
|
||||
FoamXWordList(Foam::Istream& is);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Input/Output.
|
||||
|
||||
void write(Foam::Ostream& os) const;
|
||||
|
||||
void read(Foam::Istream& is);
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
FoamXWordList& operator=(const FoamXServer::StringList&);
|
||||
FoamXWordList& operator=(const Foam::wordList&);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,224 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::IApplicationImpl
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
IApplicationImpl.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef IApplicationImpl_H
|
||||
#define IApplicationImpl_H
|
||||
|
||||
// Foam header files.
|
||||
#include "fileName.H"
|
||||
#include "dictionary.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
#include "FoamXString.H"
|
||||
#include "FoamXStringList.H"
|
||||
#include "FoamXWordList.H"
|
||||
#include "ObjRefDictionary.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
// Forward declaration of classes.
|
||||
class IGeometricFieldDescriptorImpl;
|
||||
class IPatchPhysicalTypeDescriptorImpl;
|
||||
class ITypeDescriptorImpl;
|
||||
class IPropertiesImpl;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class IApplicationImpl Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class IApplicationImpl
|
||||
:
|
||||
public POA_FoamXServer::CaseServer::IApplication,
|
||||
public PortableServer::RefCountServantBase
|
||||
{
|
||||
// Private data
|
||||
|
||||
Foam::word name_;
|
||||
Foam::string description_;
|
||||
Foam::fileName category_;
|
||||
|
||||
//- Path of the application class description
|
||||
Foam::fileName appCfgPath_;
|
||||
|
||||
//- System or user class flag.
|
||||
bool systemClass_;
|
||||
|
||||
//- Reference to the Foam properties class
|
||||
const IPropertiesImpl& foamSystemProperties_;
|
||||
|
||||
ITypeDescriptorImpl* arguments_;
|
||||
FoamXWordList moduleList_;
|
||||
|
||||
ObjRefDictionary<IGeometricFieldDescriptorImpl> fieldDescriptorMap_;
|
||||
|
||||
ObjRefDictionary<IPatchPhysicalTypeDescriptorImpl>
|
||||
patchPhysicalTypeDescriptorMap_;
|
||||
|
||||
ObjRefDictionary<ITypeDescriptorImpl> dictTypeDescriptorMap_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
IApplicationImpl
|
||||
(
|
||||
const ApplicationDescriptor& appDesc,
|
||||
const IPropertiesImpl& foamSystemProperties
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~IApplicationImpl();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual char* name();
|
||||
virtual void name(const char*);
|
||||
|
||||
fileName appCfgPathName() const
|
||||
{
|
||||
return appCfgPath_/name_ + ".cfg";
|
||||
}
|
||||
|
||||
virtual char* description();
|
||||
virtual void description(const char*);
|
||||
|
||||
virtual char* category();
|
||||
virtual void category(const char*);
|
||||
|
||||
virtual FoamXServer::StringList* modules();
|
||||
virtual void modules(const FoamXServer::StringList&);
|
||||
|
||||
virtual CORBA::Boolean systemClass();
|
||||
|
||||
virtual FoamXServer::StringList* fields();
|
||||
|
||||
virtual void getField
|
||||
(
|
||||
const char* fieldKey,
|
||||
FoamXServer::CaseServer::IGeometricFieldDescriptor_out
|
||||
fieldDescriptor
|
||||
);
|
||||
|
||||
virtual void findField
|
||||
(
|
||||
const char* fieldName,
|
||||
FoamXServer::CaseServer::IGeometricFieldDescriptor_out
|
||||
fieldDescriptor
|
||||
);
|
||||
|
||||
virtual void addField
|
||||
(
|
||||
const char* fieldKey,
|
||||
FoamXServer::CaseServer::IGeometricFieldDescriptor_out
|
||||
fieldDescriptor
|
||||
);
|
||||
|
||||
virtual void deleteField(const char* fieldKey);
|
||||
|
||||
virtual FoamXServer::StringList* patchPhysicalTypes();
|
||||
|
||||
virtual void getPatchPhysicalType
|
||||
(
|
||||
const char* patchPhysicalTypeKey,
|
||||
FoamXServer::CaseServer::IPatchPhysicalTypeDescriptor_out
|
||||
boundaryDescriptor
|
||||
);
|
||||
|
||||
virtual void findPatchPhysicalType
|
||||
(
|
||||
const char* patchPhysicalTypeName,
|
||||
FoamXServer::CaseServer::IPatchPhysicalTypeDescriptor_out
|
||||
boundaryDescriptor
|
||||
);
|
||||
|
||||
virtual void addPatchPhysicalType
|
||||
(
|
||||
const char* patchPhysicalTypeKey,
|
||||
FoamXServer::CaseServer::IPatchPhysicalTypeDescriptor_out
|
||||
boundaryDescriptor
|
||||
);
|
||||
|
||||
virtual void deletePatchPhysicalType
|
||||
(
|
||||
const char* patchPhysicalTypeKey
|
||||
);
|
||||
|
||||
virtual FoamXServer::StringList* dictionaries();
|
||||
|
||||
virtual void getDictionary
|
||||
(
|
||||
const char* dictName,
|
||||
FoamXServer::ITypeDescriptor_out
|
||||
dictTypeDescriptor
|
||||
);
|
||||
|
||||
virtual void addDictionary
|
||||
(
|
||||
const char* dictName,
|
||||
FoamXServer::ITypeDescriptor_out
|
||||
dictTypeDescriptor
|
||||
);
|
||||
|
||||
virtual void deleteDictionary(const char* dictName);
|
||||
|
||||
|
||||
//- Validation.
|
||||
virtual void validate();
|
||||
|
||||
//- Persistence.
|
||||
virtual void save();
|
||||
|
||||
//- Load from application class definition dictionary.
|
||||
void load();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,224 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::IDictionaryEntryImpl
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
IDictionaryEntryImpl.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef IDictionaryEntryImpl_H
|
||||
#define IDictionaryEntryImpl_H
|
||||
|
||||
// Foam header files.
|
||||
#include "List.H"
|
||||
#include "DLList.H"
|
||||
#include "Istream.H"
|
||||
#include "entry.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
#include "FoamXAny.H"
|
||||
#include "DictionaryWriter.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
// Forward declaration of classes.
|
||||
class ITypeDescriptorImpl;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class IDictionaryEntryImpl Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class IDictionaryEntryImpl
|
||||
:
|
||||
public POA_FoamXServer::IDictionaryEntry,
|
||||
public PortableServer::RefCountServantBase
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Type descriptor of this entry.
|
||||
FoamXServer::ITypeDescriptor_var typeDescriptor_;
|
||||
|
||||
//- Modified flag.
|
||||
CORBA::Boolean modified_;
|
||||
|
||||
//- Value of this entry for non-compound types.
|
||||
FoamXAny value_;
|
||||
|
||||
//- Doubly linked list of sub-elements.
|
||||
Foam::DLList<IDictionaryEntryImpl*> subElements_;
|
||||
|
||||
//- Pointer to hold the list token for large lists
|
||||
Foam::token* listTokenPtr_;
|
||||
|
||||
//- Current selection
|
||||
label selection_;
|
||||
|
||||
|
||||
// Private member functions.
|
||||
|
||||
void clearSubElements();
|
||||
|
||||
template<class Type, class CorbaType>
|
||||
void expandPrimitiveList();
|
||||
|
||||
template<class Form>
|
||||
void expandFixedListList();
|
||||
|
||||
void expandList();
|
||||
|
||||
void bindType
|
||||
(
|
||||
FoamXServer::ITypeDescriptor_ptr typeDesc
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct default for given type descriptor
|
||||
IDictionaryEntryImpl(FoamXServer::ITypeDescriptor_ptr typeDesc);
|
||||
|
||||
//- Construct as copy
|
||||
IDictionaryEntryImpl(IDictionaryEntryImpl&);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~IDictionaryEntryImpl();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual FoamXServer::ITypeDescriptor_ptr typeDescriptor();
|
||||
|
||||
|
||||
// Non-compound type functions.
|
||||
|
||||
virtual FoamXServer::FoamXAny* value();
|
||||
virtual void value(const FoamXServer::FoamXAny& newValue);
|
||||
virtual void setValue(const FoamXServer::FoamXAny& newValue);
|
||||
|
||||
|
||||
// Compound type functions.
|
||||
|
||||
const Foam::DLList<IDictionaryEntryImpl*>& subElementPtrs() const
|
||||
{
|
||||
return subElements_;
|
||||
}
|
||||
|
||||
virtual FoamXServer::DictionaryEntryList* subElements();
|
||||
virtual CORBA::Long nSubElements();
|
||||
virtual CORBA::Boolean packedList();
|
||||
|
||||
// Dictionary type functions.
|
||||
|
||||
// virtual CORBA::Boolean found(const char* entryName) const;
|
||||
// virtual FoamXServer::DictionaryEntry* lookup
|
||||
// (
|
||||
// const char* entryName
|
||||
// ) const;
|
||||
// virtual FoamXServer::DictionaryEntry* subDict
|
||||
// (
|
||||
// const char* entryName
|
||||
// ) const;
|
||||
|
||||
|
||||
// Selection type functions.
|
||||
|
||||
virtual CORBA::Long selection();
|
||||
virtual void selection(CORBA::Long);
|
||||
|
||||
|
||||
// List type functions.
|
||||
|
||||
virtual void addElement
|
||||
(
|
||||
FoamXServer::IDictionaryEntry_out subEntry
|
||||
);
|
||||
|
||||
virtual void removeElement
|
||||
(
|
||||
FoamXServer::IDictionaryEntry_ptr subEntry
|
||||
);
|
||||
|
||||
|
||||
// Recursive state functions.
|
||||
|
||||
virtual void validate();
|
||||
virtual CORBA::Boolean modified();
|
||||
|
||||
|
||||
// Persistence.
|
||||
|
||||
void load(const Foam::entry&);
|
||||
void load(const Foam::dictionary&, bool allowNonOptional = false);
|
||||
virtual void load(Foam::Istream&);
|
||||
|
||||
//- Save top-level dictionary.
|
||||
virtual void save();
|
||||
|
||||
void save
|
||||
(
|
||||
DictionaryWriter& dictWriter,
|
||||
bool dictEntry = false
|
||||
);
|
||||
|
||||
|
||||
//- Method to allow field type descriptors to be late-bound.
|
||||
void bindFieldType
|
||||
(
|
||||
FoamXServer::ITypeDescriptor_ptr typeDesc
|
||||
);
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
void operator=(const IDictionaryEntryImpl&);
|
||||
void operator=(IDictionaryEntry_ptr);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,360 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
#include "IGeometricFieldDescriptorImpl.H"
|
||||
#include "ITypeDescriptorImpl.H"
|
||||
#include "IGeometryDescriptorImpl.H"
|
||||
#include "DimensionSet.H"
|
||||
#include "LogEntry.H"
|
||||
#include "Paths.H"
|
||||
|
||||
// Namespaces
|
||||
#include "FoamXNameSpaces.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::IGeometricFieldDescriptorImpl::IGeometricFieldDescriptorImpl
|
||||
(
|
||||
const char* fieldName
|
||||
)
|
||||
:
|
||||
fieldName_(fieldName),
|
||||
fieldDescription_(fieldName),
|
||||
typeDescriptor_(NULL),
|
||||
geometryDescriptor_(NULL)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldDescriptorImpl::IGeometricFieldDescriptorImpl"
|
||||
"(const char* fieldName)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
// Initialise dimension set.
|
||||
dimensionSet_ == dimless;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::IGeometricFieldDescriptorImpl::IGeometricFieldDescriptorImpl
|
||||
(
|
||||
const word& fieldName,
|
||||
const dictionary& fieldDict,
|
||||
const ObjRefHashTable<ITypeDescriptorImpl*>& foamTypes,
|
||||
const ObjRefHashTable<IGeometryDescriptorImpl*>& geometryTypes
|
||||
)
|
||||
:
|
||||
fieldName_(fieldName),
|
||||
typeDescriptor_(NULL),
|
||||
geometryDescriptor_(NULL)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldDescriptorImpl::IGeometricFieldDescriptorImpl"
|
||||
"(const word& fieldName, const dictionary& fieldDict)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
// Extract the field type name and description.
|
||||
fieldDict.lookup("description") >> fieldDescription_;
|
||||
fieldDict.lookup("fieldType") >> fieldTypeName_;
|
||||
fieldDict.lookup("geometryType") >> geometryTypeName_;
|
||||
|
||||
// Extract the dimension set.
|
||||
dimensionSet_ == dimensionSet(fieldDict.lookup("dimensions"));
|
||||
|
||||
// Get the field descriptor for the specified field type.
|
||||
if (!foamTypes.found(fieldTypeName_))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_FAIL,
|
||||
"Type descriptor not found for "
|
||||
+ fieldTypeName_,
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
typeDescriptor_ = foamTypes.find(fieldTypeName_)();
|
||||
|
||||
|
||||
// Get the field descriptor for the specified field type.
|
||||
word fieldName = fieldTypeName_ + "Field";
|
||||
if (!foamTypes.found(fieldName))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_FAIL,
|
||||
"Type descriptor not found for field type "
|
||||
+ fieldName,
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
fieldTypeDescriptor_ = foamTypes.find(fieldName)();
|
||||
|
||||
|
||||
// Get the geometry descriptor for the specified geometry type.
|
||||
if (!geometryTypes.found(geometryTypeName_))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_FAIL,
|
||||
"Geometry descriptor not found for specified geometry type "
|
||||
+ geometryTypeName_,
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
geometryDescriptor_ = geometryTypes.find(geometryTypeName_)();
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::IGeometricFieldDescriptorImpl::~IGeometricFieldDescriptorImpl()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldDescriptorImpl::"
|
||||
"~IGeometricFieldDescriptorImpl()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::ITypeDescriptor_ptr
|
||||
FoamX::IGeometricFieldDescriptorImpl::typeDescriptor()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldDescriptorImpl::typeDescriptor()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
ITypeDescriptor_ptr pTypeDesc = ITypeDescriptor::_nil();
|
||||
|
||||
if (typeDescriptor_ != NULL)
|
||||
{
|
||||
// Return a duplictate reference to the TypeDescriptor object.
|
||||
pTypeDesc = typeDescriptor_->_this();
|
||||
}
|
||||
|
||||
return pTypeDesc;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::ITypeDescriptor_ptr
|
||||
FoamX::IGeometricFieldDescriptorImpl::fieldTypeDescriptor()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldDescriptorImpl::fieldTypeDescriptor()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
ITypeDescriptor_ptr pTypeDesc = ITypeDescriptor::_nil();
|
||||
|
||||
if (typeDescriptor_ != NULL)
|
||||
{
|
||||
// Return a duplictate reference to the TypeDescriptor object.
|
||||
pTypeDesc = fieldTypeDescriptor_->_this();
|
||||
}
|
||||
|
||||
return pTypeDesc;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::IGeometryDescriptor_ptr
|
||||
FoamX::IGeometricFieldDescriptorImpl::geometryDescriptor()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldDescriptorImpl::geometryDescriptor()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
IGeometryDescriptor_ptr pGeomDesc = IGeometryDescriptor::_nil();
|
||||
|
||||
if (geometryDescriptor_ != NULL)
|
||||
{
|
||||
// Return a duplictate reference to the GeometryDescriptor object.
|
||||
pGeomDesc = geometryDescriptor_->_this();
|
||||
}
|
||||
|
||||
return pGeomDesc;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
char* FoamX::IGeometricFieldDescriptorImpl::name()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldDescriptorImpl::name()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
// Duplicate string and return.
|
||||
return CORBA::string_dup(fieldName_.c_str());
|
||||
}
|
||||
|
||||
void FoamX::IGeometricFieldDescriptorImpl::name(const char* newName)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldDescriptorImpl::name(const char* newName)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
fieldName_ = newName;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
char* FoamX::IGeometricFieldDescriptorImpl::description()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldDescriptorImpl::description()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
// Duplicate string and return.
|
||||
return CORBA::string_dup(fieldDescription_.c_str());
|
||||
}
|
||||
|
||||
void FoamX::IGeometricFieldDescriptorImpl::description
|
||||
(
|
||||
const char* newDescription
|
||||
)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldDescriptorImpl::"
|
||||
"description(const char* newDescription)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
fieldDescription_ = newDescription;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
char* FoamX::IGeometricFieldDescriptorImpl::fieldTypeName()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldDescriptorImpl::fieldTypeName()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
// Duplicate string and return.
|
||||
return CORBA::string_dup(fieldTypeName_.c_str());
|
||||
}
|
||||
|
||||
void FoamX::IGeometricFieldDescriptorImpl::fieldTypeName(const char* newName)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldDescriptorImpl::"
|
||||
"fieldTypeName(const char* newName)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
fieldTypeName_ = newName;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
char* FoamX::IGeometricFieldDescriptorImpl::geometryTypeName()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldDescriptorImpl::geometryTypeName()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
// Duplicate string and return.
|
||||
return CORBA::string_dup(geometryTypeName_.c_str());
|
||||
}
|
||||
|
||||
void FoamX::IGeometricFieldDescriptorImpl::geometryTypeName(const char* newName)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldDescriptorImpl::"
|
||||
"geometryTypeName(const char* newName)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
geometryTypeName_ = newName;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::DimensionSet FoamX::IGeometricFieldDescriptorImpl::dimensions()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldDescriptorImpl::dimensions()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
return dimensionSet_;
|
||||
}
|
||||
|
||||
void FoamX::IGeometricFieldDescriptorImpl::dimensions
|
||||
(
|
||||
const DimensionSet& newDimSet
|
||||
)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldDescriptorImpl::dimensions"
|
||||
"(const DimensionSet& newDimSet)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
dimensionSet_ = newDimSet;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::IGeometricFieldDescriptorImpl::save(DictionaryWriter& dict)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldDescriptorImpl::save(DictionaryWriter& dict)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
|
||||
// Save this field information to the dictionary.
|
||||
dict.startSubDict(fieldName_);
|
||||
|
||||
dict.writeEntry("description", fieldDescription_);
|
||||
dict.writeEntry("fieldType", fieldTypeName_);
|
||||
dict.writeEntry("geometryType", geometryTypeName_);
|
||||
dict.writeEntry("dimensions", dimensionSet_);
|
||||
|
||||
dict.endSubDict();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,165 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::IGeometricFieldDescriptorImpl
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
IGeometricFieldDescriptorImpl.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef IGeometricFieldDescriptorImpl_H
|
||||
#define IGeometricFieldDescriptorImpl_H
|
||||
|
||||
// Foam header files.
|
||||
#include "IDLList.H"
|
||||
#include "dictionary.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
#include "DictionaryWriter.H"
|
||||
#include "ObjRefHashTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
// Forward declaration of classes.
|
||||
class ITypeDescriptorImpl;
|
||||
class IGeometryDescriptorImpl;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class IGeometricFieldDescriptorImpl Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class IGeometricFieldDescriptorImpl
|
||||
:
|
||||
public POA_FoamXServer::CaseServer::IGeometricFieldDescriptor,
|
||||
public PortableServer::RefCountServantBase,
|
||||
public IDLList<IGeometricFieldDescriptorImpl>::link
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Field name (eg, "p").
|
||||
Foam::word fieldName_;
|
||||
|
||||
//- Field description (eg, "Pressure").
|
||||
Foam::string fieldDescription_;
|
||||
|
||||
//- Field dimensions.
|
||||
FoamXServer::DimensionSet dimensionSet_;
|
||||
|
||||
//- Field type name (eg, "scalar").
|
||||
Foam::word fieldTypeName_;
|
||||
|
||||
//- Reference to type descriptor.
|
||||
ITypeDescriptorImpl* typeDescriptor_;
|
||||
|
||||
//- Reference to type descriptor for the field.
|
||||
ITypeDescriptorImpl* fieldTypeDescriptor_;
|
||||
|
||||
//- Geometry type name (eg, "vol").
|
||||
Foam::word geometryTypeName_;
|
||||
|
||||
//- Reference tp geometry descriptor for this field.
|
||||
IGeometryDescriptorImpl* geometryDescriptor_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
IGeometricFieldDescriptorImpl(const char* fieldName);
|
||||
|
||||
IGeometricFieldDescriptorImpl
|
||||
(
|
||||
const Foam::word& fieldName,
|
||||
const Foam::dictionary& fieldDict,
|
||||
const ObjRefHashTable<ITypeDescriptorImpl*>& foamTypes,
|
||||
const ObjRefHashTable<IGeometryDescriptorImpl*>& geometryTypes
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~IGeometricFieldDescriptorImpl();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Foam access functions
|
||||
|
||||
//- Keyword used by Dictionary
|
||||
const word& keyword() const
|
||||
{
|
||||
return fieldName_;
|
||||
}
|
||||
|
||||
|
||||
// FoamServer access functions
|
||||
|
||||
virtual FoamXServer::ITypeDescriptor_ptr typeDescriptor();
|
||||
virtual FoamXServer::ITypeDescriptor_ptr fieldTypeDescriptor();
|
||||
|
||||
virtual FoamXServer::CaseServer::IGeometryDescriptor_ptr
|
||||
geometryDescriptor();
|
||||
|
||||
virtual char* name();
|
||||
virtual void name(const char*);
|
||||
|
||||
virtual char* description();
|
||||
virtual void description(const char*);
|
||||
|
||||
virtual char* fieldTypeName();
|
||||
virtual void fieldTypeName(const char*);
|
||||
|
||||
virtual char* geometryTypeName();
|
||||
virtual void geometryTypeName(const char*);
|
||||
|
||||
virtual FoamXServer::DimensionSet dimensions();
|
||||
virtual void dimensions
|
||||
(
|
||||
const FoamXServer::DimensionSet&
|
||||
);
|
||||
|
||||
|
||||
//- Persist to file.
|
||||
void save(DictionaryWriter& dict);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,675 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// Foam header files
|
||||
#include "OSspecific.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
#include "IGeometricFieldImpl.H"
|
||||
#include "IDictionaryEntryImpl.H"
|
||||
#include "LogEntry.H"
|
||||
#include "Paths.H"
|
||||
|
||||
// Namespaces
|
||||
#include "FoamXNameSpaces.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::IGeometricFieldImpl::IGeometricFieldImpl
|
||||
(
|
||||
IGeometricFieldDescriptor_ptr fieldDescriptor,
|
||||
IFoamProperties_ptr foamProperties
|
||||
)
|
||||
:
|
||||
internalFieldValue_(NULL)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldImpl::IGeometricFieldImpl"
|
||||
"(IGeometricFieldDescriptor_ptr fieldDescriptor, "
|
||||
"IFoamProperties_ptr foamProperties)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
// Take references to the FieldDescriptor and FoamProperties objects.
|
||||
if (CORBA::is_nil(foamProperties))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_INVALID_ARG,
|
||||
"Invalid FoamProperties reference.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
if (CORBA::is_nil(fieldDescriptor))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_INVALID_ARG,
|
||||
"Invalid FieldDescriptor reference.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
foamProperties_ = IFoamProperties::_duplicate(foamProperties);
|
||||
fieldDescriptor_ = IGeometricFieldDescriptor::_duplicate
|
||||
(
|
||||
fieldDescriptor
|
||||
);
|
||||
|
||||
// Get the field name.
|
||||
fieldName_ = fieldDescriptor_->name();
|
||||
|
||||
// Create the internal field value.
|
||||
ITypeDescriptor_var fieldType = fieldDescriptor_->fieldTypeDescriptor();
|
||||
internalFieldValue_ = new IDictionaryEntryImpl(fieldType);
|
||||
if (internalFieldValue_ == NULL)
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_FAIL,
|
||||
"Failed to create internal field value "
|
||||
"dictionary entry object.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::IGeometricFieldImpl::~IGeometricFieldImpl()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldImpl::~IGeometricFieldImpl()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
// Release internal value and reference level value dictionary entry objects
|
||||
if (internalFieldValue_ != NULL)
|
||||
{
|
||||
internalFieldValue_->_remove_ref();
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
char* FoamX::IGeometricFieldImpl::name()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldImpl::name()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
// Get name from fieldDescriptor object.
|
||||
if (!CORBA::is_nil(fieldDescriptor_))
|
||||
{
|
||||
return fieldDescriptor_->name();
|
||||
}
|
||||
else
|
||||
{
|
||||
return CORBA::string_dup("");
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::IGeometricFieldImpl::getInternalFieldValue
|
||||
(
|
||||
IDictionaryEntry_out internalFieldValue
|
||||
)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldImpl::getInternalFieldValue"
|
||||
"(IDictionaryEntry_out internalFieldValue)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
if (internalFieldValue_ == NULL)
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Invalid internal field value object.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
internalFieldValue = internalFieldValue_->_this();
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::IGeometricFieldImpl::getPatchFieldParameters
|
||||
(
|
||||
const char* patchName,
|
||||
IDictionaryEntry_out patchFields
|
||||
)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldImpl::getPatchFieldParameters"
|
||||
"(const char* patchName, IDictionaryEntry_out patchFields)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
// See if this patch requires extra parameters.
|
||||
if
|
||||
(
|
||||
patchFields_.found(patchName)
|
||||
&& patchFields_[patchName]->subElementPtrs().size() > 1
|
||||
)
|
||||
{
|
||||
patchFields = patchFields_[patchName]->_this();
|
||||
}
|
||||
else
|
||||
{
|
||||
patchFields = IDictionaryEntry::_nil();
|
||||
}
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Set the patch field type for the specified patch. Note that the patch
|
||||
// field type parameter is the true Foam name and not the patch
|
||||
// field descriptor key.
|
||||
|
||||
void FoamX::IGeometricFieldImpl::addPatch
|
||||
(
|
||||
const char* patchName,
|
||||
const char* patchFieldType
|
||||
)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldImpl::addPatch"
|
||||
"(const char* patchName, const char* patchFieldType)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
log << "Adding patch " << patchName
|
||||
<< " to field " << fieldName_ << endl;
|
||||
|
||||
// Check patch name.
|
||||
if (patchFieldNames_.found(patchName))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_INVALID_ARG,
|
||||
"Invalid patch name.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
// Lookup this type and see if additional parameters are required.
|
||||
ITypeDescriptor_var pfDesc;
|
||||
foamProperties_->findPatchFieldType(patchFieldType, pfDesc.out());
|
||||
|
||||
// Make sure that the patch field type name is valid.
|
||||
if (CORBA::is_nil(pfDesc))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_FAIL,
|
||||
"Invalid patch field type name '" + word(patchFieldType) + "'.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
// Set patch field type.
|
||||
patchFieldNames_.insert(patchName, patchFieldType);
|
||||
|
||||
// Get the type descriptor for the extra parameters. May be nil.
|
||||
if (!CORBA::is_nil(pfDesc))
|
||||
{
|
||||
// Create a default DictionaryEntry object.
|
||||
IDictionaryEntryImpl* patchDictEntryPtr = new IDictionaryEntryImpl
|
||||
(
|
||||
pfDesc
|
||||
);
|
||||
|
||||
if (patchDictEntryPtr == NULL)
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_FAIL,
|
||||
"Failed to create IDictionaryEntryImpl object.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
// Bind the field type descriptor to the parameter
|
||||
// dictionary entry object.
|
||||
patchDictEntryPtr->bindFieldType
|
||||
(
|
||||
fieldDescriptor_->fieldTypeDescriptor()
|
||||
);
|
||||
|
||||
// Add to map.
|
||||
patchFields_.insert(patchName, patchDictEntryPtr);
|
||||
}
|
||||
|
||||
log << "Added patch " << patchName
|
||||
<< " to field " << fieldName_ << endl;
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::IGeometricFieldImpl::deletePatch(const char* patchName)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldImpl::deletePatch(const char* patchName)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
// Check patch name.
|
||||
if (!patchFieldNames_.found(patchName))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_INVALID_ARG,
|
||||
"Invalid patch name.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
// Remove from patch field type map.
|
||||
patchFieldNames_.erase(patchFieldNames_.find(patchName));
|
||||
|
||||
// Remove from patch field parameter map if necessary.
|
||||
if (patchFields_.found(patchName))
|
||||
{
|
||||
HashTable<IDictionaryEntryImpl*>::iterator iter =
|
||||
patchFields_.find(patchName);
|
||||
patchFields_.erase(iter); // Releases reference.
|
||||
}
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::IGeometricFieldImpl::setPatchFieldType
|
||||
(
|
||||
const char* patchName,
|
||||
const char* patchFieldType
|
||||
)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldImpl::setPatchFieldType"
|
||||
"(const char* patchName, const char* patchFieldType)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
// Set patch field type if it has changed.
|
||||
if
|
||||
(
|
||||
!patchFieldNames_.found(patchName)
|
||||
|| patchFieldType != patchFieldNames_.find(patchName)()
|
||||
)
|
||||
{
|
||||
deletePatch(patchName);
|
||||
addPatch(patchName, patchFieldType);
|
||||
}
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
CORBA::Boolean FoamX::IGeometricFieldImpl::modified()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::ICaseServerImpl::modified()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
if (internalFieldValue_->modified()) return true;
|
||||
|
||||
for
|
||||
(
|
||||
ObjRefHashTable<IDictionaryEntryImpl*>::iterator iter =
|
||||
patchFields_.begin();
|
||||
iter != patchFields_.end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
if (iter()->modified()) return true;
|
||||
}
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::IGeometricFieldImpl::load(const dictionary& fieldDict)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldImpl::load(const dictionary& fieldDict)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
log << "loading field " << fieldName_ << endl;
|
||||
|
||||
log << "Reading " << fieldDict.name()
|
||||
<< " start line " << fieldDict.startLineNumber()
|
||||
<< " end line " << fieldDict.endLineNumber() << endl;
|
||||
|
||||
// Make sure the field dictionary contains the required entries.
|
||||
if
|
||||
(
|
||||
!fieldDict.found("internalField")
|
||||
|| !fieldDict.found("boundaryField")
|
||||
)
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_FAIL,
|
||||
"Malformed field dictionary.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
// Read the internal field value.
|
||||
internalFieldValue_->load(fieldDict.lookup("internalField"));
|
||||
|
||||
// Open boundary field dictionary.
|
||||
const dictionary& boundaryFieldDict(fieldDict.subDict("boundaryField"));
|
||||
|
||||
// Loop over all defined patch names and read the patch field values.
|
||||
wordList patchNames = patchFieldNames_.toc();
|
||||
forAll(patchNames, i)
|
||||
{
|
||||
word patchName(patchNames[i]);
|
||||
|
||||
if (!boundaryFieldDict.found(patchName))
|
||||
{
|
||||
// Patch dictionary not found. Bugger.
|
||||
log << "Warning : Patch dictionary '" << patchName
|
||||
<< "' not found in field dictionary '" << fieldName_
|
||||
<< "'." << endl;
|
||||
|
||||
WarningIn(functionName)
|
||||
<< "Patch dictionary '" << patchName
|
||||
<< "' not found in field dictionary '" << fieldName_
|
||||
<< "'." << endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Open patch dictionary.
|
||||
const dictionary& patchDict(boundaryFieldDict.subDict(patchName));
|
||||
|
||||
// Make sure the patch dictionary contains the required entries.
|
||||
if (!patchDict.found("type"))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_FAIL,
|
||||
"Patch field type not specified for patch '" + patchName
|
||||
+ "' in field dictionary '" + fieldName_ + "'.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
// Read the patch field type. This is the actual type not the key.
|
||||
word patchFieldType(patchDict.lookup("type"));
|
||||
|
||||
// Get the PatchFieldDescriptor object. Search by type.
|
||||
ITypeDescriptor_var pfDesc;
|
||||
foamProperties_->findPatchFieldType
|
||||
(
|
||||
patchFieldType.c_str(),
|
||||
pfDesc.out()
|
||||
);
|
||||
|
||||
// Make sure that the patch field type name is valid.
|
||||
if (CORBA::is_nil(pfDesc))
|
||||
{
|
||||
log << "Warning : Invalid patch field type '" << patchFieldType
|
||||
<< "' for patch '" << patchName
|
||||
<< "' in field dictionary '" << fieldName_ << "'."
|
||||
<< endl;
|
||||
|
||||
WarningIn(functionName)
|
||||
<< "Invalid patch field type '" << patchFieldType
|
||||
<< "' for patch '" << patchName
|
||||
<< "' in field dictionary '" << fieldName_ << "'."
|
||||
<< endl;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check that the patch field type is valid for the boundary type
|
||||
// specified for this patch.
|
||||
word boundaryPatchFieldType = patchFieldNames_[patchName];
|
||||
if (patchFieldType != boundaryPatchFieldType)
|
||||
{
|
||||
log << "Warning : Incorrect patch field type '"
|
||||
<< patchFieldType << "' for patch '" << patchName << "'."
|
||||
<< endl << " Boundary condition specifies '"
|
||||
<< boundaryPatchFieldType
|
||||
<< "' for field '" << fieldName_ << "'."
|
||||
<< endl;
|
||||
|
||||
WarningIn(functionName)
|
||||
<< "Incorrect patch field type '"
|
||||
<< patchFieldType << "' for patch '" << patchName << "'."
|
||||
<< endl << " Boundary condition specifies '"
|
||||
<< boundaryPatchFieldType
|
||||
<< "' for field '" << fieldName_ << "'."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Set the patch field type. Poss over-ride default?
|
||||
patchFieldNames_[patchName] = patchFieldType;
|
||||
|
||||
// Release any previous patch field parameter object.
|
||||
if (patchFields_.found(patchName))
|
||||
{
|
||||
HashTable<IDictionaryEntryImpl*>::iterator iter =
|
||||
patchFields_.find(patchName);
|
||||
patchFields_.erase(iter);
|
||||
}
|
||||
|
||||
// Get the type descriptor for the extra parameters. May be nil.
|
||||
if (!CORBA::is_nil(pfDesc))
|
||||
{
|
||||
// Create and initialise a new IDictionaryEntryImpl
|
||||
// object for the parameters.
|
||||
IDictionaryEntryImpl* patchDictEntryPtr =
|
||||
new IDictionaryEntryImpl
|
||||
(
|
||||
pfDesc
|
||||
);
|
||||
if (patchDictEntryPtr == NULL)
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_FAIL,
|
||||
"Failed to create patch field parameter "
|
||||
"DictionaryEntry Object.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
// Bind the field type descriptor to the parameter
|
||||
// dictionary entry object.
|
||||
patchDictEntryPtr->bindFieldType
|
||||
(
|
||||
fieldDescriptor_->fieldTypeDescriptor()
|
||||
);
|
||||
|
||||
// Load values from dictionary.
|
||||
// The extra parameters are defined as dictionary
|
||||
// entries. Pass the entire patch dictionary through.
|
||||
// Tolerate non-existent dictionary entries.
|
||||
// Any missing parameters will get a default value.
|
||||
|
||||
patchDictEntryPtr->load
|
||||
(
|
||||
boundaryFieldDict.subDict(patchName),
|
||||
true
|
||||
);
|
||||
|
||||
// Add to map.
|
||||
patchFields_.insert(patchName, patchDictEntryPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::IGeometricFieldImpl::save
|
||||
(
|
||||
DictionaryWriter& dictWriter,
|
||||
const wordList& patchNames
|
||||
)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometricFieldImpl::save"
|
||||
"(DictionaryWriter& dictWriter, const wordList& patchNames)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
// Validate the dictionary entry items.
|
||||
internalFieldValue_->validate();
|
||||
|
||||
// Construct class name (eg, "volScalarField").
|
||||
word className
|
||||
(
|
||||
word(fieldDescriptor_->geometryDescriptor()->name())
|
||||
& word(fieldDescriptor_->fieldTypeDescriptor()->name())
|
||||
);
|
||||
|
||||
dictWriter.writeHeader
|
||||
(
|
||||
"Field Dictionary",
|
||||
className
|
||||
);
|
||||
|
||||
dictWriter.writeEndl();
|
||||
|
||||
// Get field dimensions from field descriptor.
|
||||
DimensionSet fieldDimension = fieldDescriptor_->dimensions();
|
||||
dictWriter.writeEntry("dimensions", fieldDimension);
|
||||
dictWriter.writeEndl();
|
||||
|
||||
// Write internal field and reference values.
|
||||
dictWriter.writeKeyword("internalField");
|
||||
internalFieldValue_->save(dictWriter, false);
|
||||
dictWriter.endEntry();
|
||||
dictWriter.writeEndl();
|
||||
|
||||
// Open boundary field sub-dictionary.
|
||||
dictWriter.startSubDict("boundaryField");
|
||||
|
||||
// Loop over all patchs.
|
||||
forAll(patchNames, i)
|
||||
{
|
||||
dictWriter.writeKeyword(patchNames[i]);
|
||||
|
||||
// Write value only.
|
||||
patchFields_[patchNames[i]]->save(dictWriter, false);
|
||||
dictWriter.writeEndl();
|
||||
|
||||
if (i < patchNames.size()-1)
|
||||
{
|
||||
dictWriter.writeEndl();
|
||||
}
|
||||
}
|
||||
|
||||
dictWriter.endSubDict();
|
||||
dictWriter.writeEndl();
|
||||
dictWriter.writeEndBar();
|
||||
}
|
||||
catch (FoamXError& ex)
|
||||
{
|
||||
// Save failed. Remove the duff file.
|
||||
if (exists(dictWriter.pathName()))
|
||||
{
|
||||
rm(dictWriter.pathName());
|
||||
}
|
||||
|
||||
// Bounce exception up to client.
|
||||
throw ex;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// Save failed. Remove the duff file.
|
||||
if (exists(dictWriter.pathName()))
|
||||
{
|
||||
rm(dictWriter.pathName());
|
||||
}
|
||||
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Unexpected error.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,161 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::IGeometricFieldDescriptorImpl
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
IGeometricFieldImpl.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef IGeometricFieldImpl_H
|
||||
#define IGeometricFieldImpl_H
|
||||
|
||||
// Foam header files.
|
||||
#include "fileName.H"
|
||||
#include "dictionary.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
#include "ObjRefHashTable.H"
|
||||
#include "DictionaryWriter.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
// Forward declaration of classes.
|
||||
class IDictionaryEntryImpl;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class IGeometricFieldImpl Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class IGeometricFieldImpl
|
||||
:
|
||||
public POA_FoamXServer::CaseServer::IGeometricField,
|
||||
public PortableServer::RefCountServantBase
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Field name. No, really.
|
||||
Foam::word fieldName_;
|
||||
|
||||
//- Reference to FoamProperties object. Used for patchField information.
|
||||
FoamXServer::CaseServer::IFoamProperties_var foamProperties_;
|
||||
|
||||
//- Reference to FieldDescriptor object.
|
||||
FoamXServer::CaseServer::IGeometricFieldDescriptor_var fieldDescriptor_;
|
||||
|
||||
//- Reference to internal field value object.
|
||||
IDictionaryEntryImpl* internalFieldValue_;
|
||||
|
||||
//- Map of patch name to patch field types.
|
||||
Foam::HashTable<Foam::word> patchFieldNames_;
|
||||
|
||||
//- Map of patch name to patch field parameter values.
|
||||
ObjRefHashTable<IDictionaryEntryImpl*> patchFields_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
IGeometricFieldImpl
|
||||
(
|
||||
FoamXServer::CaseServer::IGeometricFieldDescriptor_ptr
|
||||
fieldDescriptor,
|
||||
FoamXServer::CaseServer::IFoamProperties_ptr foamProperties
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~IGeometricFieldImpl();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual char* name();
|
||||
|
||||
virtual void getInternalFieldValue
|
||||
(
|
||||
FoamXServer::IDictionaryEntry_out internalFieldValue
|
||||
);
|
||||
|
||||
virtual void getPatchFieldParameters
|
||||
(
|
||||
const char* patchName,
|
||||
FoamXServer::IDictionaryEntry_out patchFieldParams
|
||||
);
|
||||
|
||||
|
||||
// Set patch field type for a particular patch.
|
||||
|
||||
virtual void addPatch
|
||||
(
|
||||
const char* patchName,
|
||||
const char* patchFieldType
|
||||
);
|
||||
|
||||
virtual void deletePatch(const char* patchName);
|
||||
|
||||
virtual void setPatchFieldType
|
||||
(
|
||||
const char* patchName,
|
||||
const char* patchFieldType
|
||||
);
|
||||
|
||||
|
||||
// Recursive state functions.
|
||||
|
||||
virtual CORBA::Boolean modified();
|
||||
|
||||
|
||||
// Persistence.
|
||||
|
||||
void load(const Foam::dictionary& fieldDict);
|
||||
|
||||
void save
|
||||
(
|
||||
DictionaryWriter& dictWriter,
|
||||
const Foam::wordList& patchNames
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,210 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
#include "IGeometryDescriptorImpl.H"
|
||||
#include "LogEntry.H"
|
||||
#include "Paths.H"
|
||||
|
||||
// Namespaces
|
||||
#include "FoamXNameSpaces.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::IGeometryDescriptorImpl::IGeometryDescriptorImpl
|
||||
(
|
||||
const word& geometryName
|
||||
)
|
||||
:
|
||||
name_(geometryName),
|
||||
displayName_(geometryName),
|
||||
description_(geometryName)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometryDescriptorImpl::IGeometryDescriptorImpl"
|
||||
"(const char* geometryName)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::IGeometryDescriptorImpl::IGeometryDescriptorImpl
|
||||
(
|
||||
const word& geometryName,
|
||||
const dictionary& outerDict
|
||||
)
|
||||
:
|
||||
name_(geometryName)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometryDescriptorImpl::IGeometryDescriptorImpl"
|
||||
"(const char* geometryName, dictionary& outerDict)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
// Make sure the dictionary contains the geometry definition.
|
||||
if (!outerDict.found(geometryName))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_FAIL,
|
||||
"Geometry definition dictionary '" + name_ + "' not found.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
const dictionary& geomDict(outerDict.subDict(geometryName));
|
||||
|
||||
// Check that the dictionary has the minimum required information.
|
||||
if
|
||||
(
|
||||
!geomDict.found("displayName")
|
||||
|| !geomDict.found("description"))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_FAIL,
|
||||
"Malformed geometry definition dictionary for geometry type '"
|
||||
+ name_ + "'.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
// Get the patch field properties.
|
||||
geomDict.lookup("displayName")>> displayName_;
|
||||
geomDict.lookup("description")>> description_;
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::IGeometryDescriptorImpl::~IGeometryDescriptorImpl()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometryDescriptorImpl::~IGeometryDescriptorImpl()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
char* FoamX::IGeometryDescriptorImpl::name()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometryDescriptorImpl::name()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
// Duplicate string and return.
|
||||
return CORBA::string_dup(name_.c_str());
|
||||
}
|
||||
|
||||
void FoamX::IGeometryDescriptorImpl::name(const char* newName)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometryDescriptorImpl::name(const char* newName)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
name_ = newName;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
char* FoamX::IGeometryDescriptorImpl::displayName()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometryDescriptorImpl::displayName()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
// Duplicate string and return.
|
||||
return CORBA::string_dup(displayName_.c_str());
|
||||
}
|
||||
|
||||
void FoamX::IGeometryDescriptorImpl::displayName(const char* newName)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometryDescriptorImpl::displayName(const char* newName)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
displayName_ = newName;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
char* FoamX::IGeometryDescriptorImpl::description()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometryDescriptorImpl::description()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
// Duplicate string and return.
|
||||
return CORBA::string_dup(description_.c_str());
|
||||
}
|
||||
|
||||
void FoamX::IGeometryDescriptorImpl::description(const char* newDescription)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometryDescriptorImpl::description"
|
||||
"(const char* newDescription)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
description_ = newDescription;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::IGeometryDescriptorImpl::save(DictionaryWriter& dict)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IGeometryDescriptorImpl::save(DictionaryWriter& dict)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
// Save this patch information to the dictionary.
|
||||
dict.startSubDict(name_);
|
||||
|
||||
dict.writeEntry("displayName", displayName_);
|
||||
dict.writeEntry("description", description_);
|
||||
|
||||
dict.endSubDict();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,112 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::IPatchDescriptorImpl
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
IGeometryDescriptorImpl.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef IGeometryDescriptorImpl_H
|
||||
#define IGeometryDescriptorImpl_H
|
||||
|
||||
// Foam header files.
|
||||
#include "word.H"
|
||||
#include "string.H"
|
||||
#include "dictionary.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
#include "DictionaryWriter.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class IGeometryDescriptorImpl Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class IGeometryDescriptorImpl
|
||||
:
|
||||
public POA_FoamXServer::CaseServer::IGeometryDescriptor,
|
||||
public PortableServer::RefCountServantBase
|
||||
{
|
||||
// Private data
|
||||
|
||||
Foam::word name_;
|
||||
Foam::string displayName_;
|
||||
Foam::string description_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
IGeometryDescriptorImpl(const word& geometryName);
|
||||
|
||||
IGeometryDescriptorImpl
|
||||
(
|
||||
const word& geometryName,
|
||||
const dictionary& outerDict
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~IGeometryDescriptorImpl();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Properties common to all types.
|
||||
|
||||
virtual char* name();
|
||||
virtual void name(const char*);
|
||||
virtual char* displayName();
|
||||
virtual void displayName(const char*);
|
||||
virtual char* description();
|
||||
virtual void description(const char*);
|
||||
|
||||
|
||||
//- Persist to file.
|
||||
void save(DictionaryWriter& dict);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,208 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
#include "IPatchDescriptorImpl.H"
|
||||
#include "ITypeDescriptorImpl.H"
|
||||
#include "LogEntry.H"
|
||||
#include "Paths.H"
|
||||
|
||||
// Namespaces
|
||||
#include "FoamXNameSpaces.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::IPatchDescriptorImpl::IPatchDescriptorImpl(const word& patchName)
|
||||
:
|
||||
name_(patchName),
|
||||
displayName_(patchName),
|
||||
description_(patchName)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchDescriptorImpl::IPatchDescriptorImpl"
|
||||
"(const char* patchName)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::IPatchDescriptorImpl::IPatchDescriptorImpl
|
||||
(
|
||||
const word& patchName,
|
||||
const dictionary& outerDict
|
||||
)
|
||||
:
|
||||
name_(patchName)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchDescriptorImpl::IPatchDescriptorImpl"
|
||||
"(const char* patchName, dictionary& outerDict)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
// Make sure the dictionary contains the patch field definition.
|
||||
if (!outerDict.found(patchName))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_FAIL,
|
||||
"Patch definition dictionary '" + name_ + "' not found.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
const dictionary& patchDict(outerDict.subDict(patchName));
|
||||
|
||||
// Check that the dictionary has the minimum required information.
|
||||
if
|
||||
(
|
||||
!patchDict.found("displayName")
|
||||
|| !patchDict.found("description")
|
||||
)
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_FAIL,
|
||||
"Malformed patch definition dictionary for patch type '"
|
||||
+ name_ + "'.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
// Get the patch field properties.
|
||||
patchDict.lookup("displayName")>> displayName_;
|
||||
patchDict.lookup("description")>> description_;
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::IPatchDescriptorImpl::~IPatchDescriptorImpl()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchDescriptorImpl::~IPatchDescriptorImpl()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
char* FoamX::IPatchDescriptorImpl::name()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchDescriptorImpl::name()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
// Duplicate string and return.
|
||||
return CORBA::string_dup(name_.c_str());
|
||||
}
|
||||
|
||||
void FoamX::IPatchDescriptorImpl::name(const char* newName)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchDescriptorImpl::name(const char* newName)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
name_ = newName;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
char* FoamX::IPatchDescriptorImpl::displayName()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchDescriptorImpl::displayName()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
// Duplicate string and return.
|
||||
return CORBA::string_dup(displayName_.c_str());
|
||||
}
|
||||
|
||||
void FoamX::IPatchDescriptorImpl::displayName(const char* newName)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchDescriptorImpl::displayName(const char* newName)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
displayName_ = newName;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
char* FoamX::IPatchDescriptorImpl::description()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchDescriptorImpl::description()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
// Duplicate string and return.
|
||||
return CORBA::string_dup(description_.c_str());
|
||||
}
|
||||
|
||||
void FoamX::IPatchDescriptorImpl::description(const char* newDescription)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchDescriptorImpl::description(const char* newDescription)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
description_ = newDescription;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::IPatchDescriptorImpl::save(DictionaryWriter& dict)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchDescriptorImpl::save(DictionaryWriter& dict)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
|
||||
// Save this patch information to the dictionary.
|
||||
dict.startSubDict(name_);
|
||||
|
||||
dict.writeEntry("displayName", displayName_);
|
||||
dict.writeEntry("description", description_);
|
||||
|
||||
dict.endSubDict();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,110 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::IPatchDescriptorImpl
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
IPatchDescriptorImpl.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef IPatchDescriptorImpl_H
|
||||
#define IPatchDescriptorImpl_H
|
||||
|
||||
// Foam header files.
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
#include "FoamXWordList.H"
|
||||
#include "DictionaryWriter.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class IPatchDescriptorImpl Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class IPatchDescriptorImpl
|
||||
:
|
||||
public POA_FoamXServer::CaseServer::IPatchDescriptor,
|
||||
public PortableServer::RefCountServantBase
|
||||
{
|
||||
// Private data
|
||||
|
||||
Foam::word name_;
|
||||
Foam::string displayName_;
|
||||
Foam::string description_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
IPatchDescriptorImpl(const word& patchName);
|
||||
|
||||
IPatchDescriptorImpl
|
||||
(
|
||||
const word& patchName,
|
||||
const Foam::dictionary& outerDict
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~IPatchDescriptorImpl();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Properties common to all types.
|
||||
|
||||
virtual char* name();
|
||||
virtual void name(const char*);
|
||||
virtual char* displayName();
|
||||
virtual void displayName(const char*);
|
||||
virtual char* description();
|
||||
virtual void description(const char*);
|
||||
|
||||
|
||||
//- Persist to file.
|
||||
void save(DictionaryWriter& dict);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,487 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// FoamX header files
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
#include "IPatchPhysicalTypeDescriptorImpl.H"
|
||||
#include "LogEntry.H"
|
||||
#include "Paths.H"
|
||||
|
||||
// Namespaces
|
||||
#include "FoamXNameSpaces.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::IPatchPhysicalTypeDescriptorImpl::IPatchPhysicalTypeDescriptorImpl
|
||||
(
|
||||
const word& patchPhysicalTypeName
|
||||
)
|
||||
:
|
||||
name_(patchPhysicalTypeName),
|
||||
displayName_(patchPhysicalTypeName),
|
||||
description_(patchPhysicalTypeName + " boundary condition"),
|
||||
patchType_("patch"),
|
||||
parentType_("")
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchPhysicalTypeDescriptorImpl::"
|
||||
"IPatchPhysicalTypeDescriptorImpl"
|
||||
"(const char* patchPhysicalTypeName)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::IPatchPhysicalTypeDescriptorImpl::IPatchPhysicalTypeDescriptorImpl
|
||||
(
|
||||
const word& patchPhysicalTypeName,
|
||||
const wordList& fieldList
|
||||
)
|
||||
:
|
||||
name_(patchPhysicalTypeName),
|
||||
displayName_(patchPhysicalTypeName),
|
||||
description_(patchPhysicalTypeName + " boundary condition"),
|
||||
patchType_(patchPhysicalTypeName),
|
||||
parentType_("")
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchPhysicalTypeDescriptorImpl::"
|
||||
"IPatchPhysicalTypeDescriptorImpl"
|
||||
"(const char* patchPhysicalTypeName, const wordList& fieldList)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
// Get list of fields
|
||||
patchFieldTypes_.length(fieldList.size());
|
||||
|
||||
// Loop over all defined fields and determine the patch field types
|
||||
for (int nField = 0; nField < fieldList.size(); nField++)
|
||||
{
|
||||
patchFieldTypes_[nField].name = fieldList[nField].c_str();
|
||||
patchFieldTypes_[nField].value = patchPhysicalTypeName.c_str();
|
||||
}
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
bool FoamX::IPatchPhysicalTypeDescriptorImpl::findParentPatchType
|
||||
(
|
||||
word& patchType,
|
||||
const word& parentType,
|
||||
const dictionary& patchPhysicalTypesDict
|
||||
) const
|
||||
{
|
||||
if (patchPhysicalTypesDict.found(parentType))
|
||||
{
|
||||
const dictionary& parentPatchPhysicalTypeDict =
|
||||
patchPhysicalTypesDict.subDict(parentType);
|
||||
|
||||
if (parentPatchPhysicalTypeDict.found("patchType"))
|
||||
{
|
||||
parentPatchPhysicalTypeDict.lookup("patchType") >> patchType;
|
||||
return true;
|
||||
}
|
||||
else if (parentPatchPhysicalTypeDict.found("parentType"))
|
||||
{
|
||||
return findParentPatchType
|
||||
(
|
||||
patchType,
|
||||
parentPatchPhysicalTypeDict.lookup("parentType"),
|
||||
patchPhysicalTypesDict
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool FoamX::IPatchPhysicalTypeDescriptorImpl::findPatchFieldType
|
||||
(
|
||||
word& patchFieldType,
|
||||
const word& parentType,
|
||||
const dictionary& patchPhysicalTypesDict,
|
||||
const dictionary& patchFieldPhysicalTypes
|
||||
) const
|
||||
{
|
||||
if (patchFieldPhysicalTypes.found(parentType))
|
||||
{
|
||||
patchFieldPhysicalTypes.lookup(parentType) >> patchFieldType;
|
||||
return true;
|
||||
}
|
||||
else if
|
||||
(
|
||||
patchPhysicalTypesDict.found(parentType)
|
||||
&& patchPhysicalTypesDict.subDict(parentType).found("parentType")
|
||||
)
|
||||
{
|
||||
return findPatchFieldType
|
||||
(
|
||||
patchFieldType,
|
||||
patchPhysicalTypesDict.subDict(parentType).lookup("parentType"),
|
||||
patchPhysicalTypesDict,
|
||||
patchFieldPhysicalTypes
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FoamX::IPatchPhysicalTypeDescriptorImpl::IPatchPhysicalTypeDescriptorImpl
|
||||
(
|
||||
const word& patchPhysicalTypeName,
|
||||
const dictionary& patchPhysicalTypeDict,
|
||||
const dictionary& patchPhysicalTypesDict,
|
||||
const dictionary& patchFieldsPhysicalTypesDict,
|
||||
const wordList& fieldList
|
||||
)
|
||||
:
|
||||
name_(patchPhysicalTypeName),
|
||||
displayName_(patchPhysicalTypeName),
|
||||
description_(patchPhysicalTypeName + " boundary condition"),
|
||||
patchType_("patch"),
|
||||
parentType_("")
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchPhysicalTypeDescriptorImpl::"
|
||||
"IPatchPhysicalTypeDescriptorImpl"
|
||||
"(const char* patchPhysicalTypeName, "
|
||||
"dictionary& patchPhysicalTypeDict, "
|
||||
"dictionary& patchFieldsPhysicalTypesDict, "
|
||||
"const wordList& fieldList)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
// Get the boundary type properties
|
||||
if (patchPhysicalTypeDict.found("displayName"))
|
||||
{
|
||||
patchPhysicalTypeDict.lookup("displayName") >> displayName_;
|
||||
}
|
||||
|
||||
if (patchPhysicalTypeDict.found("description"))
|
||||
{
|
||||
patchPhysicalTypeDict.lookup("description") >> description_;
|
||||
}
|
||||
|
||||
if (patchPhysicalTypeDict.found("patchType"))
|
||||
{
|
||||
patchPhysicalTypeDict.lookup("patchType") >> patchType_;
|
||||
}
|
||||
|
||||
// Get (optional) parent type
|
||||
if (patchPhysicalTypeDict.found("parentType"))
|
||||
{
|
||||
patchPhysicalTypeDict.lookup("parentType") >> parentType_;
|
||||
|
||||
findParentPatchType
|
||||
(
|
||||
patchType_,
|
||||
parentType_,
|
||||
patchPhysicalTypesDict
|
||||
);
|
||||
}
|
||||
|
||||
// Get list of fields
|
||||
patchFieldTypes_.length(fieldList.size());
|
||||
|
||||
// Loop over all defined fields and determine the patch field types
|
||||
for (int nField=0; nField<fieldList.size(); nField++)
|
||||
{
|
||||
// Make sure there is an entry for this field
|
||||
// in patchFieldsPhysicalTypesDict
|
||||
if (!patchFieldsPhysicalTypesDict.found(fieldList[nField]))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_FAIL,
|
||||
"Field '" + fieldList[nField]
|
||||
+ "' does not exist in patchFieldsPhysicalTypes dictionary.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
const dictionary& patchFieldPhysicalTypes
|
||||
= patchFieldsPhysicalTypesDict.subDict(fieldList[nField]);
|
||||
|
||||
word patchFieldType;
|
||||
|
||||
// Find the patchPhysicalType for this field in
|
||||
// patchFieldsPhysicalTypesDict hierachy
|
||||
if
|
||||
(
|
||||
findPatchFieldType
|
||||
(
|
||||
patchFieldType,
|
||||
patchPhysicalTypeName,
|
||||
patchPhysicalTypesDict,
|
||||
patchFieldPhysicalTypes
|
||||
)
|
||||
)
|
||||
{}
|
||||
else
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_FAIL,
|
||||
"Boundary type '" + patchPhysicalTypeName
|
||||
+ "' does not exist in patchFieldsPhysicalTypes dictionary "
|
||||
+ "for field '" + fieldList[nField] + "'.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
patchFieldTypes_[nField].name = fieldList[nField].c_str();
|
||||
patchFieldTypes_[nField].value = patchFieldType.c_str();
|
||||
}
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::IPatchPhysicalTypeDescriptorImpl::~IPatchPhysicalTypeDescriptorImpl()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchPhysicalTypeDescriptorImpl::"
|
||||
"~IPatchPhysicalTypeDescriptorImpl()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
char* FoamX::IPatchPhysicalTypeDescriptorImpl::name()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchPhysicalTypeDescriptorImpl::name()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
// Duplicate string and return
|
||||
return CORBA::string_dup(name_.c_str());
|
||||
}
|
||||
|
||||
void FoamX::IPatchPhysicalTypeDescriptorImpl::name(const char* newName)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchPhysicalTypeDescriptorImpl::name(const char* newName)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
name_ = newName;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
char* FoamX::IPatchPhysicalTypeDescriptorImpl::displayName()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchPhysicalTypeDescriptorImpl::displayName()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
// Duplicate string and return
|
||||
return CORBA::string_dup(displayName_.c_str());
|
||||
}
|
||||
|
||||
void FoamX::IPatchPhysicalTypeDescriptorImpl::displayName(const char* newName)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchPhysicalTypeDescriptorImpl::"
|
||||
"displayName(const char* newName)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
displayName_ = newName;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
char* FoamX::IPatchPhysicalTypeDescriptorImpl::description()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchPhysicalTypeDescriptorImpl::description()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
// Duplicate string and return
|
||||
return CORBA::string_dup(description_.c_str());
|
||||
}
|
||||
|
||||
void FoamX::IPatchPhysicalTypeDescriptorImpl::description
|
||||
(
|
||||
const char* newDescription
|
||||
)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchPhysicalTypeDescriptorImpl::description"
|
||||
"(const char* newDescription)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
description_ = newDescription;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
char* FoamX::IPatchPhysicalTypeDescriptorImpl::patchType()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchPhysicalTypeDescriptorImpl::patchType()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
// Duplicate string and return
|
||||
return CORBA::string_dup(patchType_.c_str());
|
||||
}
|
||||
|
||||
void FoamX::IPatchPhysicalTypeDescriptorImpl::patchType(const char* newName)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchPhysicalTypeDescriptorImpl::patchType"
|
||||
"(const char* newName)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
patchType_ = newName;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
char* FoamX::IPatchPhysicalTypeDescriptorImpl::parentType()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchPhysicalTypeDescriptorImpl::parentType()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
// Duplicate string and return
|
||||
return CORBA::string_dup(parentType_.c_str());
|
||||
}
|
||||
|
||||
void FoamX::IPatchPhysicalTypeDescriptorImpl::parentType(const char* newName)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchPhysicalTypeDescriptorImpl::parentType"
|
||||
"(const char* newName)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
parentType_ = newName;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamXServer::StringPairList*
|
||||
FoamX::IPatchPhysicalTypeDescriptorImpl::patchFieldTypes()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchPhysicalTypeDescriptorImpl::patchFieldTypes()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
// Duplicate list and return
|
||||
return new StringPairList(patchFieldTypes_);
|
||||
}
|
||||
|
||||
void FoamX::IPatchPhysicalTypeDescriptorImpl::patchFieldTypes
|
||||
(
|
||||
const FoamXServer::StringPairList& newList
|
||||
)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchPhysicalTypeDescriptorImpl::patchFieldTypes";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
patchFieldTypes_ = newList;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::IPatchPhysicalTypeDescriptorImpl::save
|
||||
(
|
||||
DictionaryWriter& dictWriter
|
||||
)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::IPatchPhysicalTypeDescriptorImpl::save"
|
||||
"(DictionaryWriter& dictWriter)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
// Save the boundary type information to a sub-dictionary
|
||||
dictWriter.startSubDict(name_);
|
||||
|
||||
dictWriter.writeEntry("displayName", displayName_);
|
||||
dictWriter.writeEntry("description", description_);
|
||||
dictWriter.writeEntry("patchType", patchType_);
|
||||
|
||||
// Only write the parent type if it has been set
|
||||
if (parentType_.size() > 0)
|
||||
{
|
||||
dictWriter.writeEntry("parentType", parentType_);
|
||||
}
|
||||
|
||||
// Write the patch field types
|
||||
for (unsigned int i=0; i<patchFieldTypes_.length(); i++)
|
||||
{
|
||||
dictWriter.writeEntry
|
||||
(
|
||||
word(patchFieldTypes_[i].name),
|
||||
word(patchFieldTypes_[i].value)
|
||||
);
|
||||
}
|
||||
|
||||
dictWriter.endSubDict();
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,162 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::IPatchPhysicalTypeDescriptorImpl
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
IPatchPhysicalTypeDescriptorImpl.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef IPatchPhysicalTypeDescriptorImpl_H
|
||||
#define IPatchPhysicalTypeDescriptorImpl_H
|
||||
|
||||
// Foam header files.
|
||||
#include "IDLList.H"
|
||||
#include "dictionary.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "DictionaryWriter.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class IPatchPhysicalTypeDescriptorImpl Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class IPatchPhysicalTypeDescriptorImpl
|
||||
:
|
||||
public POA_FoamXServer::CaseServer::IPatchPhysicalTypeDescriptor,
|
||||
public PortableServer::RefCountServantBase,
|
||||
public IDLList<IPatchPhysicalTypeDescriptorImpl>::link
|
||||
{
|
||||
// Private data
|
||||
|
||||
Foam::word name_;
|
||||
Foam::string displayName_;
|
||||
Foam::string description_;
|
||||
Foam::word patchType_;
|
||||
Foam::word parentType_;
|
||||
FoamXServer::StringPairList patchFieldTypes_;
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Search back through the parentTypes to find the patchPhysicalType
|
||||
// for which the patchType is defined
|
||||
bool findParentPatchType
|
||||
(
|
||||
word& patchType,
|
||||
const word& parentType,
|
||||
const dictionary& patchPhysicalTypesDict
|
||||
) const;
|
||||
|
||||
//- Search back through the parentTypes to find the patchPhysicalType
|
||||
// for which this boundary condition for this field is defined
|
||||
bool findPatchFieldType
|
||||
(
|
||||
word& patchFieldType,
|
||||
const word& parentType,
|
||||
const dictionary& patchPhysicalTypesDict,
|
||||
const dictionary& patchFieldPhysicalTypes
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
IPatchPhysicalTypeDescriptorImpl
|
||||
(
|
||||
const word& patchPhysicalTypeName
|
||||
);
|
||||
|
||||
IPatchPhysicalTypeDescriptorImpl
|
||||
(
|
||||
const word& patchPhysicalTypeName,
|
||||
const Foam::wordList& fieldList
|
||||
);
|
||||
|
||||
IPatchPhysicalTypeDescriptorImpl
|
||||
(
|
||||
const word& patchPhysicalTypeName,
|
||||
const Foam::dictionary& patchPhysicalTypes,
|
||||
const dictionary& patchPhysicalTypesDict,
|
||||
const Foam::dictionary& patchFieldsPhysicalTypesDict,
|
||||
const Foam::wordList& fieldList
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~IPatchPhysicalTypeDescriptorImpl();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Foam access functions
|
||||
|
||||
//- Keyword used by Dictionary
|
||||
const word& keyword() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
|
||||
// FoamServer access functions
|
||||
|
||||
virtual char* name();
|
||||
virtual void name(const char*);
|
||||
virtual char* displayName();
|
||||
virtual void displayName(const char*);
|
||||
virtual char* description();
|
||||
virtual void description(const char*);
|
||||
virtual char* patchType();
|
||||
virtual void patchType(const char*);
|
||||
virtual char* parentType();
|
||||
virtual void parentType(const char*);
|
||||
virtual FoamXServer::StringPairList* patchFieldTypes();
|
||||
virtual void patchFieldTypes(const FoamXServer::StringPairList&);
|
||||
|
||||
//- Persist to file.
|
||||
void save(DictionaryWriter& dict);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,310 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::IPropertiesImpl
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
IPropertiesImpl.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef IPropertiesImpl_H
|
||||
#define IPropertiesImpl_H
|
||||
|
||||
// Foam header files.
|
||||
#include "HashPtrTable.H"
|
||||
#include "dictionary.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
#include "ObjRefHashTable.H"
|
||||
#include "FoamXWordList.H"
|
||||
#include "FoamXFileNameList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
// Forward declaration of classes.
|
||||
class IApplicationImpl;
|
||||
class ITypeDescriptorImpl;
|
||||
class IGeometryDescriptorImpl;
|
||||
class IPatchDescriptorImpl;
|
||||
class ITypeDescriptorImpl;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class className Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class IPropertiesImpl
|
||||
:
|
||||
public POA_FoamXServer::CaseServer::IFoamProperties,
|
||||
public PortableServer::RefCountServantBase
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Allow or disallow editing.
|
||||
bool readOnly_;
|
||||
|
||||
//- Available FoamX modules.
|
||||
FoamXWordList availableModules_;
|
||||
|
||||
//- Root directories for cases (as read in)
|
||||
FoamXFileNameList rawRootDirectories_;
|
||||
|
||||
//- Root directories for cases (after expansion)
|
||||
FoamXFileNameList rootDirectories_;
|
||||
|
||||
//- Available foam types dictionary.
|
||||
Foam::dictionary foamTypesDict_;
|
||||
|
||||
//- Defined application class descriptors.
|
||||
Foam::HashPtrTable<FoamXServer::ApplicationDescriptor>
|
||||
appDescriptorMap_;
|
||||
|
||||
//- Foam utility descriptor map.
|
||||
Foam::HashPtrTable<FoamXServer::ApplicationDescriptor>
|
||||
utilityDescriptorMap_;
|
||||
|
||||
//- Map of (created on demand) Application Class objects.
|
||||
ObjRefHashTable<IApplicationImpl*> appMap_;
|
||||
|
||||
//- Map of Foam Type Descriptor objects.
|
||||
ObjRefHashTable<ITypeDescriptorImpl*> foamTypeMap_;
|
||||
|
||||
//- Map of Geometry Type Descriptor objects.
|
||||
ObjRefHashTable<IGeometryDescriptorImpl*> geometryTypeMap_;
|
||||
|
||||
//- Map of Patch Descriptor objects.
|
||||
ObjRefHashTable<IPatchDescriptorImpl*> patchMap_;
|
||||
|
||||
//- Map of Patch Field Descriptor objects.
|
||||
ObjRefHashTable<ITypeDescriptorImpl*> patchFieldMap_;
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
||||
FoamXServer::ApplicationDescriptor* readApplicationDescriptor
|
||||
(
|
||||
const Foam::word& name,
|
||||
const Foam::fileName& category,
|
||||
const Foam::fileName& path,
|
||||
const bool systemClass
|
||||
);
|
||||
|
||||
void readApplicationDescriptors
|
||||
(
|
||||
Foam::HashPtrTable<FoamXServer::ApplicationDescriptor>&
|
||||
appDescriptorsMap,
|
||||
const Foam::fileName& dir,
|
||||
const Foam::fileName& category,
|
||||
const bool systemClass
|
||||
);
|
||||
|
||||
void addPatchFields(const Foam::dictionary& patchFieldDict);
|
||||
|
||||
IPropertiesImpl(const IPropertiesImpl&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
friend class IApplicationImpl;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
IPropertiesImpl(bool readOnly = true);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~IPropertiesImpl();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
const Foam::dictionary& foamTypesDict() const
|
||||
{
|
||||
return foamTypesDict_;
|
||||
}
|
||||
|
||||
const ObjRefHashTable<ITypeDescriptorImpl*>& foamTypes() const
|
||||
{
|
||||
return foamTypeMap_;
|
||||
}
|
||||
|
||||
const ObjRefHashTable<IGeometryDescriptorImpl*>&
|
||||
geometryDescriptors() const
|
||||
{
|
||||
return geometryTypeMap_;
|
||||
}
|
||||
|
||||
|
||||
//- Installed FoamX modules.
|
||||
virtual FoamXServer::StringList* availableModules();
|
||||
|
||||
|
||||
// Case root directories.
|
||||
|
||||
virtual FoamXServer::StringList* rootDirectories();
|
||||
virtual FoamXServer::StringList* rawRootDirectories();
|
||||
|
||||
virtual void addRootDirectory(const char* rootDir);
|
||||
|
||||
virtual void deleteRootDirectory(const char* rootDir);
|
||||
|
||||
|
||||
// Foam types.
|
||||
|
||||
virtual FoamXServer::StringList* foamTypes();
|
||||
|
||||
virtual void getFoamType
|
||||
(
|
||||
const char* foamTypeKey,
|
||||
FoamXServer::ITypeDescriptor_out typeDesc
|
||||
);
|
||||
|
||||
|
||||
// Geometry types.
|
||||
|
||||
virtual FoamXServer::StringList* geometryTypes();
|
||||
|
||||
virtual void getGeometryType
|
||||
(
|
||||
const char* geometryTypeKey,
|
||||
FoamXServer::CaseServer::IGeometryDescriptor_out
|
||||
geometryDesc
|
||||
);
|
||||
|
||||
|
||||
// Patch types.
|
||||
|
||||
virtual FoamXServer::StringList* patchTypes();
|
||||
|
||||
virtual void getPatchType
|
||||
(
|
||||
const char* patchTypeKey,
|
||||
FoamXServer::CaseServer::IPatchDescriptor_out
|
||||
patchDesc
|
||||
);
|
||||
|
||||
virtual void findPatchType
|
||||
(
|
||||
const char* patchTypeName,
|
||||
FoamXServer::CaseServer::IPatchDescriptor_out
|
||||
patchDesc
|
||||
);
|
||||
|
||||
|
||||
// Patch field types.
|
||||
|
||||
virtual FoamXServer::StringList* patchFieldTypes();
|
||||
|
||||
virtual void getPatchFieldType
|
||||
(
|
||||
const char* patchFieldTypeKey,
|
||||
FoamXServer::ITypeDescriptor_out patchFieldDesc
|
||||
);
|
||||
|
||||
virtual void findPatchFieldType
|
||||
(
|
||||
const char* patchFieldTypeName,
|
||||
FoamXServer::ITypeDescriptor_out patchFieldDesc
|
||||
);
|
||||
|
||||
|
||||
// Foam controlDict
|
||||
|
||||
virtual void getFoamControlDict
|
||||
(
|
||||
FoamXServer::IDictionaryEntry_out controlDict
|
||||
);
|
||||
|
||||
// Application classes.
|
||||
|
||||
virtual FoamXServer::ApplicationDescriptorList*
|
||||
applicationes();
|
||||
|
||||
virtual void getApplication
|
||||
(
|
||||
const char* appKey,
|
||||
FoamXServer::CaseServer::IApplication_out app
|
||||
);
|
||||
|
||||
virtual void addApplication
|
||||
(
|
||||
const char* appKey,
|
||||
FoamXServer::CaseServer::IApplication_out app
|
||||
);
|
||||
|
||||
virtual void deleteApplication(const char* appKey);
|
||||
|
||||
virtual void cloneApplication
|
||||
(
|
||||
const char* appKeySrc,
|
||||
const char* appKeyDest,
|
||||
const char* appDestPath,
|
||||
FoamXServer::CaseServer::IApplication_out app
|
||||
);
|
||||
|
||||
|
||||
// Foam utilities.
|
||||
|
||||
virtual FoamXServer::ApplicationDescriptorList* utilities();
|
||||
|
||||
virtual void getUtilityControlDict
|
||||
(
|
||||
const char* utilityName,
|
||||
const char* rootDir,
|
||||
const char* caseName,
|
||||
FoamXServer::IDictionaryEntry_out controlDict
|
||||
);
|
||||
|
||||
|
||||
//- Validation.
|
||||
virtual void validate();
|
||||
|
||||
|
||||
// Persistence.
|
||||
|
||||
virtual void saveSystemProperties();
|
||||
|
||||
virtual void saveUserProperties();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,347 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::ITypeDescriptorImpl
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
ITypeDescriptorImpl.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef ITypeDescriptorImpl_H
|
||||
#define ITypeDescriptorImpl_H
|
||||
|
||||
// Foam header files.
|
||||
#include "IDLList.H"
|
||||
#include "DLList.H"
|
||||
#include "dictionary.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
#include "FoamXAny.H"
|
||||
#include "IDictionaryEntryImpl.H"
|
||||
#include "FoamXWordList.H"
|
||||
#include "FoamXTypes.H"
|
||||
#include "DictionaryWriter.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class ITypeDescriptorImpl Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class ITypeDescriptorImpl
|
||||
:
|
||||
public POA_FoamXServer::ITypeDescriptor,
|
||||
public PortableServer::RefCountServantBase,
|
||||
public IDLList<ITypeDescriptorImpl>::link
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- The type of this parameter.
|
||||
FoamXServer::FoamXType type_;
|
||||
|
||||
//- Foam parameter name.
|
||||
Foam::word name_;
|
||||
|
||||
//- Path of this parameter relative to root dictionary.
|
||||
Foam::string path_;
|
||||
|
||||
//- Short display name.
|
||||
Foam::string displayName_;
|
||||
|
||||
//- Long descriptive name.
|
||||
Foam::string description_;
|
||||
|
||||
//- Dictionary comment.
|
||||
Foam::string comment_;
|
||||
|
||||
//- GUI category for this parameter.
|
||||
Foam::string category_;
|
||||
|
||||
//- URL to relevant help file.
|
||||
Foam::string helpURL_;
|
||||
|
||||
//- URL to a nice icon for this parameter.
|
||||
Foam::string iconURL_;
|
||||
|
||||
//- Flag indicating whether this parameter is optional.
|
||||
// Defaults to false.
|
||||
bool optional_;
|
||||
|
||||
//- Flag indicating whether this parameter is visible within FoamX.
|
||||
// Defaults to true.
|
||||
bool visible_;
|
||||
|
||||
//- Flag indicating whether this parameter is editable within FoamX.
|
||||
// Defaults to true.
|
||||
bool editable_;
|
||||
|
||||
//- Minimum value for this parameter.
|
||||
FoamXAny minValue_;
|
||||
|
||||
//- Maximum value for this parameter.
|
||||
FoamXAny maxValue_;
|
||||
|
||||
//- Name of dictionary to use as a lookup table.
|
||||
FoamXAnyList valueList_;
|
||||
|
||||
//- List of permissible values for this parameter.
|
||||
Foam::string lookupDict_;
|
||||
|
||||
//- Top-level dictionary location relative to case root.
|
||||
Foam::string dictionaryPath_;
|
||||
|
||||
//- Number of vector space elements.
|
||||
Foam::label numElements_;
|
||||
|
||||
//- Labels of vector space elements (eg, x, y, z).
|
||||
FoamXWordList elementLabels_;
|
||||
|
||||
//- Doubly linked list of sub-type objects. Used to maintain the order
|
||||
// of sub-types.
|
||||
Foam::DLList<ITypeDescriptorImpl*> subTypes_;
|
||||
|
||||
//- Default value for this parameter.
|
||||
IDictionaryEntryImpl* default_;
|
||||
|
||||
|
||||
// Private member functions.
|
||||
|
||||
bool setType(const Foam::word& type);
|
||||
|
||||
void resolveType
|
||||
(
|
||||
Foam::word& type,
|
||||
const Foam::dictionary& typeDict,
|
||||
const Foam::dictionary& foamTypesDict
|
||||
);
|
||||
|
||||
void resolveTypeDict
|
||||
(
|
||||
Foam::word& type,
|
||||
const Foam::dictionary& typeDict,
|
||||
const Foam::dictionary& foamTypesDict
|
||||
);
|
||||
|
||||
void readType
|
||||
(
|
||||
Foam::word& type,
|
||||
const Foam::dictionary& typeDict,
|
||||
const Foam::dictionary& foamTypesDict
|
||||
);
|
||||
|
||||
void addEntries
|
||||
(
|
||||
const Foam::dictionary& typeDict,
|
||||
const Foam::dictionary& foamTypesDict
|
||||
);
|
||||
|
||||
void addDictionaryEntries
|
||||
(
|
||||
const Foam::dictionary& typeDict,
|
||||
const Foam::dictionary& foamTypesDict
|
||||
);
|
||||
|
||||
void addCompoundEntries
|
||||
(
|
||||
const Foam::dictionary& typeDict,
|
||||
const Foam::dictionary& foamTypesDict
|
||||
);
|
||||
|
||||
void addElementType
|
||||
(
|
||||
const Foam::dictionary& typeDict,
|
||||
const Foam::dictionary& foamTypesDict
|
||||
);
|
||||
|
||||
void readOptionalData
|
||||
(
|
||||
const Foam::dictionary& typeDict
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
ITypeDescriptorImpl
|
||||
(
|
||||
const Foam::word& name,
|
||||
const FoamXServer::FoamXType& type,
|
||||
const Foam::string& parentPath
|
||||
);
|
||||
|
||||
ITypeDescriptorImpl
|
||||
(
|
||||
const Foam::word& name,
|
||||
const Foam::string& parentPath,
|
||||
const Foam::dictionary& typeDict,
|
||||
const Foam::dictionary& foamTypesDict
|
||||
);
|
||||
|
||||
ITypeDescriptorImpl
|
||||
(
|
||||
const Foam::word& name,
|
||||
const Foam::string& parentPath,
|
||||
const Foam::entry& typeEntry,
|
||||
const Foam::dictionary& foamTypesDict
|
||||
);
|
||||
|
||||
ITypeDescriptorImpl
|
||||
(
|
||||
FoamXServer::ITypeDescriptor_ptr typeDesc
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~ITypeDescriptorImpl();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Foam access functions
|
||||
|
||||
//- Keyword used by Dictionary
|
||||
const word& keyword() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
|
||||
// FoamServer access functions
|
||||
|
||||
virtual FoamXServer::FoamXType type();
|
||||
virtual void type(FoamXServer::FoamXType);
|
||||
virtual char* path();
|
||||
virtual void path(const char*);
|
||||
virtual char* name();
|
||||
virtual void name(const char*);
|
||||
virtual char* displayName();
|
||||
virtual void displayName(const char*);
|
||||
virtual char* description();
|
||||
virtual void description(const char*);
|
||||
virtual char* comment();
|
||||
virtual void comment(const char*);
|
||||
virtual char* category();
|
||||
virtual void category(const char*);
|
||||
virtual char* helpURL();
|
||||
virtual void helpURL(const char*);
|
||||
virtual char* iconURL();
|
||||
virtual void iconURL(const char*);
|
||||
virtual CORBA::Boolean isPrimitiveType();
|
||||
virtual CORBA::Boolean isCompoundType();
|
||||
virtual CORBA::Boolean optional();
|
||||
virtual void optional(CORBA::Boolean);
|
||||
virtual CORBA::Boolean visible();
|
||||
virtual void visible(CORBA::Boolean);
|
||||
virtual CORBA::Boolean editable();
|
||||
virtual void editable(CORBA::Boolean);
|
||||
|
||||
|
||||
// Properties for non-compound types.
|
||||
|
||||
virtual FoamXServer::FoamXAny* minValue();
|
||||
virtual void minValue(const FoamXServer::FoamXAny&);
|
||||
virtual FoamXServer::FoamXAny* maxValue();
|
||||
virtual void maxValue(const FoamXServer::FoamXAny&);
|
||||
virtual FoamXServer::FoamXAnyList* valueList();
|
||||
virtual void valueList(const FoamXServer::FoamXAnyList&);
|
||||
virtual char* lookupDict();
|
||||
virtual void lookupDict(const char*);
|
||||
|
||||
|
||||
// Properties for compound types.
|
||||
|
||||
virtual char* dictionaryPath();
|
||||
virtual void dictionaryPath(const char*);
|
||||
virtual CORBA::Long numElements();
|
||||
virtual void numElements(CORBA::Long);
|
||||
virtual FoamXServer::StringList* elementLabels();
|
||||
virtual void elementLabels(const FoamXServer::StringList&);
|
||||
virtual FoamXServer::TypeDescriptorList* subTypes();
|
||||
virtual FoamXServer::ITypeDescriptor_ptr elementType();
|
||||
|
||||
|
||||
// Default handling
|
||||
|
||||
virtual CORBA::Boolean hasDefaultValue();
|
||||
|
||||
virtual void getDefaultValue
|
||||
(
|
||||
FoamXServer::IDictionaryEntry_out defaultValue
|
||||
);
|
||||
|
||||
|
||||
// Compound sub-type methods.
|
||||
|
||||
virtual void addSubType
|
||||
(
|
||||
FoamXServer::FoamXType type,
|
||||
FoamXServer::ITypeDescriptor_out subEntry
|
||||
);
|
||||
|
||||
virtual void removeSubType
|
||||
(
|
||||
FoamXServer::ITypeDescriptor_ptr subEntry
|
||||
);
|
||||
|
||||
|
||||
//- Validation.
|
||||
virtual void validate();
|
||||
|
||||
|
||||
// Persistence.
|
||||
|
||||
void load
|
||||
(
|
||||
const Foam::dictionary& typeDict,
|
||||
const Foam::dictionary& foamTypesDict
|
||||
);
|
||||
|
||||
void save
|
||||
(
|
||||
DictionaryWriter& dictWriter,
|
||||
bool topLevelDict
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,130 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// Project header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
#include "LogManager.H"
|
||||
#include "LogEntry.H"
|
||||
#include "Pstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::LogEntry::LogEntry
|
||||
(
|
||||
const char* methodName,
|
||||
const char* fileName,
|
||||
const int lineNo
|
||||
)
|
||||
:
|
||||
logManagerPtr_(NULL),
|
||||
lineNo_(-1)
|
||||
{
|
||||
if (!Pstream::parRun() || Pstream::master())
|
||||
{
|
||||
// Get global log manager, if available.
|
||||
logManagerPtr_ = LogManager::GlobalLogManager();
|
||||
|
||||
if (logManagerPtr_)
|
||||
{
|
||||
methodName_ = methodName;
|
||||
//methodName_.replaceAll("&", "&");
|
||||
methodName_.replaceAll("&", "");
|
||||
|
||||
fileName_ = fileName;
|
||||
lineNo_ = lineNo;
|
||||
logManagerPtr_->startLogEntry(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::LogEntry::~LogEntry()
|
||||
{
|
||||
if (logManagerPtr_)
|
||||
{
|
||||
logManagerPtr_->endLogEntry();
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::LogEntry::writeStart(Ostream& os) const
|
||||
{
|
||||
static const char* functionName =
|
||||
"LogEntry::writeStart(Ostream&) const";
|
||||
|
||||
try
|
||||
{
|
||||
// Write opening tag.
|
||||
os << "<FunctionCall>" << endl;
|
||||
os << " <MethodName>" << methodName_ << "</MethodName>" << endl;
|
||||
|
||||
if (fileName_.size() > 0)
|
||||
{
|
||||
os << " <FileName>" << fileName_ << "</FileName>" << endl;
|
||||
}
|
||||
|
||||
if (lineNo_ > -1)
|
||||
{
|
||||
os << " <LineNo>" << lineNo_ << "</LineNo>" << endl;
|
||||
}
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::LogEntry::writeEnd(Ostream& os) const
|
||||
{
|
||||
static const char* functionName =
|
||||
"LogEntry::writeEnd(Ostream&) const";
|
||||
|
||||
try
|
||||
{
|
||||
// Write closing tag.
|
||||
os << "</FunctionCall>" << endl;
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::LogEntry::operator Foam::OSstream&()
|
||||
{
|
||||
if (logManagerPtr_)
|
||||
{
|
||||
return *logManagerPtr_;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Snull;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,102 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::LogManager
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
LogEntry.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef LogEntry_H
|
||||
#define LogEntry_H
|
||||
|
||||
// Foam header files.
|
||||
#include "label.H"
|
||||
#include "word.H"
|
||||
#include "fileName.H"
|
||||
#include "OSstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class LogManager;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class LogEntry Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class LogEntry
|
||||
{
|
||||
// Private data
|
||||
|
||||
LogManager* logManagerPtr_;
|
||||
string methodName_;
|
||||
fileName fileName_;
|
||||
label lineNo_;
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
LogEntry
|
||||
(
|
||||
const char* methodName,
|
||||
const char* fileName,
|
||||
const int lineNo
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~LogEntry();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
void writeStart(Ostream&) const;
|
||||
|
||||
void writeEnd(Ostream&) const;
|
||||
|
||||
//- Convert to Ostream
|
||||
// Prints basic message and then returns Ostream for further info.
|
||||
operator OSstream&();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,199 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// Foam header files.
|
||||
#include "OSspecific.H"
|
||||
|
||||
// Project header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
#include "LogManager.H"
|
||||
#include "LogEntry.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::LogManager* Foam::LogManager::pLogManager_ = NULL;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::LogManager::LogManager(const Foam::fileName& logFile)
|
||||
:
|
||||
infoOpen_(false)
|
||||
{
|
||||
static const char* functionName =
|
||||
"LogManager::LogManager(const Foam::fileName&)";
|
||||
|
||||
try
|
||||
{
|
||||
// Check that there isn't already a global log manager object.
|
||||
if
|
||||
(
|
||||
FoamX::FoamXError::debug && Foam::LogManager::pLogManager_ == NULL
|
||||
)
|
||||
{
|
||||
Foam::LogManager::pLogManager_ = this;
|
||||
|
||||
// Make sure the path exists.
|
||||
if (!dir(logFile.path()) && !mkDir(logFile.path()))
|
||||
{
|
||||
throw FoamX::FoamXError
|
||||
(
|
||||
FoamXServer::E_FAIL,
|
||||
"Log file directory '" + logFile.path()
|
||||
+ "' could not be created.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
// Open the file stream.
|
||||
pFileStream_ = new Foam::OFstream(logFile);
|
||||
|
||||
// Write XML header.
|
||||
(*pFileStream_) << "<?xml version=\"1.0\" ?>\n" << endl;
|
||||
}
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::LogManager::~LogManager()
|
||||
{
|
||||
if (Foam::LogManager::pLogManager_ == this)
|
||||
{
|
||||
Foam::LogManager::pLogManager_ = NULL;
|
||||
|
||||
if (pFileStream_ != NULL)
|
||||
{
|
||||
delete pFileStream_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::LogManager* Foam::LogManager::GlobalLogManager()
|
||||
{
|
||||
return pLogManager_;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::LogManager::startLogEntry(const LogEntry* pLogEntry)
|
||||
{
|
||||
static const char* functionName =
|
||||
"LogManager::startLogEntry(const LogEntry*)";
|
||||
|
||||
try
|
||||
{
|
||||
if (infoOpen_)
|
||||
{
|
||||
endInfoEntry();
|
||||
}
|
||||
|
||||
// Push new entry onto stack.
|
||||
entryStack_.push(pLogEntry);
|
||||
|
||||
pLogEntry->writeStart((*pFileStream_));
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::LogManager::endLogEntry()
|
||||
{
|
||||
static const char* functionName = "LogManager::endLogEntry()";
|
||||
|
||||
try
|
||||
{
|
||||
if (infoOpen_)
|
||||
{
|
||||
endInfoEntry();
|
||||
}
|
||||
|
||||
// Pop the current entry off the stack.
|
||||
const LogEntry* pLogEntry = entryStack_.top();
|
||||
entryStack_.pop();
|
||||
|
||||
pLogEntry->writeEnd((*pFileStream_));
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::LogManager::startInfoEntry()
|
||||
{
|
||||
static const char* functionName =
|
||||
"LogManager::startInfoEntry()";
|
||||
|
||||
try
|
||||
{
|
||||
if (infoOpen_)
|
||||
{
|
||||
endInfoEntry();
|
||||
}
|
||||
|
||||
*pFileStream_ << " <FoamXInfo>" << endl;
|
||||
infoOpen_ = true;
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::LogManager::endInfoEntry()
|
||||
{
|
||||
static const char* functionName =
|
||||
"LogManager::endInfoEntry()";
|
||||
|
||||
try
|
||||
{
|
||||
*pFileStream_ << " </FoamXInfo>" << endl;
|
||||
infoOpen_ = false;
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::LogManager::operator Foam::OSstream&()
|
||||
{
|
||||
static const char* functionName =
|
||||
"LogManager::operator Foam::OSstream&()";
|
||||
|
||||
try
|
||||
{
|
||||
startInfoEntry();
|
||||
return *pFileStream_;
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,121 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::LogManager
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
LogManager.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef LogManager_H
|
||||
#define LogManager_H
|
||||
|
||||
// Foam header files.
|
||||
#include "LIFOStack.H"
|
||||
#include "fileName.H"
|
||||
#include "OFstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes.
|
||||
class LogEntry;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class LogManager Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class LogManager
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
enum LogFilter
|
||||
{
|
||||
LOG_DEBUG,
|
||||
LOG_DIAGNOSTIC,
|
||||
LOG_WARNINGS,
|
||||
LOG_ERRORS
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
static LogManager* pLogManager_;
|
||||
LogFilter filter_;
|
||||
OFstream* pFileStream_;
|
||||
LIFOStack<const LogEntry*> entryStack_;
|
||||
bool infoOpen_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
LogManager(const fileName& logFile);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~LogManager();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Access to the global log manager.
|
||||
static LogManager* GlobalLogManager();
|
||||
|
||||
|
||||
// Log entry methods.
|
||||
|
||||
void startLogEntry(const LogEntry* pLogEntry);
|
||||
void endLogEntry();
|
||||
|
||||
void startInfoEntry();
|
||||
void endInfoEntry();
|
||||
|
||||
|
||||
//- Convert to Ostream
|
||||
// Prints basic message and then returns Ostream for further info.
|
||||
operator OSstream&();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,31 +0,0 @@
|
||||
FoamXErrors.C
|
||||
FoamXString.C
|
||||
FoamXStringList.C
|
||||
FoamXWordList.C
|
||||
FoamXFileNameList.C
|
||||
|
||||
LogManager.C
|
||||
LogEntry.C
|
||||
|
||||
Paths.C
|
||||
Orb.C
|
||||
FoamXTypes.C
|
||||
FoamXAny.C
|
||||
DimensionSet.C
|
||||
DictionaryWriter.C
|
||||
ProcessControl.C
|
||||
NameServer.C
|
||||
PatchProperties.C
|
||||
RootDictionary.C
|
||||
|
||||
IPropertiesImpl.C
|
||||
IApplicationImpl.C
|
||||
ITypeDescriptorImpl.C
|
||||
IDictionaryEntryImpl.C
|
||||
IGeometryDescriptorImpl.C
|
||||
IPatchDescriptorImpl.C
|
||||
IPatchPhysicalTypeDescriptorImpl.C
|
||||
IGeometricFieldDescriptorImpl.C
|
||||
IGeometricFieldImpl.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libFoamX
|
||||
@ -1,43 +0,0 @@
|
||||
OMNI_LIB_EXT =
|
||||
|
||||
#if defined(linux)
|
||||
|
||||
OMNI_SYS_INC = -D__x86__ -D__linux__ -D__OSVERSION__=2
|
||||
|
||||
#elif defined(solaris)
|
||||
|
||||
OMNI_SYS_INC = -D__sparc__ -D__sunos__ -D__OSVERSION__=5
|
||||
|
||||
#elif defined(sgiN32) || defined(sgi64)
|
||||
|
||||
OMNI_SYS_INC = -D__mips__ -D__irix__ -D__OSVERSION__=6
|
||||
|
||||
#elif defined(decAlpha)
|
||||
|
||||
# error DEC not supported for compiling FoamX
|
||||
|
||||
#elif defined(ibm)
|
||||
|
||||
OMNI_SYS_INC = -D__aix__ -D__powerpc__ -D__OSVERSION__=4
|
||||
OMNI_LIB_EXT = -ar
|
||||
|
||||
#else
|
||||
|
||||
# error architecture not supported for compiling FoamX
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
OMNI_INC = \
|
||||
-D__OMNIORB3__ -D_REENTRANT \
|
||||
-I$(OMNI_PATH)/include \
|
||||
$(OMNI_SYS_INC)
|
||||
|
||||
OMNI_LIBS = \
|
||||
-L$(OMNI_PATH)/lib/$(OMNI_ARCH) \
|
||||
-lomniORB3$(OMNI_LIB_EXT) \
|
||||
-lomniDynamic3$(OMNI_LIB_EXT) \
|
||||
-ltcpwrapGK$(OMNI_LIB_EXT) \
|
||||
-lomnithread$(OMNI_LIB_EXT) \
|
||||
-lpthread
|
||||
|
||||
@ -1,7 +0,0 @@
|
||||
#include "orbOptions"
|
||||
|
||||
EXE_INC = \
|
||||
$(ORB_INC) \
|
||||
-I../FoamXServer
|
||||
|
||||
LIB_LIBS = $(ORB_LIBS)
|
||||
@ -1,31 +0,0 @@
|
||||
#if defined(linux) || defined(linux64)
|
||||
|
||||
ORB_SYS_INC = -Wno-old-style-cast
|
||||
ORB_SYS_LIB = -lssl -lcrypto -ldl -lpthread
|
||||
|
||||
#elif defined(solaris)
|
||||
|
||||
ORB_SYS_INC =
|
||||
ORB_SYS_LIB = -ldl
|
||||
|
||||
#elif defined(sgiN32) || defined(sgi64)
|
||||
|
||||
ORB_SYS_INC =
|
||||
ORB_SYS_LIB =
|
||||
|
||||
#else
|
||||
|
||||
# error architecture not supported for compiling FoamX
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
ORB_INC = \
|
||||
-I$(MICO_ARCH_PATH)/include \
|
||||
$(ORB_SYS_INC)
|
||||
|
||||
ORB_LIBS = \
|
||||
-L$(MICO_ARCH_PATH)/lib \
|
||||
-lmicocoss$(MICO_VERSION) \
|
||||
-lmico$(MICO_VERSION) \
|
||||
$(ORB_SYS_LIB)
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,186 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::ICaseServerImpl
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
NameServer.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef NameServer_H
|
||||
#define NameServer_H
|
||||
|
||||
// System header files.
|
||||
#include <coss/CosNaming.h>
|
||||
|
||||
// Foam header files.
|
||||
#include "dictionary.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class NameServer Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class NameServer
|
||||
{
|
||||
// Private data
|
||||
|
||||
bool connected_;
|
||||
CosNaming::NamingContext_var rootContext_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
void createNameFromString(const std::string&, CosNaming::Name& name);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
NameServer();
|
||||
|
||||
//- Construct connecting to given ORB
|
||||
NameServer(CORBA::ORB_ptr pOrb);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~NameServer();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Connection methods.
|
||||
|
||||
void connect(CORBA::ORB_ptr pOrb);
|
||||
|
||||
void disconnect();
|
||||
|
||||
bool isConnected() const
|
||||
{
|
||||
return connected_;
|
||||
}
|
||||
|
||||
|
||||
// Context methods.
|
||||
|
||||
// Create single context
|
||||
void createContext
|
||||
(
|
||||
const Foam::fileName& path,
|
||||
bool failAlreadyBound = false
|
||||
);
|
||||
|
||||
// Create all contexts (a la 'mkdir -p')
|
||||
void createContexts
|
||||
(
|
||||
const Foam::fileName& path,
|
||||
bool failAlreadyBound = false
|
||||
);
|
||||
|
||||
void removeContext(const Foam::fileName& path);
|
||||
|
||||
// Remove all contexts up to (but not including) root
|
||||
void removeContexts
|
||||
(
|
||||
const Foam::fileName& root,
|
||||
const Foam::fileName& path
|
||||
);
|
||||
|
||||
|
||||
bool isContextBound(const Foam::fileName& path);
|
||||
|
||||
|
||||
// Object binding methods.
|
||||
|
||||
void bindObject
|
||||
(
|
||||
const Foam::fileName& name,
|
||||
CORBA::Object_ptr pObject,
|
||||
bool rebind = false
|
||||
);
|
||||
|
||||
void unbindObject(const Foam::fileName& name);
|
||||
|
||||
bool isObjectBound(const Foam::fileName& name);
|
||||
|
||||
|
||||
// Object reference resolution methods.
|
||||
|
||||
CORBA::Object_ptr resolve(const Foam::fileName& name);
|
||||
|
||||
|
||||
//- Template function to return object reference of the template type
|
||||
// from the given context name.
|
||||
// For Example :-
|
||||
// FoamXServer::HostBrowser::IHostBrowser_var ref =
|
||||
// fxNameServer.resolve
|
||||
// <FoamXServer::HostBrowser::IHostBrowser>
|
||||
// ("HostBrowser.FoamX");
|
||||
template<class T>
|
||||
typename T::_ptr_type resolve(const Foam::fileName& name)
|
||||
{
|
||||
CORBA::Object_var objRef = resolve(name);
|
||||
|
||||
// Narrow to the specified type.
|
||||
typename T::_ptr_type objTypeRef = T::_narrow(objRef);
|
||||
if (CORBA::is_nil(objTypeRef))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
FoamXServer::E_FAIL,
|
||||
"Invalid object type.",
|
||||
"NameServer::resolve(const Foam::fileName& name)",
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
return T::_duplicate(objTypeRef);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,107 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::ObjRefDictionary
|
||||
|
||||
Description
|
||||
Dictionary to hold CORBA implementation (ie, RefCountServantBase derived)
|
||||
object references. Overrides the clear and erase method to properly release
|
||||
the object references. All references are released in Hashtable destructor
|
||||
via call to clear method.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef ObjRefDictionary_H
|
||||
#define ObjRefDictionary_H
|
||||
|
||||
// Foam header files.
|
||||
#include "Dictionary.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class ObjRefDictionary Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class ObjImplClass>
|
||||
class ObjRefDictionary
|
||||
:
|
||||
public Foam::Dictionary<ObjImplClass>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Erase an entry specified by given iterator.
|
||||
bool erase(const word& keyword)
|
||||
{
|
||||
if (this->found(keyword))
|
||||
{
|
||||
// Release Corba implementation object.
|
||||
this->lookup(keyword)->_remove_ref();
|
||||
|
||||
// Invoke base class erase method.
|
||||
return Foam::Dictionary<ObjImplClass>::erase(keyword);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//- Clear all entries from table.
|
||||
void clear()
|
||||
{
|
||||
// Release all Corba implementation objects.
|
||||
for
|
||||
(
|
||||
typename Foam::Dictionary<ObjImplClass>::iterator iter =
|
||||
this->begin();
|
||||
iter != this->end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
iter()->_remove_ref();
|
||||
}
|
||||
|
||||
// Invoke base class clear method.
|
||||
Foam::Dictionary<ObjImplClass>::clear();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,111 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::ObjRefHashTable
|
||||
|
||||
Description
|
||||
Hashtable to hold CORBA implementation (ie, RefCountServantBase derived)
|
||||
object references. Overrides the clear and erase method to properly release
|
||||
the object references. All references are released in Hashtable destructor
|
||||
via call to clear method.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef ObjRefHashTable_H
|
||||
#define ObjRefHashTable_H
|
||||
|
||||
// Foam header files.
|
||||
#include "HashTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class ObjRefHashTable Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class ObjImplClass>
|
||||
class ObjRefHashTable
|
||||
:
|
||||
public Foam::HashTable<ObjImplClass>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Destructor
|
||||
|
||||
~ObjRefHashTable()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Erase an entry specified by given iterator.
|
||||
bool erase(typename Foam::HashTable<ObjImplClass>::iterator& iter)
|
||||
{
|
||||
// Release Corba implementation object.
|
||||
if (iter != this->end())
|
||||
{
|
||||
iter()->_remove_ref();
|
||||
}
|
||||
|
||||
// Invoke base class erase method.
|
||||
return Foam::HashTable<ObjImplClass>::erase(iter);
|
||||
}
|
||||
|
||||
//- Clear all entries from table.
|
||||
void clear()
|
||||
{
|
||||
// Release all Corba implementation objects.
|
||||
for
|
||||
(
|
||||
typename Foam::HashTable<ObjImplClass>::iterator iter =
|
||||
this->begin();
|
||||
iter != this->end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
iter()->_remove_ref();
|
||||
}
|
||||
|
||||
// Invoke base class clear method.
|
||||
Foam::HashTable<ObjImplClass>::clear();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,88 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
#include "Orb.H"
|
||||
#include "NameServer.H"
|
||||
#include "LogEntry.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::Orb::Orb(int& argc, char** argv)
|
||||
:
|
||||
// Initialise the ORB, passing in the command line arguments.
|
||||
orbPtr_(CORBA::ORB_init(argc, argv))
|
||||
{
|
||||
// Obtain a reference to the root POA.
|
||||
CORBA::Object_var obj = orbPtr_->resolve_initial_references("RootPOA");
|
||||
PortableServer::POA_var poaPtr_ = PortableServer::POA::_narrow(obj);
|
||||
|
||||
// Obtain POAManager reference and tell the POA to start accepting
|
||||
// requests on its objects.
|
||||
PortableServer::POAManager_var pman = poaPtr_->the_POAManager();
|
||||
pman->activate();
|
||||
}
|
||||
|
||||
|
||||
FoamX::Orb::~Orb()
|
||||
{
|
||||
//poaPtr_->destroy(true, false);
|
||||
orbPtr_->destroy();
|
||||
}
|
||||
|
||||
|
||||
void FoamX::Orb::run()
|
||||
{
|
||||
orbPtr_->run();
|
||||
}
|
||||
|
||||
|
||||
Foam::string FoamX::Orb::ior(CORBA::Object_ptr oPtr)
|
||||
{
|
||||
return orbPtr_->object_to_string(oPtr);
|
||||
}
|
||||
|
||||
|
||||
bool FoamX::Orb::isObjectBound(const Foam::fileName& objectName)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::Orb::isObjectBound(const Foam::fileName& objectName)";
|
||||
|
||||
Foam::LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
// Connect to name server.
|
||||
NameServer fxNameServer(orbPtr_);
|
||||
return fxNameServer.isObjectBound(objectName);
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,89 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::className
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
Orb.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Orb_H
|
||||
#define Orb_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class Orb Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class Orb
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Public data
|
||||
|
||||
//- Pointer to ORB.
|
||||
CORBA::ORB_var orbPtr_;
|
||||
|
||||
//- Pointer to POA.
|
||||
PortableServer::POA_var poaPtr_;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
Orb(int& argc, char** argv);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~Orb();
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
void run();
|
||||
|
||||
Foam::string ior(CORBA::Object_ptr);
|
||||
|
||||
bool isObjectBound(const Foam::fileName& objectName);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,321 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// Foam header files.
|
||||
#include "emptyPolyPatch.H"
|
||||
#include "polyPatch.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "LogEntry.H"
|
||||
#include "PatchProperties.H"
|
||||
#include "Paths.H"
|
||||
|
||||
// Namespaces
|
||||
#include "FoamXNameSpaces.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::PatchProperties::PatchProperties(const word& patchName)
|
||||
:
|
||||
patchName_(patchName),
|
||||
patchType_(emptyPolyPatch::typeName),
|
||||
physicalType_(emptyPolyPatch::typeName),
|
||||
modified_(false)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::PatchProperties::PatchProperties(const char* patchName)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::PatchProperties::~PatchProperties()
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::PatchProperties::~PatchProperties()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::word& FoamX::PatchProperties::patchName() const
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::PatchProperties::patchName()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
return patchName_;
|
||||
}
|
||||
|
||||
void FoamX::PatchProperties::patchName(const word& newName)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::PatchProperties::patchName(const char* newName)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
patchName_ = newName;
|
||||
|
||||
modified_ = true;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::word& FoamX::PatchProperties::patchType() const
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::PatchProperties::patchType()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
return patchType_;
|
||||
}
|
||||
|
||||
void FoamX::PatchProperties::patchType(const word& newPatchType)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::PatchProperties::type(const char* newPatchType)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
patchType_ = newPatchType;
|
||||
|
||||
modified_ = true;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::word& FoamX::PatchProperties::physicalType() const
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::PatchProperties::physicalType()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
return physicalType_;
|
||||
}
|
||||
|
||||
void FoamX::PatchProperties::physicalType(const word& newName)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::PatchProperties::physicalType(const char* newName)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
physicalType_ = newName;
|
||||
|
||||
modified_ = true;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::label FoamX::PatchProperties::startFace() const
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::PatchProperties::startFace()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
return startFace_;
|
||||
}
|
||||
|
||||
void FoamX::PatchProperties::startFace(label n)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::PatchProperties::startFace(label n)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
startFace_ = n;
|
||||
|
||||
modified_ = true;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::label FoamX::PatchProperties::nFaces() const
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::PatchProperties::nFaces()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
return nFaces_;
|
||||
}
|
||||
|
||||
void FoamX::PatchProperties::nFaces(label n)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::PatchProperties::nFaces(label n)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
nFaces_ = n;
|
||||
|
||||
modified_ = true;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
bool FoamX::PatchProperties::modified() const
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::PatchProperties::modified()";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
return modified_;
|
||||
}
|
||||
|
||||
void FoamX::PatchProperties::modified(bool mod)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::PatchProperties::modified(bool)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
modified_ = mod;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::PatchProperties::load(const dictionary& patchDict)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::PatchProperties::load(const dictionary& patchDict)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
log << "Reading " << patchDict.name()
|
||||
<< " start line " << patchDict.startLineNumber()
|
||||
<< " end line " << patchDict.endLineNumber() << endl;
|
||||
|
||||
// Check that the dictionary has the minimum required information.
|
||||
if
|
||||
(
|
||||
!patchDict.found("type")
|
||||
|| !patchDict.found("startFace")
|
||||
|| !patchDict.found("nFaces")
|
||||
)
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_FAIL,
|
||||
"Malformed patch dictionary '" + patchName_ + "'.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
// Get patch data.
|
||||
patchDict.lookup("type") >> patchType_;
|
||||
|
||||
if (patchDict.found("geometricType"))
|
||||
{
|
||||
patchDict.lookup("geometricType") >> patchType_;
|
||||
}
|
||||
|
||||
patchDict.lookup("startFace") >> startFace_;
|
||||
patchDict.lookup("nFaces") >> nFaces_;
|
||||
|
||||
// If the type is a constraint type set the physicalType
|
||||
// to be the same else lookup the physical type if it is there.
|
||||
if (polyPatch::constraintType(patchType_))
|
||||
{
|
||||
physicalType_ = patchType_;
|
||||
}
|
||||
else if (patchDict.found("physicalType"))
|
||||
{
|
||||
patchDict.lookup("physicalType") >> physicalType_;
|
||||
}
|
||||
|
||||
modified_ = false;
|
||||
}
|
||||
catch (FoamXError& ex)
|
||||
{
|
||||
// Bounce exception up to client.
|
||||
throw ex;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Unexpected error.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::PatchProperties::save(FoamX::DictionaryWriter& dictWriter)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::PatchProperties::save(FoamX::DictionaryWriter& dictWriter)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
// Save the patch information to a sub-dictionary.
|
||||
dictWriter.startSubDict(patchName_);
|
||||
|
||||
dictWriter.writeEntry("type", patchType_);
|
||||
dictWriter.writeEntry("physicalType", physicalType_);
|
||||
dictWriter.writeEntry("startFace", startFace_ );
|
||||
dictWriter.writeEntry("nFaces", nFaces_);
|
||||
|
||||
dictWriter.endSubDict();
|
||||
|
||||
modified_ = false;
|
||||
}
|
||||
catch (FoamXError& ex)
|
||||
{
|
||||
// Bounce exception up to client.
|
||||
throw ex;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Unexpected error.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,123 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::PatchProperties
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
PatchProperties.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef PatchProperties_H
|
||||
#define PatchProperties_H
|
||||
|
||||
// Foam header files.
|
||||
#include "dictionary.H"
|
||||
#include "Dictionary.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
#include "DictionaryWriter.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class PatchProperties Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class PatchProperties
|
||||
:
|
||||
public Foam::Dictionary<PatchProperties>::link
|
||||
{
|
||||
// Private data
|
||||
|
||||
Foam::word patchName_;
|
||||
Foam::word patchType_;
|
||||
Foam::word physicalType_;
|
||||
Foam::label startFace_;
|
||||
Foam::label nFaces_;
|
||||
|
||||
bool modified_;
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
PatchProperties(const Foam::word& patchName);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~PatchProperties();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
const Foam::word& patchName() const;
|
||||
void patchName(const Foam::word&);
|
||||
|
||||
//- Keyword used by Dictionary
|
||||
const word& keyword() const
|
||||
{
|
||||
return patchName_;
|
||||
}
|
||||
|
||||
const Foam::word& patchType() const;
|
||||
void patchType(const word&);
|
||||
|
||||
const Foam::word& physicalType() const;
|
||||
void physicalType(const Foam::word&);
|
||||
|
||||
Foam::label startFace() const;
|
||||
void startFace(Foam::label);
|
||||
|
||||
Foam::label nFaces() const;
|
||||
void nFaces(Foam::label);
|
||||
|
||||
bool modified() const;
|
||||
void modified(bool);
|
||||
|
||||
// Persistence
|
||||
|
||||
void load(const Foam::dictionary& patchDict);
|
||||
void save(DictionaryWriter& dictWriter);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,67 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// Foam header files.
|
||||
#include "OSspecific.H"
|
||||
|
||||
// FoamX header files.
|
||||
#include "Paths.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Paths
|
||||
{
|
||||
Foam::fileName config(Foam::getEnv("FOAMX_CONFIG"));
|
||||
//Foam::fileName tmp(Foam::dotFoam("tmp"));
|
||||
Foam::fileName tmp(config);
|
||||
|
||||
Foam::fileName solversPath()
|
||||
{
|
||||
return Foam::getEnv("WM_PROJECT_DIR")/"applications/solvers";
|
||||
}
|
||||
Foam::fileName solvers(solversPath());
|
||||
|
||||
Foam::fileName userSolversPath()
|
||||
{
|
||||
return Foam::getEnv("WM_PROJECT_USER_DIR")/"applications/solvers";
|
||||
}
|
||||
Foam::fileName userSolvers(userSolversPath());
|
||||
|
||||
Foam::fileName utilitiesPath()
|
||||
{
|
||||
return Foam::getEnv("WM_PROJECT_DIR")/"applications/utilities";
|
||||
}
|
||||
Foam::fileName utilities(utilitiesPath());
|
||||
|
||||
Foam::fileName userUtilitiesPath()
|
||||
{
|
||||
return Foam::getEnv("WM_PROJECT_USER_DIR")/"applications/utilities";
|
||||
}
|
||||
Foam::fileName userUtilities(userUtilitiesPath());
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,65 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::className
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
Paths.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Paths_H
|
||||
#define Paths_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Paths
|
||||
{
|
||||
//- FoamX configuration files path.
|
||||
extern Foam::fileName config;
|
||||
|
||||
//- FoamX tmp directory path.
|
||||
extern Foam::fileName tmp;
|
||||
|
||||
//- FoamX release solvers path.
|
||||
extern Foam::fileName solvers;
|
||||
|
||||
//- FoamX users solvers path.
|
||||
extern Foam::fileName userSolvers;
|
||||
|
||||
//- FoamX release utilities path.
|
||||
extern Foam::fileName utilities;
|
||||
|
||||
//- FoamX users utilities path.
|
||||
extern Foam::fileName userUtilities;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,464 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// Standard header files.
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/wait.h>
|
||||
#include <errno.h>
|
||||
|
||||
// Foam header files.
|
||||
#include "ProcessControl.H"
|
||||
#include "dictionary.H"
|
||||
#include "IFstream.H"
|
||||
#include "OSspecific.H"
|
||||
#include "timer.H"
|
||||
|
||||
// Project header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
#include "FoamXNameSpaces.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::ProcessControl::readEntries(const dictionary& procDict)
|
||||
{
|
||||
if (procDict.found("remoteShell"))
|
||||
{
|
||||
remoteShell_ = string(procDict.lookup("remoteShell"));
|
||||
}
|
||||
|
||||
if (procDict.found("remoteCp"))
|
||||
{
|
||||
remoteShell_ = string(procDict.lookup("remoteCp"));
|
||||
}
|
||||
|
||||
if (procDict.found("timeOut"))
|
||||
{
|
||||
timeOut_ = readLabel(procDict.lookup("timeOut"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
FoamX::ProcessControl::ProcessControl
|
||||
(
|
||||
const fileName& fxSystemConfigFileName
|
||||
)
|
||||
:
|
||||
remoteShell_("rsh"),
|
||||
remoteCp_("rcp"),
|
||||
timeOut_(60)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::ProcessControl::ProcessControl"
|
||||
"(const fileName& fxSystemConfigFileName)";
|
||||
|
||||
if (!exists(fxSystemConfigFileName))
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_FAIL,
|
||||
"Configuration dictionary '" + fxSystemConfigFileName
|
||||
+ "' not found",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
dictionary configDict((IFstream(fxSystemConfigFileName)()));
|
||||
readEntries(configDict.subDict("processControl"));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::stringList FoamX::ProcessControl::remoteShellArgs
|
||||
(
|
||||
const string& userName,
|
||||
const string& hostName,
|
||||
const stringList& arguments,
|
||||
const string& logName,
|
||||
const bool backGround
|
||||
) const
|
||||
{
|
||||
// Get length of resulting argument string
|
||||
|
||||
unsigned int argsLen = arguments.size();
|
||||
if (backGround)
|
||||
{
|
||||
argsLen++;
|
||||
}
|
||||
|
||||
bool remote = (hostName != Foam::hostName());
|
||||
if (remote)
|
||||
{
|
||||
argsLen += 4;
|
||||
}
|
||||
|
||||
bool haveLogName = false;
|
||||
if (logName.length() != 0)
|
||||
{
|
||||
haveLogName = true;
|
||||
|
||||
argsLen+= 2;
|
||||
}
|
||||
|
||||
// Now we have collected
|
||||
// - argsLen
|
||||
// - remote (true if on remote machine)
|
||||
// - haveLogName (true if output needs to go into log)
|
||||
|
||||
|
||||
stringList args(argsLen);
|
||||
|
||||
// Remote invocation
|
||||
unsigned int argi = 0;
|
||||
if (remote)
|
||||
{
|
||||
args[argi++] = remoteShell_;
|
||||
args[argi++] = hostName;
|
||||
args[argi++] = "-l";
|
||||
args[argi++] = userName;
|
||||
}
|
||||
|
||||
// Arguments
|
||||
for (int i = 0; i <arguments.size(); i++)
|
||||
{
|
||||
args[argi++] = arguments[i];
|
||||
}
|
||||
|
||||
// Redirection
|
||||
if (haveLogName)
|
||||
{
|
||||
// Don't redirect stderr.
|
||||
if (remote)
|
||||
{
|
||||
// Quoted ">" so redirection is done remotely
|
||||
args[argi++] = "\">\"";
|
||||
args[argi++] = logName;
|
||||
}
|
||||
else
|
||||
{
|
||||
args[argi++] = ">";
|
||||
args[argi++] = logName;
|
||||
}
|
||||
}
|
||||
|
||||
if (backGround)
|
||||
{
|
||||
args[argi++] = "&";
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
|
||||
Foam::stringList FoamX::ProcessControl::remoteCpArgs
|
||||
(
|
||||
const string& userName,
|
||||
const string& hostName,
|
||||
const fileName& src,
|
||||
const fileName& dest
|
||||
) const
|
||||
{
|
||||
if (hostName == Foam::hostName())
|
||||
{
|
||||
stringList args(4);
|
||||
args[0] = "cp";
|
||||
args[1] = "-r";
|
||||
args[2] = src;
|
||||
args[3] = dest;
|
||||
|
||||
return args;
|
||||
}
|
||||
else
|
||||
{
|
||||
stringList args(4);
|
||||
args[0] = remoteCp_;
|
||||
args[1] = "-r";
|
||||
args[2] = userName + '@' + hostName + ':' + src;
|
||||
args[3] = dest;
|
||||
|
||||
return args;
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Return the command line as a string
|
||||
Foam::string FoamX::ProcessControl::commandString
|
||||
(
|
||||
const stringList& argList
|
||||
)
|
||||
{
|
||||
string cms = argList[0];
|
||||
|
||||
for (label i=1; i<argList.size(); i++)
|
||||
{
|
||||
cms += ' ' + argList[i];
|
||||
}
|
||||
|
||||
return cms;
|
||||
}
|
||||
|
||||
|
||||
// Wait for process to finish.
|
||||
pid_t FoamX::ProcessControl::waitpid(pid_t pid)
|
||||
{
|
||||
return ::waitpid(pid, NULL, 0);
|
||||
}
|
||||
|
||||
|
||||
pid_t FoamX::ProcessControl::fork
|
||||
(
|
||||
const stringList& argList,
|
||||
const fileName& logFile
|
||||
)
|
||||
{
|
||||
pid_t pid = -1;
|
||||
|
||||
// We are in the forked process so execute the command.
|
||||
// Allocate a buffer to hold the command arguments.
|
||||
List<char*> argv(argList.size() + 1);
|
||||
|
||||
forAll(argList, i)
|
||||
{
|
||||
argv[i] = const_cast<char*>(argList[i].c_str());
|
||||
}
|
||||
argv[argList.size()] = NULL;
|
||||
|
||||
// Fork this process.
|
||||
if ((pid = ::fork()) < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Check that the fork worked.
|
||||
if (pid == 0)
|
||||
{
|
||||
if (FoamXError::debug)
|
||||
{
|
||||
if (logFile.size() != 0)
|
||||
{
|
||||
Info<< "Running Process [" << getpid() << "] "
|
||||
<< commandString(argList) << " > " << logFile << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Running Process [" << getpid() << "] "
|
||||
<< commandString(argList) << endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (logFile.size() != 0)
|
||||
{
|
||||
int outFd =
|
||||
open
|
||||
(
|
||||
logFile.c_str(),
|
||||
O_WRONLY | O_CREAT | O_TRUNC,
|
||||
S_IRWXU | S_IRWXG | S_IRWXO
|
||||
);
|
||||
|
||||
if (dup2(outFd, STDOUT_FILENO) != STDOUT_FILENO)
|
||||
{
|
||||
perror("ProcessControl::fork : dup2 error to stdout");
|
||||
}
|
||||
close (outFd);
|
||||
}
|
||||
|
||||
// Replace this process with the required command.
|
||||
execvp(argv[0], argv.begin());
|
||||
|
||||
// execvp failed so exit this process and return a -1 error code.
|
||||
::_exit(-1);
|
||||
}
|
||||
|
||||
return pid;
|
||||
}
|
||||
|
||||
|
||||
int FoamX::ProcessControl::system
|
||||
(
|
||||
const stringList& argList,
|
||||
const int timeOut
|
||||
)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::ProcessControl::system"
|
||||
"(const stringList&, const int)";
|
||||
|
||||
string cmd(commandString(argList));
|
||||
|
||||
Info<< "Doing (with timeout " << timeOut << ") : " << cmd << endl;
|
||||
|
||||
if (timeOut <= 0)
|
||||
{
|
||||
return ::system(cmd.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
char* const argp[] =
|
||||
{
|
||||
"/bin/sh",
|
||||
"-c",
|
||||
const_cast<char*>(cmd.c_str()),
|
||||
NULL
|
||||
};
|
||||
|
||||
pid_t pid = -1;
|
||||
|
||||
if ((pid = ::fork()) < 0)
|
||||
{
|
||||
if (FoamXError::debug)
|
||||
{
|
||||
Info<< functionName
|
||||
<< " fork failed." << endl;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pid == 0)
|
||||
{
|
||||
execv("/bin/sh", argp);
|
||||
|
||||
// Should never come here.
|
||||
_exit(127);
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (FoamXError::debug)
|
||||
{
|
||||
Info<< functionName
|
||||
<< " forked pid:" << pid << "." << endl;
|
||||
}
|
||||
|
||||
timer myTimer(timeOut);
|
||||
|
||||
if (timedOut(myTimer))
|
||||
{
|
||||
// Timed out
|
||||
FoamX::ProcessControl::kill(pid, SIGTERM);
|
||||
return TIMEDOUT;
|
||||
}
|
||||
|
||||
int pStat;
|
||||
while (::waitpid(pid, &pStat, 0) == -1)
|
||||
{
|
||||
if (errno != EINTR)
|
||||
{
|
||||
pStat = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//if (FoamXError::debug)
|
||||
//{
|
||||
Info<< "Finished doing (with timeout " << timeOut << ") : "
|
||||
<< cmd << endl;
|
||||
//}
|
||||
|
||||
return pStat;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int FoamX::ProcessControl::kill(pid_t pid, int sig)
|
||||
{
|
||||
int pStat = ::kill(pid, sig);
|
||||
|
||||
timer myTimer(60);
|
||||
|
||||
if (timedOut(myTimer))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (::waitpid(pid, &pStat, 0) == -1)
|
||||
{
|
||||
return pStat;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int FoamX::ProcessControl::kill(const word& host, pid_t pid, int sig) const
|
||||
{
|
||||
if (host == hostName())
|
||||
{
|
||||
return FoamX::ProcessControl::kill(pid, sig);
|
||||
}
|
||||
else
|
||||
{
|
||||
stringList args(3);
|
||||
args[0] = "kill";
|
||||
args[1] = "-" + name(sig);
|
||||
args[2] = name(pid);
|
||||
|
||||
stringList remoteArgs
|
||||
(
|
||||
remoteShellArgs
|
||||
(
|
||||
userName(),
|
||||
host,
|
||||
args,
|
||||
"",
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
return system
|
||||
(
|
||||
remoteArgs,
|
||||
timeOut()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int FoamX::ProcessControl::suspend(const word& host, pid_t pid) const
|
||||
{
|
||||
return kill(host, pid, SIGSTOP);
|
||||
}
|
||||
|
||||
|
||||
int FoamX::ProcessControl::cont(const word& host, pid_t pid) const
|
||||
{
|
||||
return kill(host, pid, SIGCONT);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,177 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::ProcessControl
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
ProcessControl.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef ProcessControl_H
|
||||
#define ProcessControl_H
|
||||
|
||||
#include "label.H"
|
||||
#include "stringList.H"
|
||||
#include "word.H"
|
||||
#include "fileName.H"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class ProcessControl Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class ProcessControl
|
||||
{
|
||||
// Private data
|
||||
|
||||
Foam::fileName remoteShell_;
|
||||
Foam::fileName remoteCp_;
|
||||
Foam::label timeOut_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
ProcessControl(const ProcessControl&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const ProcessControl&);
|
||||
|
||||
//- Read the entries from the given dictionary if they are present
|
||||
void readEntries(const Foam::dictionary& procDict);
|
||||
|
||||
static void sigAlarm(const int);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Public data types
|
||||
|
||||
//- error value for time outs
|
||||
static const int TIMEDOUT = -2;
|
||||
|
||||
class sigAlarmException
|
||||
{};
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from configuration file
|
||||
ProcessControl
|
||||
(
|
||||
const Foam::fileName& fxSystemConfigFileName
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
const Foam::fileName& remoteShell() const
|
||||
{
|
||||
return remoteShell_;
|
||||
}
|
||||
|
||||
const Foam::fileName& remoteCp() const
|
||||
{
|
||||
return remoteCp_;
|
||||
}
|
||||
|
||||
Foam::label timeOut() const
|
||||
{
|
||||
return timeOut_;
|
||||
}
|
||||
|
||||
Foam::stringList remoteShellArgs
|
||||
(
|
||||
const Foam::string& userName,
|
||||
const Foam::string& hostName,
|
||||
const Foam::stringList& arguments,
|
||||
const Foam::string& logName,
|
||||
const bool backGround
|
||||
) const;
|
||||
|
||||
Foam::stringList remoteCpArgs
|
||||
(
|
||||
const Foam::string& userName,
|
||||
const Foam::string& hostName,
|
||||
const Foam::fileName& src,
|
||||
const Foam::fileName& dest
|
||||
) const;
|
||||
|
||||
|
||||
//- Concaternate arList into a single string
|
||||
static Foam::string commandString(const Foam::stringList& argList);
|
||||
|
||||
//- Fork command
|
||||
static pid_t fork
|
||||
(
|
||||
const Foam::stringList& argList,
|
||||
const Foam::fileName& logFile
|
||||
);
|
||||
|
||||
//- Waitpid command
|
||||
static pid_t waitpid(pid_t pid);
|
||||
|
||||
//- Run command using system
|
||||
static int system
|
||||
(
|
||||
const Foam::stringList& argList,
|
||||
const int timeOut=0
|
||||
);
|
||||
|
||||
//- Kill job with given pid
|
||||
static int kill(pid_t pid, int sig=SIGINT);
|
||||
|
||||
//- Kill job on given machine with given pid
|
||||
int kill(const Foam::word& host, pid_t pid, int sig=SIGINT) const;
|
||||
|
||||
//- Suspend job on given machine with given pid
|
||||
int suspend(const Foam::word& host, pid_t pid) const;
|
||||
|
||||
//- Continue job on given machine with given pid
|
||||
int cont(const Foam::word& host, pid_t pid) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,255 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// Foam header files
|
||||
#include "IFstream.H"
|
||||
#include "OSspecific.H"
|
||||
|
||||
// Project header files.
|
||||
#include "FoamX.H"
|
||||
#include "FoamXErrors.H"
|
||||
#include "LogEntry.H"
|
||||
#include "RootDictionary.H"
|
||||
|
||||
// Namespaces
|
||||
#include "FoamXNameSpaces.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::RootDictionary::RootDictionary
|
||||
(
|
||||
ITypeDescriptor_ptr typeDesc,
|
||||
const fileName& caseRoot,
|
||||
const fileName& caseName
|
||||
)
|
||||
:
|
||||
IDictionaryEntryImpl(typeDesc),
|
||||
caseRoot_(caseRoot),
|
||||
caseName_(caseName)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::RootDictionary::RootDictionary"
|
||||
"(ITypeDescriptor_ptr, const fileName&, const fileName&)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
FoamX::RootDictionary::~RootDictionary()
|
||||
{}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fileName FoamX::RootDictionary::path
|
||||
(
|
||||
const fileName& rootDir,
|
||||
const fileName& caseName,
|
||||
const fileName& dictPath
|
||||
)
|
||||
{
|
||||
// If path is relative prepend root and case
|
||||
if (dictPath[0] != '/')
|
||||
{
|
||||
return rootDir/caseName/dictPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
return dictPath;
|
||||
}
|
||||
}
|
||||
|
||||
Foam::fileName FoamX::RootDictionary::pathName()
|
||||
{
|
||||
return
|
||||
path(caseRoot_, caseName_, typeDescriptor_->dictionaryPath())
|
||||
/word(typeDescriptor_->name());
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::RootDictionary::load()
|
||||
{
|
||||
fileName dictPathName = pathName();
|
||||
|
||||
// See if the dictionary file exists.
|
||||
if (exists(dictPathName))
|
||||
{
|
||||
// Load the values from the file.
|
||||
load((IFstream(dictPathName)()));
|
||||
}
|
||||
}
|
||||
|
||||
void FoamX::RootDictionary::load(Istream& is)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::RootDictionary::load(Istream&)";
|
||||
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
log << "Loading file for "
|
||||
<< CORBA::String_var(typeDescriptor_->path()) << endl;
|
||||
|
||||
token firstToken(is);
|
||||
|
||||
if
|
||||
(
|
||||
is.good()
|
||||
&& firstToken.isWord()
|
||||
&& firstToken.wordToken() == "FoamFile"
|
||||
)
|
||||
{
|
||||
// Read the FoamFile header
|
||||
dictionary headerDict(is);
|
||||
}
|
||||
else
|
||||
{
|
||||
is.putBack(firstToken);
|
||||
}
|
||||
|
||||
IDictionaryEntryImpl::load(is);
|
||||
|
||||
// Check state of Istream.
|
||||
is.check(functionName);
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::RootDictionary::save()
|
||||
{
|
||||
static const char* functionName = "FoamX::RootDictionary::save()";
|
||||
|
||||
// Overridden for root dictionary entries.
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
// Make sure that this entry is a top-level compound type.
|
||||
fileName dictName(typeDescriptor_->name());
|
||||
|
||||
if (!typeDescriptor_->isCompoundType() || !dictName.size())
|
||||
{
|
||||
throw FoamXError
|
||||
(
|
||||
E_UNEXPECTED,
|
||||
"Invalid root dictionary object.",
|
||||
functionName,
|
||||
__FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
|
||||
// Get the dictionaries path and file name.
|
||||
fileName dictPath(typeDescriptor_->dictionaryPath());
|
||||
fileName dictPathName = dictPath/dictName;
|
||||
|
||||
log << "Saving root dictionary " << dictName << "." << endl;
|
||||
|
||||
if (dictPath[0] != '/')
|
||||
{
|
||||
DictionaryWriter dictWriter
|
||||
(
|
||||
caseRoot_,
|
||||
caseName_,
|
||||
dictPath,
|
||||
dictName
|
||||
);
|
||||
|
||||
dictWriter.writeHeader
|
||||
(
|
||||
"FoamX Case Dictionary.",
|
||||
"dictionary"
|
||||
);
|
||||
|
||||
writeEntries(dictWriter);
|
||||
}
|
||||
else
|
||||
{
|
||||
DictionaryWriter dictWriter(pathName());
|
||||
|
||||
dictWriter.writeHeader
|
||||
(
|
||||
"Foam Dictionary.",
|
||||
"dictionary"
|
||||
);
|
||||
|
||||
writeEntries(dictWriter);
|
||||
}
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void FoamX::RootDictionary::writeEntries(DictionaryWriter& dictWriter)
|
||||
{
|
||||
static const char* functionName =
|
||||
"FoamX::RootDictionary::writeEntries(DictionaryWriter& dictWriter)";
|
||||
|
||||
// Overridden for root dictionary entries.
|
||||
LogEntry log(functionName, __FILE__, __LINE__);
|
||||
|
||||
try
|
||||
{
|
||||
// Write the comment if required.
|
||||
const char* comment = typeDescriptor_->comment();
|
||||
if (strlen(comment) > 0)
|
||||
{
|
||||
dictWriter.writeComment(comment);
|
||||
dictWriter.writeEndl();
|
||||
}
|
||||
|
||||
bool isDict = true;
|
||||
|
||||
if (typeDescriptor_->type() != Type_Dictionary)
|
||||
{
|
||||
isDict = false;
|
||||
}
|
||||
|
||||
// Save all sub-elements.
|
||||
for
|
||||
(
|
||||
DLList<IDictionaryEntryImpl*>::iterator iter =
|
||||
subElements_.begin();
|
||||
iter != subElements_.end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
// Write each sub-element as a dictionary entry.
|
||||
iter()->save(dictWriter, isDict);
|
||||
dictWriter.writeEndl();
|
||||
}
|
||||
|
||||
dictWriter.writeEndBar();
|
||||
}
|
||||
CATCH_ALL(functionName);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,111 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::IDictionaryEntryImpl
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
RootDictionary.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef RootDictionary_H
|
||||
#define RootDictionary_H
|
||||
|
||||
// FoamX header files.
|
||||
#include "IDictionaryEntryImpl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace FoamX
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class RootDictionary Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class RootDictionary
|
||||
:
|
||||
public IDictionaryEntryImpl
|
||||
{
|
||||
// Private data
|
||||
|
||||
Foam::fileName caseRoot_;
|
||||
Foam::fileName caseName_;
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
RootDictionary
|
||||
(
|
||||
FoamXServer::ITypeDescriptor_ptr typeDesc,
|
||||
const Foam::fileName& caseRoot,
|
||||
const Foam::fileName& caseName
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~RootDictionary();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the dictPath with root and case if it isn't absolute
|
||||
static Foam::fileName path
|
||||
(
|
||||
const Foam::fileName& rootDir,
|
||||
const Foam::fileName& caseName,
|
||||
const Foam::fileName& dictPath
|
||||
);
|
||||
|
||||
//- Return the full path of the dictionary
|
||||
Foam::fileName pathName();
|
||||
|
||||
// Overridden IDictionaryEntry load
|
||||
virtual void load(Foam::Istream&);
|
||||
|
||||
//- Load the dictionary if the it's file exists
|
||||
void load();
|
||||
|
||||
// Overridden IDictionaryEntry save
|
||||
virtual void save();
|
||||
|
||||
//- Write the dictionary entries using the dictWriter
|
||||
void writeEntries(DictionaryWriter& dictWriter);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace FoamX
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,3 +0,0 @@
|
||||
FoamX.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libFoamXServer
|
||||
@ -1,4 +0,0 @@
|
||||
#include "../../FoamXLib/Make/orbOptions"
|
||||
|
||||
EXE_INC = $(ORB_INC)
|
||||
EXE_LIBS = $(ORB_LIBS)
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,31 +0,0 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# Makefile for FoamX Client-Side Idl Java Code.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
JAVA_IDL = idlj
|
||||
JAVA_IDLFLAGS = -td ../Java -fclient
|
||||
FOAMXSERVER_JAVA_DIR = ../Java/FoamXServer
|
||||
FOAMXSERVER_JAVA_FILE = $(FOAMXSERVER_JAVA_DIR)/FoamXError.java
|
||||
|
||||
MICO_IDL = $(MICO_ARCH_PATH)/bin/idl
|
||||
MICO_INCDIR = $(MICO_ARCH_PATH)/include
|
||||
MICO_IDLFLAGS = --poa --c++-suffix=C --hh-suffix=H --any --typecode
|
||||
FOAMXLIB_DIR = ../C++/FoamXServer
|
||||
FOAMXLIB_H_FILE = $(FOAMXLIB_DIR)/FoamX.H
|
||||
|
||||
IDLFILE = FoamX.idl
|
||||
|
||||
all: $(FOAMXSERVER_JAVA_FILE) $(FOAMXLIB_H_FILE)
|
||||
|
||||
$(FOAMXSERVER_JAVA_FILE): $(IDLFILE)
|
||||
$(JAVA_IDL) $(JAVA_IDLFLAGS) $(IDLFILE)
|
||||
|
||||
$(FOAMXLIB_H_FILE): $(IDLFILE)
|
||||
$(MICO_IDL) $(MICO_IDLFLAGS) $(IDLFILE)
|
||||
mv FoamX.[HC] $(FOAMXLIB_DIR)
|
||||
|
||||
clean:
|
||||
rm -rf $(FOAMXSERVER_JAVA_DIR)
|
||||
rm -rf $(FOAMXLIB_DIR)/FoamX.[HC]
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE attributes PUBLIC "-//NetBeans//DTD DefaultAttributes 1.0//EN" "http://www.netbeans.org/dtds/attributes-1_0.dtd">
|
||||
<attributes version="1.0">
|
||||
<fileobject name="App.java">
|
||||
<attr name="NetBeansAttrArguments" serialvalue="aced0005757200135b4c6a6176612e6c616e672e537472696e673badd256e7e91d7b470200007870000000017400412d44466f616d582e436f6e666967506174683d2f686f6d652f70656e666f6c642f6d617474696a732f2e666f616d322e312f617070732f466f616d582f55736572"/>
|
||||
</fileobject>
|
||||
<fileobject name="ConfigureHostBrowser.java">
|
||||
<attr name="class_dependency_FoamX.Util.FoamXListRenderer.FoamXListItem" stringvalue="ConfigureHostBrowser.HostNameListItem"/>
|
||||
<attr name="class_dependency_javax.swing.JFrame" stringvalue="ConfigureHostBrowser"/>
|
||||
</fileobject>
|
||||
<fileobject name="FoamXException.java">
|
||||
<attr name="class_dependency_java.lang.Exception" stringvalue="FoamXException"/>
|
||||
</fileobject>
|
||||
</attributes>
|
||||
@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<attributes version="1.0">
|
||||
<fileobject name="ActionManager.java">
|
||||
<attr name="template" serialvalue="aced0005737200266f72672e6f70656e6964652e7574696c2e696f2e4e624d61727368616c6c65644f626a6563746cd5cc1aa397c0f2020002490004686173685b00086f626a42797465737400025b4278700000001170"/>
|
||||
</fileobject>
|
||||
<fileobject name="IActionProvider.java">
|
||||
<attr name="EA-OpenIDE-Connection" serialvalue="aced0005737200146a6176612e7574696c2e4c696e6b65644c6973740c29535d4a60882203000078707704000000057372002a6f72672e6f70656e6964652e6c6f61646572732e436f6e6e656374696f6e537570706f72742450616972055f8af6f04a3bd80200024c00047479706574002b4c6f72672f6f70656e6964652f636f6f6b6965732f436f6e6e656374696f6e436f6f6b696524547970653b4c000576616c75657400124c6a6176612f6c616e672f4f626a6563743b78707372002e6f72672e6e65746265616e732e6d6f64756c65732e6a6176612e4a617661436f6e6e656374696f6e732454797065a83dd01001306d7402000149000666696c746572787000000050737200296f72672e6f70656e6964652e6c6f61646572732e446174614e6f6465244f626a65637448616e646c655bd0f82e01811d2e0200025a0005636c6f6e654c00036f626a7400244c6f72672f6f70656e6964652f66696c6573797374656d732f46696c654f626a6563743b787000737200326f72672e6f70656e6964652e66696c6573797374656d732e416273747261637446696c654f626a65637424496e76616c6964c0bb2fa0ec2461140200024c000866756c6c4e616d657400124c6a6176612f6c616e672f537472696e673b4c00046e616d6571007e000c787200226f72672e6f70656e6964652e66696c6573797374656d732e46696c654f626a656374012f10797d5a7af6020000787074002c466f616d582f57696e646f774d616e616765722f4d6f64756c6557696e646f774d616e616765722e6a6176617400184d6f64756c6557696e646f774d616e616765722e6a6176617371007e00027371007e0006000000507371007e0008007371007e000b740015466f616d582f466f616d584672616d652e6a61766174000f466f616d584672616d652e6a6176617371007e00027371007e0006000000507371007e000800737200326f72672e6f70656e6964652e66696c6573797374656d732e416273747261637446696c654f626a656374245265706c616365896fa1bce4b5219f0200024c000866696c654e616d6571007e000c4c000666734e616d6571007e000c7870740029466f616d582f57696e646f774d616e6167656d656e742f57696e646f774d616e616765722e6a6176617400422f686f6d652f70656e666f6c642f6d617474696a732f666f616d2f6d617474696a73322e312f6170706c69636174696f6e732f7574696c2f466f616d582f4a6176617371007e00027371007e0006000000507371007e0008007371007e001a74000e466f616d582f4170702e6a61766171007e001d7371007e00027371007e000600000050737200436f72672e6e65746265616e732e6d6f64756c65732e6a6176612e4a617661446174614f626a6563742450657273697374656e74436f6e6e656374696f6e48616e646c65ba16f1d2dd4c1cb60200014c000e646174614e6f646548616e646c6574001f4c6f72672f6f70656e6964652f6e6f6465732f4e6f64652448616e646c653b78707371007e00080071007e002178"/>
|
||||
</fileobject>
|
||||
</attributes>
|
||||
@ -1,157 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
package FoamX.ActionManagement;
|
||||
|
||||
import java.lang.ref.*;
|
||||
import java.util.*;
|
||||
import javax.swing.*;
|
||||
|
||||
import FoamX.App;
|
||||
|
||||
public class ActionManager
|
||||
extends Object
|
||||
{
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
protected Hashtable actionMap_;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/** ActionManager constructor. */
|
||||
public ActionManager()
|
||||
{
|
||||
actionMap_ = new Hashtable();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
public boolean isRegistered(String actionName)
|
||||
{
|
||||
return actionMap_.containsKey(actionName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
public void registerAction(String actionName, Action action)
|
||||
throws IllegalArgumentException
|
||||
{
|
||||
if (actionMap_.containsKey(actionName))
|
||||
{
|
||||
throw new IllegalArgumentException
|
||||
(
|
||||
"Duplication action name in ActionManager.registerAction"
|
||||
+ " method call."
|
||||
);
|
||||
}
|
||||
|
||||
actionMap_.put(actionName, action);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
public void unregisterAction(String actionName)
|
||||
throws IllegalArgumentException
|
||||
{
|
||||
if (!actionMap_.containsKey(actionName))
|
||||
{
|
||||
throw new IllegalArgumentException
|
||||
(
|
||||
"Duplication action name in ActionManager.unregisterAction"
|
||||
+ " method call."
|
||||
);
|
||||
}
|
||||
|
||||
actionMap_.remove(actionName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
public Action getAction(String actionName)
|
||||
throws IllegalArgumentException
|
||||
{
|
||||
if (!actionMap_.containsKey(actionName))
|
||||
{
|
||||
throw new IllegalArgumentException
|
||||
(
|
||||
"Invalid action name in ActionManager.getAction method call."
|
||||
);
|
||||
}
|
||||
|
||||
return (Action)actionMap_.get(actionName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
public void registerActions(IActionProvider provider)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Get provider's prefix string.
|
||||
String prefix = provider.getPrefix();
|
||||
if (prefix != null)
|
||||
{
|
||||
prefix += ".";
|
||||
} else {
|
||||
prefix = "";
|
||||
}
|
||||
|
||||
// Loop over all actions and register each.
|
||||
javax.swing.Action[] actions = provider.getActions();
|
||||
for (int i = 0; i <actions.length; i++)
|
||||
{
|
||||
Action action = actions[i];
|
||||
String actionName =
|
||||
prefix + (String)action.getValue(Action.NAME);
|
||||
|
||||
registerAction(actionName, action);
|
||||
}
|
||||
}
|
||||
catch (IllegalArgumentException ex)
|
||||
{
|
||||
App.printMessage
|
||||
(
|
||||
"Illegal action name in ActionManager.registerProvider method"
|
||||
+ " call."
|
||||
);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
App.handleAllExceptions(ex);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
package FoamX.ActionManagement;
|
||||
|
||||
public interface IActionProvider
|
||||
{
|
||||
public String getPrefix();
|
||||
public javax.swing.Action[] getActions();
|
||||
}
|
||||
|
||||
Binary file not shown.
@ -1,136 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.0" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
||||
<NonVisualComponents>
|
||||
<Menu class="javax.swing.JMenuBar" name="menuBar_">
|
||||
<SubComponents>
|
||||
<Menu class="javax.swing.JMenu" name="jMenu2">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Menu"/>
|
||||
</Properties>
|
||||
<SubComponents>
|
||||
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem2">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Courier" size="10" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Item"/>
|
||||
</Properties>
|
||||
</MenuItem>
|
||||
</SubComponents>
|
||||
</Menu>
|
||||
</SubComponents>
|
||||
</Menu>
|
||||
<Menu class="javax.swing.JPopupMenu" name="contextMenu_">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Courier" size="10" style="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<SubComponents>
|
||||
<MenuItem class="javax.swing.JMenuItem" name="mnuProperties">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Courier" size="10" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Properties..."/>
|
||||
</Properties>
|
||||
</MenuItem>
|
||||
</SubComponents>
|
||||
</Menu>
|
||||
</NonVisualComponents>
|
||||
<Properties>
|
||||
<Property name="defaultCloseOperation" type="int" value="0"/>
|
||||
<Property name="title" type="java.lang.String" value="FoamX"/>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="ff" green="ff" id="white" palette="0" red="ff" type="palette"/>
|
||||
</Property>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Courier" size="10" style="0"/>
|
||||
</Property>
|
||||
<Property name="name" type="java.lang.String" value="MainFrame"/>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
<SyntheticProperty name="formSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
|
||||
<SyntheticProperty name="formPosition" type="java.awt.Point" value="-84,-19,0,5,115,114,0,14,106,97,118,97,46,97,119,116,46,80,111,105,110,116,-74,-60,-118,114,52,126,-56,38,2,0,2,73,0,1,120,73,0,1,121,120,112,0,0,0,0,0,0,0,0"/>
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="0"/>
|
||||
<SyntheticProperty name="generatePosition" type="boolean" value="true"/>
|
||||
<SyntheticProperty name="generateSize" type="boolean" value="true"/>
|
||||
<SyntheticProperty name="generateCenter" type="boolean" value="true"/>
|
||||
<SyntheticProperty name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
|
||||
</SyntheticProperties>
|
||||
|
||||
<Events>
|
||||
<EventHandler event="windowClosing" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="exitForm"/>
|
||||
<EventHandler event="windowActivated" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="OnActivate"/>
|
||||
</Events>
|
||||
|
||||
<AuxValues>
|
||||
<AuxValue name="RADVisualFormContainer_MenuComponent" type="java.lang.String" value="jMenuBar1"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JSplitPane" name="horizontalSplitPane_">
|
||||
<Properties>
|
||||
<Property name="orientation" type="int" value="0"/>
|
||||
<Property name="oneTouchExpandable" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JSplitPane" name="verticalSplitPane_">
|
||||
<Properties>
|
||||
<Property name="lastDividerLocation" type="int" value="-2"/>
|
||||
<Property name="oneTouchExpandable" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
||||
<JSplitPaneConstraints position="left"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JDesktopPane" name="desktopPanel_">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
||||
<JSplitPaneConstraints position="right"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JLayeredPaneSupportLayout"/>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="statusPanel_">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
|
||||
<EtchetBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[10, 25]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="1.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
|
||||
<Property name="alignment" type="int" value="0"/>
|
||||
<Property name="verticalGap" type="int" value="2"/>
|
||||
</Layout>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,67 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE attributes PUBLIC "-//NetBeans//DTD DefaultAttributes 1.0//EN" "http://www.netbeans.org/dtds/attributes-1_0.dtd">
|
||||
<attributes version="1.0">
|
||||
<fileobject name="CaseBrowserModel.java">
|
||||
<attr name="class_dependency_javax.swing.tree.DefaultTreeModel" stringvalue="CaseBrowserModel"/>
|
||||
<attr name="template" serialvalue="aced0005737200266f72672e6f70656e6964652e7574696c2e696f2e4e624d61727368616c6c65644f626a6563746cd5cc1aa397c0f2020002490004686173685b00086f626a42797465737400025b4278700000001170"/>
|
||||
</fileobject>
|
||||
<fileobject name="CaseManagerListener.java">
|
||||
<attr name="EA-OpenIDE-Connection" serialvalue="aced0005737200146a6176612e7574696c2e4c696e6b65644c6973740c29535d4a60882203000078707704000000037372002a6f72672e6f70656e6964652e6c6f61646572732e436f6e6e656374696f6e537570706f72742450616972055f8af6f04a3bd80200024c00047479706574002b4c6f72672f6f70656e6964652f636f6f6b6965732f436f6e6e656374696f6e436f6f6b696524547970653b4c000576616c75657400124c6a6176612f6c616e672f4f626a6563743b78707372002e6f72672e6e65746265616e732e6d6f64756c65732e6a6176612e4a617661436f6e6e656374696f6e732454797065a83dd01001306d7402000149000666696c746572787000000050737200296f72672e6f70656e6964652e6c6f61646572732e446174614e6f6465244f626a65637448616e646c655bd0f82e01811d2e0200025a0005636c6f6e654c00036f626a7400244c6f72672f6f70656e6964652f66696c6573797374656d732f46696c654f626a6563743b787000737200326f72672e6f70656e6964652e66696c6573797374656d732e416273747261637446696c654f626a656374245265706c616365896fa1bce4b5219f0200024c000866696c654e616d657400124c6a6176612f6c616e672f537472696e673b4c000666734e616d6571007e000c7870740025466f616d582f436173654d616e6167656d656e742f436173654d616e616765722e6a6176617400422f686f6d652f70656e666f6c642f6d617474696a732f666f616d2f6d617474696a73322e312f6170706c69636174696f6e732f7574696c2f466f616d582f4a6176617371007e00027371007e0006000000507371007e0008007371007e000b740025466f616d582f5265706f7274696e672f5265706f7274696e674d616e616765722e6a61766171007e000f7371007e00027371007e000600000050737200436f72672e6e65746265616e732e6d6f64756c65732e6a6176612e4a617661446174614f626a6563742450657273697374656e74436f6e6e656374696f6e48616e646c65ba16f1d2dd4c1cb60200014c000e646174614e6f646548616e646c6574001f4c6f72672f6f70656e6964652f6e6f6465732f4e6f64652448616e646c653b78707371007e00080071007e001378"/>
|
||||
</fileobject>
|
||||
<fileobject name="CreateCaseDialog.java">
|
||||
<attr name="class_dependency_javax.swing.JDialog" stringvalue="CreateCaseDialog"/>
|
||||
<attr name="template" serialvalue="aced0005737200266f72672e6f70656e6964652e7574696c2e696f2e4e624d61727368616c6c65644f626a6563746cd5cc1aa397c0f2020002490004686173685b00086f626a42797465737400025b4278700000001170"/>
|
||||
</fileobject>
|
||||
<fileobject name="CasePanel.java">
|
||||
<attr name="class_dependency_javax.swing.JPanel" stringvalue="CasePanel"/>
|
||||
<attr name="class_dependency_javax.swing.AbstractAction" stringvalue="CasePanel.StartCalculationAction;CasePanel.RunCalculationAction;CasePanel.SaveCaseAction;CasePanel.CloseCaseAction;CasePanel.StopCalculationAction"/>
|
||||
<attr name="template" serialvalue="aced0005737200266f72672e6f70656e6964652e7574696c2e696f2e4e624d61727368616c6c65644f626a6563746cd5cc1aa397c0f2020002490004686173685b00086f626a42797465737400025b4278700000001170"/>
|
||||
</fileobject>
|
||||
<fileobject name="CloneCaseDialog.java">
|
||||
<attr name="class_dependency_javax.swing.JDialog" stringvalue="CloneCaseDialog"/>
|
||||
</fileobject>
|
||||
<fileobject name="IModule.java">
|
||||
<attr name="EA-OpenIDE-Connection" serialvalue="aced0005737200146a6176612e7574696c2e4c696e6b65644c6973740c29535d4a608822030000787077040000000078"/>
|
||||
</fileobject>
|
||||
<fileobject name="CaseStatusListener.java">
|
||||
<attr name="EA-OpenIDE-Connection" serialvalue="aced0005737200146a6176612e7574696c2e4c696e6b65644c6973740c29535d4a60882203000078707704000000027372002a6f72672e6f70656e6964652e6c6f61646572732e436f6e6e656374696f6e537570706f72742450616972055f8af6f04a3bd80200024c00047479706574002b4c6f72672f6f70656e6964652f636f6f6b6965732f436f6e6e656374696f6e436f6f6b696524547970653b4c000576616c75657400124c6a6176612f6c616e672f4f626a6563743b78707372002e6f72672e6e65746265616e732e6d6f64756c65732e6a6176612e4a617661436f6e6e656374696f6e732454797065a83dd01001306d7402000149000666696c746572787000000050737200296f72672e6f70656e6964652e6c6f61646572732e446174614e6f6465244f626a65637448616e646c655bd0f82e01811d2e0200025a0005636c6f6e654c00036f626a7400244c6f72672f6f70656e6964652f66696c6573797374656d732f46696c654f626a6563743b787000737200326f72672e6f70656e6964652e66696c6573797374656d732e416273747261637446696c654f626a656374245265706c616365896fa1bce4b5219f0200024c000866696c654e616d657400124c6a6176612f6c616e672f537472696e673b4c000666734e616d6571007e000c7870740025466f616d582f436173654d616e6167656d656e742f436173654d616e616765722e6a6176617400422f686f6d652f70656e666f6c642f6d617474696a732f666f616d2f6d617474696a73322e312f6170706c69636174696f6e732f7574696c2f466f616d582f4a6176617371007e00027371007e000600000050737200436f72672e6e65746265616e732e6d6f64756c65732e6a6176612e4a617661446174614f626a6563742450657273697374656e74436f6e6e656374696f6e48616e646c65ba16f1d2dd4c1cb60200014c000e646174614e6f646548616e646c6574001f4c6f72672f6f70656e6964652f6e6f6465732f4e6f64652448616e646c653b78707371007e00080071007e000d78"/>
|
||||
<attr name="template" serialvalue="aced0005737200266f72672e6f70656e6964652e7574696c2e696f2e4e624d61727368616c6c65644f626a6563746cd5cc1aa397c0f2020002490004686173685b00086f626a42797465737400025b4278700000001170"/>
|
||||
</fileobject>
|
||||
<fileobject name="CaseStatusEvent.java">
|
||||
<attr name="template" serialvalue="aced0005737200266f72672e6f70656e6964652e7574696c2e696f2e4e624d61727368616c6c65644f626a6563746cd5cc1aa397c0f2020002490004686173685b00086f626a42797465737400025b4278700000001170"/>
|
||||
</fileobject>
|
||||
<fileobject name="CaseManager.java">
|
||||
<attr name="class_dependency_javax.swing.JPanel" stringvalue="CaseManager"/>
|
||||
<attr name="class_dependency_javax.swing.event.ChangeListener" stringvalue="CaseManager"/>
|
||||
<attr name="template" serialvalue="aced0005737200266f72672e6f70656e6964652e7574696c2e696f2e4e624d61727368616c6c65644f626a6563746cd5cc1aa397c0f2020002490004686173685b00086f626a42797465737400025b4278700000001170"/>
|
||||
</fileobject>
|
||||
<fileobject name="ContextInfo.java">
|
||||
<attr name="template" serialvalue="aced0005737200266f72672e6f70656e6964652e7574696c2e696f2e4e624d61727368616c6c65644f626a6563746cd5cc1aa397c0f2020002490004686173685b00086f626a42797465737400025b4278700000001170"/>
|
||||
</fileobject>
|
||||
<fileobject name="IFoamXModule.java">
|
||||
<attr name="EA-OpenIDE-Connection" serialvalue="aced0005737200146a6176612e7574696c2e4c696e6b65644c6973740c29535d4a60882203000078707704000000077372002a6f72672e6f70656e6964652e6c6f61646572732e436f6e6e656374696f6e537570706f72742450616972055f8af6f04a3bd80200024c00047479706574002b4c6f72672f6f70656e6964652f636f6f6b6965732f436f6e6e656374696f6e436f6f6b696524547970653b4c000576616c75657400124c6a6176612f6c616e672f4f626a6563743b78707372002e6f72672e6e65746265616e732e6d6f64756c65732e6a6176612e4a617661436f6e6e656374696f6e732454797065a83dd01001306d7402000149000666696c746572787000000050737200296f72672e6f70656e6964652e6c6f61646572732e446174614e6f6465244f626a65637448616e646c655bd0f82e01811d2e0200025a0005636c6f6e654c00036f626a7400244c6f72672f6f70656e6964652f66696c6573797374656d732f46696c654f626a6563743b787000737200326f72672e6f70656e6964652e66696c6573797374656d732e416273747261637446696c654f626a65637424496e76616c6964c0bb2fa0ec2461140200024c000866756c6c4e616d657400124c6a6176612f6c616e672f537472696e673b4c00046e616d6571007e000c787200226f72672e6f70656e6964652e66696c6573797374656d732e46696c654f626a656374012f10797d5a7af60200007870740038466f616d582f4d6f64756c65732f536f6c7574696f6e506172616d65746572732f536f6c7574696f6e506172616d65746572732e6a617661740017536f6c7574696f6e506172616d65746572732e6a6176617371007e00027371007e0006000000507371007e0008007371007e000b740036466f616d582f4d6f64756c65732f44696374696f6e61727942726f777365722f44696374696f6e61727942726f777365722e6a61766174001644696374696f6e61727942726f777365722e6a6176617371007e00027371007e0006000000507371007e0008007371007e000b740032466f616d582f4d6f64756c65732f5061746368446566696e6974696f6e2f5061746368446566696e6974696f6e2e6a6176617400145061746368446566696e6974696f6e2e6a6176617371007e00027371007e0006000000507371007e0008007371007e000b740032466f616d582f44696374696f6e617279456469746f722f44696374696f6e617279456469746f724d6f64756c652e6a61766174001b44696374696f6e617279456469746f724d6f64756c652e6a6176617371007e00027371007e0006000000507371007e0008007371007e000b740038466f616d582f52617744696374696f6e617279456469746f722f52617744696374696f6e617279456469746f724d6f64756c652e6a61766174001e52617744696374696f6e617279456469746f724d6f64756c652e6a6176617371007e00027371007e0006000000507371007e000800737200326f72672e6f70656e6964652e66696c6573797374656d732e416273747261637446696c654f626a656374245265706c616365896fa1bce4b5219f0200024c000866696c654e616d6571007e000c4c000666734e616d6571007e000c7870740040466f616d582f4d6f64756c65732f52617744696374696f6e617279456469746f722f52617744696374696f6e617279456469746f724d6f64756c652e6a6176617400372f686f6d652f6470682f50726f6a656374732f666f616d322e302f6170706c69636174696f6e732f7574696c2f466f616d582f4a6176617371007e00027371007e0006000000507371007e0008007371007e002c74002e466f616d582f4d6f64756c65732f43617365456469746f722f43617365456469746f724d6f64756c652e6a61766171007e002f78"/>
|
||||
</fileobject>
|
||||
<fileobject name="CaseChooser2.java">
|
||||
<attr name="class_dependency_FoamX.CaseManagement.CaseSelectionListener" stringvalue="CaseChooser"/>
|
||||
<attr name="class_dependency_javax.swing.JDialog" stringvalue="CaseChooser"/>
|
||||
</fileobject>
|
||||
<fileobject name="HostChooserDlg.java">
|
||||
<attr name="class_dependency_javax.swing.JDialog" stringvalue="HostChooserDlg"/>
|
||||
</fileobject>
|
||||
<fileobject name="CaseBrowserPanel.java">
|
||||
<attr name="class_dependency_javax.swing.JPanel" stringvalue="CaseBrowserPanel"/>
|
||||
<attr name="class_dependency_javax.swing.AbstractAction" stringvalue="CaseBrowserPanel.UnlockCaseAction;CaseBrowserPanel.StartCaseBrowserAction;CaseBrowserPanel.RefreshAction;CaseBrowserPanel.StopCaseBrowserAction;CaseBrowserPanel.SelectCaseAction;CaseBrowserPanel.OpenCaseAction;CaseBrowserPanel.CloneCaseAction;CaseBrowserPanel.EditApplicationClassesAction;CaseBrowserPanel.DeleteCaseAction;CaseBrowserPanel.ImportCaseAction;CaseBrowserPanel.SelectRootAction;CaseBrowserPanel.CreateCaseAction"/>
|
||||
<attr name="class_dependency_FoamX.Util.TabSelection" stringvalue="CaseBrowserPanel"/>
|
||||
<attr name="template" serialvalue="aced0005737200266f72672e6f70656e6964652e7574696c2e696f2e4e624d61727368616c6c65644f626a6563746cd5cc1aa397c0f2020002490004686173685b00086f626a42797465737400025b4278700000001170"/>
|
||||
</fileobject>
|
||||
<fileobject name="TreeNodeInfo.java">
|
||||
<attr name="class_dependency_FoamX.Util.FoamXTreeRenderer.FoamXTreeItem" stringvalue="TreeNodeInfo"/>
|
||||
</fileobject>
|
||||
<fileobject name="IFoamXModuleHost.java">
|
||||
<attr name="EA-OpenIDE-Connection" serialvalue="aced0005737200146a6176612e7574696c2e4c696e6b65644c6973740c29535d4a60882203000078707704000000027372002a6f72672e6f70656e6964652e6c6f61646572732e436f6e6e656374696f6e537570706f72742450616972055f8af6f04a3bd80200024c00047479706574002b4c6f72672f6f70656e6964652f636f6f6b6965732f436f6e6e656374696f6e436f6f6b696524547970653b4c000576616c75657400124c6a6176612f6c616e672f4f626a6563743b78707372002e6f72672e6e65746265616e732e6d6f64756c65732e6a6176612e4a617661436f6e6e656374696f6e732454797065a83dd01001306d7402000149000666696c746572787000000050737200296f72672e6f70656e6964652e6c6f61646572732e446174614e6f6465244f626a65637448616e646c655bd0f82e01811d2e0200025a0005636c6f6e654c00036f626a7400244c6f72672f6f70656e6964652f66696c6573797374656d732f46696c654f626a6563743b787000737200326f72672e6f70656e6964652e66696c6573797374656d732e416273747261637446696c654f626a656374245265706c616365896fa1bce4b5219f0200024c000866696c654e616d657400124c6a6176612f6c616e672f537472696e673b4c000666734e616d6571007e000c7870740023466f616d582f436173654d616e6167656d656e742f4361736550616e656c2e6a6176617400372f686f6d652f6470682f50726f6a656374732f666f616d322e302f6170706c69636174696f6e732f7574696c2f466f616d582f4a6176617371007e00027371007e000600000050737200436f72672e6e65746265616e732e6d6f64756c65732e6a6176612e4a617661446174614f626a6563742450657273697374656e74436f6e6e656374696f6e48616e646c65ba16f1d2dd4c1cb60200014c000e646174614e6f646548616e646c6574001f4c6f72672f6f70656e6964652f6e6f6465732f4e6f64652448616e646c653b78707371007e00080071007e000d78"/>
|
||||
<attr name="template" serialvalue="aced0005737200266f72672e6f70656e6964652e7574696c2e696f2e4e624d61727368616c6c65644f626a6563746cd5cc1aa397c0f2020002490004686173685b00086f626a42797465737400025b4278700000001170"/>
|
||||
</fileobject>
|
||||
<fileobject name="CaseSelectionListener.java">
|
||||
<attr name="EA-OpenIDE-Connection" serialvalue="aced0005737200146a6176612e7574696c2e4c696e6b65644c6973740c29535d4a60882203000078707704000000017372002a6f72672e6f70656e6964652e6c6f61646572732e436f6e6e656374696f6e537570706f72742450616972055f8af6f04a3bd80200024c00047479706574002b4c6f72672f6f70656e6964652f636f6f6b6965732f436f6e6e656374696f6e436f6f6b696524547970653b4c000576616c75657400124c6a6176612f6c616e672f4f626a6563743b78707372002e6f72672e6e65746265616e732e6d6f64756c65732e6a6176612e4a617661436f6e6e656374696f6e732454797065a83dd01001306d7402000149000666696c746572787000000050737200436f72672e6e65746265616e732e6d6f64756c65732e6a6176612e4a617661446174614f626a6563742450657273697374656e74436f6e6e656374696f6e48616e646c65ba16f1d2dd4c1cb60200014c000e646174614e6f646548616e646c6574001f4c6f72672f6f70656e6964652f6e6f6465732f4e6f64652448616e646c653b7870737200296f72672e6f70656e6964652e6c6f61646572732e446174614e6f6465244f626a65637448616e646c655bd0f82e01811d2e0200025a0005636c6f6e654c00036f626a7400244c6f72672f6f70656e6964652f66696c6573797374656d732f46696c654f626a6563743b787000737200326f72672e6f70656e6964652e66696c6573797374656d732e416273747261637446696c654f626a656374245265706c616365896fa1bce4b5219f0200024c000866696c654e616d657400124c6a6176612f6c616e672f537472696e673b4c000666734e616d6571007e000f787074001f436173654d616e6167656d656e742f4361736543686f6f7365722e6a6176617400482f686f6d652f70656e666f6c642f6d617474696a732f666f616d2f6d617474696a73322e312f6170706c69636174696f6e732f7574696c2f466f616d582f4a6176612f466f616d5878"/>
|
||||
</fileobject>
|
||||
</attributes>
|
||||
@ -1,887 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
package FoamX.CaseManagement;
|
||||
|
||||
import java.util.Hashtable;
|
||||
import java.util.Properties;
|
||||
import java.util.Enumeration;
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.*;
|
||||
|
||||
import org.omg.CosNaming.*;
|
||||
|
||||
import FoamX.App;
|
||||
import FoamX.Exceptions.FoamXException;
|
||||
|
||||
import FoamXServer.*;
|
||||
import FoamXServer.CaseServer.*;
|
||||
|
||||
import FoamXServer.CaseBrowser.ICaseBrowser;
|
||||
import FoamXServer.CaseBrowser.ICaseBrowserHolder;
|
||||
import FoamXServer.CaseDescriptor;
|
||||
import FoamXServer.FoamXError;
|
||||
import FoamXServer.FoamXIOError;
|
||||
import FoamXServer.HostBrowser.IHostBrowser;
|
||||
|
||||
public class CaseBrowserModel
|
||||
extends DefaultTreeModel
|
||||
{
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
protected IHostBrowser hostBrowser_;
|
||||
protected DefaultMutableTreeNode root_;
|
||||
protected Hashtable hostMap_; // from host to treeNode
|
||||
protected Hashtable rootDirMap_; // from root to treeNode
|
||||
protected Hashtable keyMap_; // from key (root/case) to treeNode
|
||||
protected ICaseBrowser caseBrowserCopy_;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/** CaseManagerModel constructor. */
|
||||
public CaseBrowserModel()
|
||||
{
|
||||
super(new DefaultMutableTreeNode());
|
||||
|
||||
try
|
||||
{
|
||||
// Get reference to root node.
|
||||
root_ = (DefaultMutableTreeNode)getRoot();
|
||||
|
||||
// Create host map.
|
||||
hostMap_ = new Hashtable(10);
|
||||
rootDirMap_ = new Hashtable(10);
|
||||
keyMap_ = new Hashtable(10);
|
||||
|
||||
// Initialise the model.
|
||||
// Show only the Hosts node unless the model is refreshed.
|
||||
hostBrowser_ = null;
|
||||
root_.setUserObject
|
||||
(
|
||||
new ContextInfo("Hosts", ContextInfo.INVALID_REF)
|
||||
);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
App.handleAllExceptions(ex);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/** Initialise the (licenseHosts) tree model. */
|
||||
protected void initialiseModel()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Get host manager reference.
|
||||
hostBrowser_ = App.getHostBrowser();
|
||||
|
||||
if (hostBrowser_ != null)
|
||||
{
|
||||
// Set root node's context info object.
|
||||
root_.removeAllChildren();
|
||||
root_.setUserObject
|
||||
(
|
||||
new ContextInfo("Hosts", ContextInfo.ROOTCONTEXT)
|
||||
);
|
||||
|
||||
// Add a host node for each host.
|
||||
HostDescriptor[] licensedHosts = hostBrowser_.hosts();
|
||||
for (int i=0; i <licensedHosts.length; i++)
|
||||
{
|
||||
|
||||
// Create new contextInfo object for this FoamX host.
|
||||
ContextInfo contextInfo;
|
||||
if (licensedHosts[i].alive)
|
||||
{
|
||||
contextInfo = new ContextInfo
|
||||
(
|
||||
licensedHosts[i].name,
|
||||
ContextInfo.HOST
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
contextInfo = new ContextInfo
|
||||
(
|
||||
licensedHosts[i].name,
|
||||
ContextInfo.HOSTOFFLINE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
contextInfo.setStatusText
|
||||
(
|
||||
"FoamX Host : " + contextInfo.toString()
|
||||
);
|
||||
|
||||
// Insert node into tree.
|
||||
DefaultMutableTreeNode node = new DefaultMutableTreeNode
|
||||
(
|
||||
contextInfo,
|
||||
true
|
||||
);
|
||||
|
||||
insertNodeInto(node, root_, root_.getChildCount());
|
||||
|
||||
// Add to host map.
|
||||
hostMap_.put(licensedHosts[i].name, node);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
App.handleAllExceptions(ex);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* Refresh the tree model. Use forceReread only if reread from disk
|
||||
*/
|
||||
public void refresh(boolean forceReread)
|
||||
{
|
||||
try
|
||||
{
|
||||
// If we don't yet have a host manager reference,
|
||||
// try and re-initialise the model.
|
||||
if (hostBrowser_ == null) initialiseModel();
|
||||
|
||||
// Clear map from root/case to treeInfo
|
||||
keyMap_.clear();
|
||||
|
||||
// Loop over all host nodes.
|
||||
Enumeration iter = hostMap_.keys();
|
||||
while (iter.hasMoreElements())
|
||||
{
|
||||
String hostName = (String)iter.nextElement();
|
||||
|
||||
// Get host node.
|
||||
DefaultMutableTreeNode hostNode =
|
||||
(DefaultMutableTreeNode)hostMap_.get(hostName);
|
||||
ContextInfo context = (ContextInfo)hostNode.getUserObject();
|
||||
|
||||
// See if a case browser is running for this host.
|
||||
if (context.getCaseBrowser() != null)
|
||||
{
|
||||
// Remove all child nodes from the host node.
|
||||
hostNode.removeAllChildren();
|
||||
|
||||
if (forceReread)
|
||||
{
|
||||
// Refresh caseBrowser's information
|
||||
context.getCaseBrowser().refreshCaseList();
|
||||
}
|
||||
|
||||
// Re-initialise the hostnode.
|
||||
addCaseBrowserNodes(hostNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
App.handleAllExceptions(ex);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* Refresh the tree model for one root directory only.
|
||||
*/
|
||||
public void refreshRoot(String hostName, String caseRoot)
|
||||
{
|
||||
try
|
||||
{
|
||||
// If we don't yet have a host manager reference,
|
||||
// try and re-initialise the model.
|
||||
if (hostBrowser_ == null) initialiseModel();
|
||||
|
||||
// Find context for give host
|
||||
DefaultMutableTreeNode hostNode =
|
||||
(DefaultMutableTreeNode)hostMap_.get(hostName);
|
||||
ContextInfo context = (ContextInfo)hostNode.getUserObject();
|
||||
|
||||
// See if a case browser is running for this host.
|
||||
if (context.getCaseBrowser() != null)
|
||||
{
|
||||
if (!rootDirMap_.containsKey(caseRoot))
|
||||
{
|
||||
throw new FoamXException
|
||||
(
|
||||
"Invalid caseRoot '" + caseRoot + "'"
|
||||
);
|
||||
}
|
||||
|
||||
// Re-initialise the hostnode.
|
||||
addRootDirNodes
|
||||
(
|
||||
hostNode,
|
||||
caseRoot,
|
||||
(DefaultMutableTreeNode)rootDirMap_.get(caseRoot));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
App.handleAllExceptions(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* Refresh the host tree model.
|
||||
*/
|
||||
public void refreshHosts()
|
||||
{
|
||||
try
|
||||
{
|
||||
// If we don't yet have a host manager reference,
|
||||
// try and re-initialise the model.
|
||||
if (hostBrowser_ == null) initialiseModel();
|
||||
|
||||
// Have hostbrowser determine accessability of hosts
|
||||
hostBrowser_.refreshHostList();
|
||||
|
||||
// Update information on tree
|
||||
HostDescriptor[] licensedHosts = hostBrowser_.hosts();
|
||||
for (int i=0; i <licensedHosts.length; i++)
|
||||
{
|
||||
// Get host node.
|
||||
DefaultMutableTreeNode hostNode =
|
||||
(DefaultMutableTreeNode)hostMap_.get(licensedHosts[i].name);
|
||||
if (hostNode == null)
|
||||
{
|
||||
throw new FoamXException
|
||||
(
|
||||
"Host not found in hostMap : " + licensedHosts[i].name
|
||||
);
|
||||
}
|
||||
|
||||
ContextInfo context = (ContextInfo)hostNode.getUserObject();
|
||||
|
||||
if (licensedHosts[i].alive)
|
||||
{
|
||||
context.setType(ContextInfo.HOST);
|
||||
}
|
||||
else
|
||||
{
|
||||
context.setType(ContextInfo.HOSTOFFLINE);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (FoamXError fxErr)
|
||||
{
|
||||
App.handleException(fxErr);
|
||||
}
|
||||
catch (FoamXException fxEx)
|
||||
{
|
||||
App.handleException(fxEx);
|
||||
}
|
||||
}
|
||||
|
||||
// //--------------------------------------------------------------------------
|
||||
// /** Get hostName for given caseBrowser */
|
||||
// public String getHostName(ICaseBrowser caseBrowser)
|
||||
// {
|
||||
//
|
||||
// // Loop over all host nodes.
|
||||
// itereration iter = hostMap_.keys();
|
||||
// while (iter.hasMoreElements())
|
||||
// {
|
||||
// String hostName = (String)iter.nextElement();
|
||||
//
|
||||
// // Get host node.
|
||||
// DefaultMutableTreeNode hostNode =
|
||||
// (DefaultMutableTreeNode)hostMap_.get(hostName);
|
||||
// ContextInfo context = (ContextInfo)hostNode.getUserObject();
|
||||
//
|
||||
// if (context.getCaseBrowser() == caseBrowser)
|
||||
// {
|
||||
// return hostName;
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
// Connects to existing/starts new caseBrowser. Returns true if started.
|
||||
static private void getCaseBrowserReference
|
||||
(
|
||||
final String hostName,
|
||||
final IHostBrowser hostBrowser,
|
||||
ICaseBrowserHolder browserHolder
|
||||
) throws FoamXException, FoamXSYSError, FoamXError, FoamXIOError
|
||||
{
|
||||
boolean hostOK = false;
|
||||
|
||||
int sleep = Integer.parseInt
|
||||
(
|
||||
App.getOptions().getProperty("FoamX.Sleep", "500")
|
||||
);
|
||||
int nRetries = Integer.parseInt
|
||||
(
|
||||
App.getOptions().getProperty("FoamX.NRetries", "20")
|
||||
);
|
||||
|
||||
// First try to connect to already running browser
|
||||
hostOK = hostBrowser.getCaseBrowserReference
|
||||
(
|
||||
hostName,
|
||||
browserHolder
|
||||
);
|
||||
if (hostOK)
|
||||
{
|
||||
ICaseBrowser caseBrowser = browserHolder.value;
|
||||
String[] options = { "Use", "Cancel" };
|
||||
int ret =
|
||||
JOptionPane.showOptionDialog
|
||||
(
|
||||
App.getRootFrame(),
|
||||
"Found running Case Browser"
|
||||
+ "\nUse it ?",
|
||||
"Case Browser",
|
||||
JOptionPane.DEFAULT_OPTION,
|
||||
JOptionPane.QUESTION_MESSAGE,
|
||||
null,
|
||||
options,
|
||||
options[0]
|
||||
);
|
||||
if (ret == 0) return;
|
||||
}
|
||||
|
||||
// Start case browser
|
||||
hostBrowser.openCaseBrowser(hostName);
|
||||
|
||||
// Go into loop to detect when it has registered.
|
||||
for (;;)
|
||||
{
|
||||
for (int i=0; i<nRetries; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.currentThread().sleep(sleep);
|
||||
}
|
||||
catch (InterruptedException ie)
|
||||
{}
|
||||
|
||||
hostOK = hostBrowser.getCaseBrowserReference
|
||||
(
|
||||
hostName,
|
||||
browserHolder
|
||||
);
|
||||
|
||||
if (hostOK) return;
|
||||
}
|
||||
|
||||
if (!hostOK)
|
||||
{
|
||||
String[] options = { "Retry", "Exit" };
|
||||
int ret =
|
||||
JOptionPane.showOptionDialog
|
||||
(
|
||||
App.getRootFrame(),
|
||||
"Case Browser cannot be contacted.",
|
||||
"Case Browser",
|
||||
JOptionPane.DEFAULT_OPTION,
|
||||
JOptionPane.ERROR_MESSAGE,
|
||||
null,
|
||||
options,
|
||||
options[0]
|
||||
);
|
||||
if (ret != 0)
|
||||
{
|
||||
throw new FoamXException
|
||||
(
|
||||
"No caseBrowser started on "
|
||||
+ hostName
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
boolean startCaseBrowser(String hostName)
|
||||
{
|
||||
boolean ret = false;
|
||||
|
||||
try
|
||||
{
|
||||
// Lookup the host node.
|
||||
if (!hostMap_.containsKey(hostName))
|
||||
{
|
||||
throw new FoamXException
|
||||
(
|
||||
"Invalid host name '" + hostName + "'"
|
||||
);
|
||||
}
|
||||
|
||||
DefaultMutableTreeNode hostNode =
|
||||
(DefaultMutableTreeNode)hostMap_.get(hostName);
|
||||
ContextInfo context = (ContextInfo)hostNode.getUserObject();
|
||||
|
||||
// Make sure that the case browser is not running on this host.
|
||||
if (context.getCaseBrowser() != null)
|
||||
{
|
||||
throw new FoamXException
|
||||
(
|
||||
"Case browser already running on host'" + hostName + "'"
|
||||
);
|
||||
}
|
||||
|
||||
ICaseBrowserHolder holder = new ICaseBrowserHolder();
|
||||
|
||||
getCaseBrowserReference(hostName, hostBrowser_, holder);
|
||||
|
||||
// Attach the case browser object to the host node.
|
||||
ICaseBrowser caseBrowser = holder.value;
|
||||
context.setCaseBrowser(caseBrowser);
|
||||
|
||||
// Build the case details under this node.
|
||||
addCaseBrowserNodes(hostNode);
|
||||
|
||||
// Return success code.
|
||||
ret = true;
|
||||
}
|
||||
catch (FoamXSYSError sysErr)
|
||||
{
|
||||
App.handleException(sysErr);
|
||||
}
|
||||
catch (FoamXError fxErr)
|
||||
{
|
||||
App.handleException(fxErr);
|
||||
}
|
||||
catch (FoamXException fxEx)
|
||||
{
|
||||
App.handleException(fxEx);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
App.handleAllExceptions(ex);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
// Change contextInfo to show host is inaccessible
|
||||
void setHostOffLine(String hostName, String msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Lookup the host node.
|
||||
if (!hostMap_.containsKey(hostName))
|
||||
{
|
||||
throw new FoamXException
|
||||
(
|
||||
"Invalid host name '" + hostName + "'"
|
||||
);
|
||||
}
|
||||
|
||||
DefaultMutableTreeNode hostNode =
|
||||
(DefaultMutableTreeNode)hostMap_.get(hostName);
|
||||
ContextInfo context = (ContextInfo)hostNode.getUserObject();
|
||||
|
||||
// Mark this server as offline.
|
||||
context.setType(ContextInfo.HOSTOFFLINE);
|
||||
context.setStatusText(msg);
|
||||
|
||||
// Tell hostBrowser
|
||||
hostBrowser_.hostIsDead(hostName);
|
||||
}
|
||||
catch (FoamXError fxErr)
|
||||
{
|
||||
App.handleException(fxErr);
|
||||
}
|
||||
catch (FoamXException fxEx)
|
||||
{
|
||||
App.handleException(fxEx);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
void stopCaseBrowser(String hostName)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Lookup the host node.
|
||||
if (!hostMap_.containsKey(hostName))
|
||||
{
|
||||
throw new FoamXException
|
||||
(
|
||||
"Invalid host name '" + hostName + "'"
|
||||
);
|
||||
}
|
||||
|
||||
DefaultMutableTreeNode hostNode =
|
||||
(DefaultMutableTreeNode)hostMap_.get(hostName);
|
||||
|
||||
ContextInfo context = (ContextInfo)hostNode.getUserObject();
|
||||
|
||||
// Make sure that the case browser is running on this host.
|
||||
ICaseBrowser caseBrowser = context.getCaseBrowser();
|
||||
if (caseBrowser == null)
|
||||
{
|
||||
throw new FoamXException
|
||||
(
|
||||
"Case browser not running on host '" + hostName + "'"
|
||||
);
|
||||
}
|
||||
|
||||
// // Clear the cases map for cases managed by this caseBrowser.
|
||||
// CaseDescriptor[] cases = caseBrowser.cases();
|
||||
// for (int i = 0; i <cases.length; i++)
|
||||
// {
|
||||
// String key =
|
||||
// cases[i].rootDir + "/" + cases[i].caseName;
|
||||
//
|
||||
// if (!keyMap_.containsKey(key))
|
||||
// {
|
||||
// throw new FoamXException
|
||||
// (
|
||||
// "Case not in tree : " + key
|
||||
// );
|
||||
// }
|
||||
// keyMap_.remove(key);
|
||||
// }
|
||||
|
||||
keyMap_.clear();
|
||||
|
||||
// Detach the case browser object from the host node.
|
||||
context.setCaseBrowser(null);
|
||||
|
||||
// Close the C++ caseBrowser.
|
||||
caseBrowser.close();
|
||||
|
||||
// Remove all child nodes from the host node.
|
||||
hostNode.removeAllChildren();
|
||||
|
||||
|
||||
}
|
||||
catch (FoamXException fxEx)
|
||||
{
|
||||
App.handleException(fxEx);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
App.handleAllExceptions(ex);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
// Build caseRoot nodes for hostNode
|
||||
protected void addCaseBrowserNodes(DefaultMutableTreeNode hostNode)
|
||||
{
|
||||
try
|
||||
{
|
||||
ContextInfo hostContext = (ContextInfo)hostNode.getUserObject();
|
||||
ICaseBrowser caseBrowser = hostContext.getCaseBrowser();
|
||||
|
||||
if (caseBrowser == null)
|
||||
{
|
||||
throw new FoamXException("Invalid case browser reference.");
|
||||
}
|
||||
|
||||
// Get a list of cases served by this case browser.
|
||||
String[] roots =
|
||||
caseBrowser.foamProperties().rootDirectories();
|
||||
String[] rawRoots =
|
||||
caseBrowser.foamProperties().rawRootDirectories();
|
||||
|
||||
// Loop over all case roots.
|
||||
for (int i = 0; i <roots.length; i++)
|
||||
{
|
||||
// Add a new case root node.
|
||||
// Use original name as display name but expanded one as
|
||||
// case root.
|
||||
ContextInfo caseRootContextInfo = new ContextInfo
|
||||
(
|
||||
caseBrowser,
|
||||
roots[i],
|
||||
rawRoots[i]
|
||||
);
|
||||
|
||||
// Add a new case root node.
|
||||
caseRootContextInfo.setStatusText
|
||||
(
|
||||
"Root Directory : " + rawRoots[i]
|
||||
);
|
||||
|
||||
DefaultMutableTreeNode caseRootNode =
|
||||
new DefaultMutableTreeNode
|
||||
(
|
||||
caseRootContextInfo,
|
||||
true
|
||||
);
|
||||
|
||||
insertNodeInto
|
||||
(
|
||||
caseRootNode,
|
||||
hostNode,
|
||||
hostNode.getChildCount()
|
||||
);
|
||||
|
||||
// Store reference to node
|
||||
rootDirMap_.put(roots[i], caseRootNode);
|
||||
//
|
||||
// // Add cases
|
||||
// addRootDirNodes(hostNode, roots[i], caseRootNode);
|
||||
}
|
||||
}
|
||||
catch (FoamXException fxEx)
|
||||
{
|
||||
App.handleException(fxEx);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
App.handleAllExceptions(ex);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
// Insert cases below caseRoot node
|
||||
protected void addRootDirNodes
|
||||
(
|
||||
DefaultMutableTreeNode hostNode,
|
||||
String caseRoot,
|
||||
DefaultMutableTreeNode caseRootNode
|
||||
)
|
||||
{
|
||||
try
|
||||
{
|
||||
ContextInfo hostContext = (ContextInfo)hostNode.getUserObject();
|
||||
ICaseBrowser caseBrowser = hostContext.getCaseBrowser();
|
||||
|
||||
if (caseBrowser == null)
|
||||
{
|
||||
throw new FoamXException("Invalid case browser reference.");
|
||||
}
|
||||
|
||||
// Refresh caseBrowser's information
|
||||
caseBrowser.addToCaseList(caseRoot);
|
||||
|
||||
// Loop over all cases and add case nodes.
|
||||
CaseDescriptor[] cases = caseBrowser.cases();
|
||||
|
||||
// Clear the caseRoot tree
|
||||
caseRootNode.removeAllChildren();
|
||||
|
||||
for (int i = 0; i < cases.length; i++)
|
||||
{
|
||||
if (cases[i].rootDir.equals(caseRoot))
|
||||
{
|
||||
// Add case node.
|
||||
ContextInfo caseNameContextInfo = new ContextInfo
|
||||
(
|
||||
caseBrowser,
|
||||
cases[i]
|
||||
);
|
||||
|
||||
caseNameContextInfo.setStatusText
|
||||
(
|
||||
"Case : " + cases[i].caseName
|
||||
+ " (" + cases[i].app + ")"
|
||||
);
|
||||
|
||||
DefaultMutableTreeNode caseNode = new DefaultMutableTreeNode
|
||||
(
|
||||
caseNameContextInfo,
|
||||
false
|
||||
);
|
||||
|
||||
insertNodeInto
|
||||
(
|
||||
caseNode,
|
||||
caseRootNode,
|
||||
caseRootNode.getChildCount()
|
||||
);
|
||||
|
||||
// Update key to tree mapping
|
||||
String key = cases[i].rootDir + "/" + cases[i].caseName;
|
||||
keyMap_.put(key, caseNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (FoamXException fxEx)
|
||||
{
|
||||
App.handleException(fxEx);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
App.handleAllExceptions(ex);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/** Updates single case node.
|
||||
* Used for case closing only.
|
||||
*/
|
||||
protected void refreshCaseNode
|
||||
(
|
||||
String caseRoot,
|
||||
String caseName
|
||||
)
|
||||
{
|
||||
try
|
||||
{
|
||||
// See if we have a treeNode for this case.
|
||||
String key = caseRoot + "/" + caseName;
|
||||
|
||||
if (!keyMap_.containsKey(key))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DefaultMutableTreeNode caseNode =
|
||||
(DefaultMutableTreeNode)keyMap_.get(key);
|
||||
ContextInfo caseNameContextInfo =
|
||||
(ContextInfo)caseNode.getUserObject();
|
||||
ICaseBrowser caseBrowser = caseNameContextInfo.getCaseBrowser();
|
||||
|
||||
// Update contextinfo for caseNode
|
||||
// Go back to caseBrowser list and look for caseDescriptor for
|
||||
// my case
|
||||
//caseBrowser.addToCaseList(caseRoot);
|
||||
CaseDescriptor[] cases = caseBrowser.cases();
|
||||
CaseDescriptor caseDescriptor = null;
|
||||
for (int i = 0; i <cases.length; i++)
|
||||
{
|
||||
if
|
||||
(
|
||||
(caseRoot.equals(cases[i].rootDir))
|
||||
&& (caseName.equals(cases[i].caseName))
|
||||
)
|
||||
{
|
||||
caseDescriptor = cases[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (caseDescriptor == null)
|
||||
{
|
||||
throw new FoamXException
|
||||
(
|
||||
"Case not in caseBrowser : " + key
|
||||
);
|
||||
}
|
||||
|
||||
// Release old references.
|
||||
cases = null;
|
||||
caseNameContextInfo.setCaseBrowser(null);
|
||||
caseNameContextInfo.setCaseDescriptor(null);
|
||||
|
||||
// Update user object on tree node with current caseDescriptor
|
||||
caseNode.setUserObject
|
||||
(
|
||||
new ContextInfo(caseBrowser, caseDescriptor)
|
||||
);
|
||||
}
|
||||
catch (FoamXException fxEx)
|
||||
{
|
||||
App.handleException(fxEx);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/** Deletes single case node.
|
||||
*/
|
||||
protected void deleteCaseNode
|
||||
(
|
||||
String caseRoot,
|
||||
String caseName
|
||||
)
|
||||
{
|
||||
try
|
||||
{
|
||||
// See if we have a treeNode for this case.
|
||||
String key = caseRoot + "/" + caseName;
|
||||
|
||||
if (!keyMap_.containsKey(key))
|
||||
{
|
||||
// Not in tree
|
||||
throw new FoamXException
|
||||
(
|
||||
"Case not in caseBrowser : " + key
|
||||
);
|
||||
}
|
||||
|
||||
// Remove treeNode
|
||||
DefaultMutableTreeNode caseNode =
|
||||
(DefaultMutableTreeNode)keyMap_.get(key);
|
||||
DefaultMutableTreeNode rootNode =
|
||||
(DefaultMutableTreeNode)caseNode.getParent();
|
||||
|
||||
ContextInfo caseNameContextInfo =
|
||||
(ContextInfo)caseNode.getUserObject();
|
||||
|
||||
// Release old references.
|
||||
caseNameContextInfo.setCaseBrowser(null);
|
||||
caseNameContextInfo.setCaseDescriptor(null);
|
||||
|
||||
// Remove caseNode from tree
|
||||
rootNode.remove(caseNode);
|
||||
}
|
||||
catch (FoamXException fxEx)
|
||||
{
|
||||
App.handleException(fxEx);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/** Close all case browsers. */
|
||||
public void shutdown()
|
||||
{
|
||||
// Clear keyMap
|
||||
keyMap_.clear();
|
||||
|
||||
// Loop over all host nodes.
|
||||
Enumeration iter = hostMap_.keys();
|
||||
while (iter.hasMoreElements())
|
||||
{
|
||||
String hostName = (String)iter.nextElement();
|
||||
|
||||
// Get host node.
|
||||
DefaultMutableTreeNode hostNode =
|
||||
(DefaultMutableTreeNode)hostMap_.get(hostName);
|
||||
ContextInfo context = (ContextInfo)hostNode.getUserObject();
|
||||
|
||||
// See if a case browser is running on this host.
|
||||
ICaseBrowser caseBrowser = context.getCaseBrowser();
|
||||
if (caseBrowser != null)
|
||||
{
|
||||
// Close the case browser on this node.
|
||||
caseBrowser.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@ -1,44 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.0" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<NonVisualComponents>
|
||||
<Component class="javax.swing.JPopupMenu" name="contextMenu_">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="10" style="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</NonVisualComponents>
|
||||
<SyntheticProperties>
|
||||
</SyntheticProperties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JScrollPane" name="scrollPane_">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints anchor="16" fill="1" gridHeight="1" gridWidth="1" gridX="0" gridY="0" insetsBottom="5" insetsLeft="5" insetsRight="5" insetsTop="5" ipadX="0" ipadY="0" weightX="1.0" weightY="1.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTree" name="tree_">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="10" style="0"/>
|
||||
</Property>
|
||||
<Property name="showsRootHandles" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
|
||||
<Events>
|
||||
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="OnMouseClicked"/>
|
||||
<EventHandler event="treeExpanded" listener="javax.swing.event.TreeExpansionListener" parameters="javax.swing.event.TreeExpansionEvent" handler="OnTreeExpand"/>
|
||||
<EventHandler event="treeWillExpand" listener="javax.swing.event.TreeWillExpandListener" parameters="javax.swing.event.TreeExpansionEvent" handler="OnTreeWillExpand"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,238 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
package FoamX.CaseManagement;
|
||||
|
||||
import java.util.*;
|
||||
import javax.swing.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
import FoamX.App;
|
||||
import FoamX.Exceptions.FoamXException;
|
||||
import FoamX.CaseManagement.CaseBrowserPanel;
|
||||
|
||||
import FoamXServer.CaseBrowser.ICaseBrowser;
|
||||
|
||||
public class CaseChooserDlg
|
||||
extends javax.swing.JDialog
|
||||
implements CaseSelectionListener
|
||||
{
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
protected CaseBrowserPanel caseBrowserPanel_;
|
||||
|
||||
protected String hostName_;
|
||||
protected String caseRoot_;
|
||||
protected String caseName_;
|
||||
protected ICaseBrowser caseBrowser_;
|
||||
|
||||
private static final int DEFAULT_WIDTH = 300;
|
||||
private static final int DEFAULT_HEIGHT = 400;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/** CaseChooserDlg constructor. */
|
||||
public CaseChooserDlg(java.awt.Frame parent, int selectMode)
|
||||
{
|
||||
super(parent, "Select Case", true);
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
// Get current caseBrowserModel from existing caseBrowserPanel
|
||||
CaseManager caseManager = App.getCaseManager();
|
||||
|
||||
if (caseManager == null)
|
||||
{
|
||||
throw new FoamXException
|
||||
(
|
||||
"No caseManager in top-level App."
|
||||
);
|
||||
}
|
||||
|
||||
CaseBrowserModel model =
|
||||
caseManager.getCaseBrowser().getModel();
|
||||
|
||||
// Open new caseBrowserPanel with existing model in
|
||||
// case-selection mode.
|
||||
caseBrowserPanel_ =
|
||||
new CaseBrowserPanel(model, selectMode);
|
||||
|
||||
initComponents();
|
||||
|
||||
// Set title
|
||||
if (selectMode == CaseBrowserPanel.SELECT_ROOT_MODE)
|
||||
{
|
||||
setTitle("Select Root");
|
||||
}
|
||||
else if (selectMode == CaseBrowserPanel.SELECT_CASE_MODE)
|
||||
{
|
||||
setTitle("Select Case");
|
||||
}
|
||||
else if (selectMode == CaseBrowserPanel.OPEN_CASE_MODE)
|
||||
{
|
||||
setTitle("Select Case");
|
||||
}
|
||||
|
||||
// Clear all vars
|
||||
clearSelection();
|
||||
|
||||
// Get warned of any selection
|
||||
caseBrowserPanel_.addCaseSelectionListener(this);
|
||||
}
|
||||
catch (FoamXException ex)
|
||||
{
|
||||
App.handleAllExceptions(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** GUI initialisation */
|
||||
private void initComponents()
|
||||
{
|
||||
getContentPane().add(caseBrowserPanel_);
|
||||
|
||||
addWindowListener
|
||||
(
|
||||
new java.awt.event.WindowAdapter()
|
||||
{
|
||||
public void windowClosing(java.awt.event.WindowEvent evt)
|
||||
{
|
||||
closeDialog(evt);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
caseBrowserPanel_.setPreferredSize
|
||||
(
|
||||
new java.awt.Dimension(DEFAULT_WIDTH, DEFAULT_HEIGHT)
|
||||
);
|
||||
pack();
|
||||
|
||||
java.awt.Dimension screenSize =
|
||||
java.awt.Toolkit.getDefaultToolkit().getScreenSize();
|
||||
setLocation
|
||||
(
|
||||
(screenSize.width-getSize().width)/2,
|
||||
(screenSize.height-getSize().height)/2
|
||||
);
|
||||
}
|
||||
|
||||
private void closeDialog(java.awt.event.WindowEvent evt)
|
||||
{
|
||||
clearSelection();
|
||||
exitWindow();
|
||||
}
|
||||
|
||||
private void clearSelection()
|
||||
{
|
||||
hostName_ = null;
|
||||
caseRoot_ = null;
|
||||
caseName_ = null;
|
||||
caseBrowser_ = null;
|
||||
}
|
||||
|
||||
private void exitWindow()
|
||||
{
|
||||
//caseBrowserPanel_.shutdown();
|
||||
setVisible(false);
|
||||
dispose();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//---- public accessors
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/** get selected host */
|
||||
public String getHostName()
|
||||
{
|
||||
return hostName_;
|
||||
}
|
||||
|
||||
/** get selected root */
|
||||
public String getCaseRoot()
|
||||
{
|
||||
return caseRoot_;
|
||||
}
|
||||
|
||||
/** get selected case name */
|
||||
public String getCaseName()
|
||||
{
|
||||
return caseName_;
|
||||
}
|
||||
|
||||
/** get selected ICaseBrowser */
|
||||
public ICaseBrowser getCaseBrowser()
|
||||
{
|
||||
return caseBrowser_;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//---- CaseSelectionListener Interface
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
|
||||
public void hostSelected(CaseSelectionEvent evt)
|
||||
{
|
||||
hostName_ = evt.hostName();
|
||||
caseRoot_ = evt.caseRoot();
|
||||
caseName_ = evt.caseName();
|
||||
caseBrowser_ = evt.caseBrowser();
|
||||
}
|
||||
|
||||
public void rootSelected(CaseSelectionEvent evt)
|
||||
{
|
||||
hostName_ = evt.hostName();
|
||||
caseRoot_ = evt.caseRoot();
|
||||
caseName_ = evt.caseName();
|
||||
caseBrowser_ = evt.caseBrowser();
|
||||
exitWindow();
|
||||
}
|
||||
|
||||
public void caseSelected(CaseSelectionEvent evt)
|
||||
{
|
||||
hostName_ = evt.hostName();
|
||||
caseRoot_ = evt.caseRoot();
|
||||
caseName_ = evt.caseName();
|
||||
caseBrowser_ = evt.caseBrowser();
|
||||
exitWindow();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.0" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<SyntheticProperties>
|
||||
</SyntheticProperties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JTabbedPane" name="tabbedPanel_">
|
||||
<Properties>
|
||||
<Property name="tabPlacement" type="int" value="3"/>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="10" style="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints anchor="10" fill="1" gridHeight="1" gridWidth="1" gridX="0" gridY="0" insetsBottom="0" insetsLeft="0" insetsRight="0" insetsTop="0" ipadX="0" ipadY="0" weightX="1.0" weightY="1.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@ -1,990 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
package FoamX.CaseManagement;
|
||||
|
||||
import java.util.Hashtable;
|
||||
import java.util.Enumeration;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.*;
|
||||
|
||||
import FoamX.App;
|
||||
import FoamX.TaskManagement.Task;
|
||||
import FoamX.ToolbarManagement.Toolbar;
|
||||
import FoamX.Util.BusyCursor;
|
||||
import FoamX.Exceptions.FoamXException;
|
||||
import FoamX.Exceptions.CaseBrowserIOException;
|
||||
|
||||
import FoamXServer.*;
|
||||
import FoamXServer.CaseServer.ICaseServer;
|
||||
import FoamXServer.CasePostServer.ICasePostServer;
|
||||
|
||||
public class CaseManager
|
||||
extends javax.swing.JPanel
|
||||
implements CaseStatusListener, ChangeListener
|
||||
{
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
// Case browser panel object.
|
||||
protected CaseBrowserPanel caseBrowserPanel_;
|
||||
// Map of CasePanel objects.
|
||||
protected Hashtable caseMap_;
|
||||
// Map of CasePostPanel objects.
|
||||
protected Hashtable casePostMap_;
|
||||
// Objects interested in case manager events.
|
||||
protected EventListenerList listenerList_;
|
||||
protected Toolbar toolBar_;
|
||||
//protected SaveCurrentCaseAction saveCurrentCaseAction_;
|
||||
//protected CloseCurrentCaseAction closeCurrentCaseAction_;
|
||||
//protected SaveAllCasesAction saveAllCasesAction_;
|
||||
//protected CloseAllCasesAction closeAllCasesAction_;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/** CaseManager constructor. */
|
||||
public CaseManager()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Initialise the GUI components.
|
||||
initComponents();
|
||||
|
||||
// Create case map.
|
||||
caseMap_ = new Hashtable();
|
||||
casePostMap_ = new Hashtable();
|
||||
|
||||
// Create listener list.
|
||||
listenerList_ = new EventListenerList();
|
||||
|
||||
// Initialise actions and toolbar.
|
||||
//saveCurrentCaseAction_ = new SaveCurrentCaseAction();
|
||||
//closeCurrentCaseAction_ = new CloseCurrentCaseAction();
|
||||
//saveAllCasesAction_ = new SaveAllCasesAction();
|
||||
//closeAllCasesAction_ = new CloseAllCasesAction();
|
||||
|
||||
//saveCurrentCaseAction_.setEnabled(false);
|
||||
//closeCurrentCaseAction_.setEnabled(false);
|
||||
//saveAllCasesAction_.setEnabled(false);
|
||||
//closeAllCasesAction_.setEnabled(false);
|
||||
|
||||
|
||||
// Add case browser tab. Have it start a new model.
|
||||
caseBrowserPanel_ =
|
||||
new CaseBrowserPanel(null, CaseBrowserPanel.OPEN_CASE_MODE);
|
||||
tabbedPanel_.addTab("Case Browser", caseBrowserPanel_);
|
||||
|
||||
// Initialise toolbar with my actions
|
||||
//toolBar_ =
|
||||
// App.getToolbarManager().addToolbar
|
||||
// (
|
||||
// "CaseManager",
|
||||
// "Case Manager"
|
||||
// );
|
||||
//addToolbarButton(saveCurrentCaseAction_);
|
||||
//addToolbarButton(saveAllCasesAction_);
|
||||
//toolBar_.addSeparator();
|
||||
//addToolbarButton(closeCurrentCaseAction_);
|
||||
//addToolbarButton(closeAllCasesAction_);
|
||||
|
||||
// Register this object as a tab selection changed listener.
|
||||
tabbedPanel_.getModel().addChangeListener(this);
|
||||
|
||||
// Register this object as a CaseStatusListener.
|
||||
caseBrowserPanel_.addCaseStatusListener(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
App.handleAllExceptions(ex);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/** Close all open cases. */
|
||||
public void closeAllCases()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Create a task object to keep track of progress.
|
||||
Task task = App.getTaskManager().createTask
|
||||
(
|
||||
"Closing All Cases",
|
||||
0,
|
||||
caseMap_.size()
|
||||
);
|
||||
int caseNo = 0;
|
||||
|
||||
// Close all cases.
|
||||
Enumeration iter = caseMap_.elements();
|
||||
while (iter.hasMoreElements())
|
||||
{
|
||||
// Get next case.
|
||||
CasePanel casePanel = (CasePanel)iter.nextElement();
|
||||
|
||||
// Give option of saving if modified
|
||||
casePanel.checkAndSave
|
||||
(
|
||||
false,
|
||||
"Case has been changed. Save before closing?",
|
||||
"Save Case"
|
||||
);
|
||||
|
||||
// Do exactly if 'close case' on casePanel was pressed
|
||||
caseClosed
|
||||
(
|
||||
new CaseStatusEvent
|
||||
(
|
||||
this,
|
||||
casePanel.getCaseRoot(),
|
||||
casePanel.getCaseName()
|
||||
)
|
||||
);
|
||||
|
||||
// Update the progress info.
|
||||
task.setProgress(caseNo++);
|
||||
}
|
||||
|
||||
|
||||
//// Close all post processing in a similar way
|
||||
//task = App.getTaskManager().createTask
|
||||
// (
|
||||
// "Closing All Postprocessing",
|
||||
// 0,
|
||||
// caseMap_.size()
|
||||
// );
|
||||
//caseNo = 0;
|
||||
//// Close all cases.
|
||||
//iter = casePostMap_.elements();
|
||||
//while (iter.hasMoreElements())
|
||||
//{
|
||||
// // Get next case.
|
||||
// CasePostPanel casePostPanel = (CasePostPanel)iter.nextElement();
|
||||
//
|
||||
// // Do exactly if 'close case' on casePostPanel was pressed
|
||||
// casePostClosed
|
||||
// (
|
||||
// new CaseStatusEvent
|
||||
// (
|
||||
// this,
|
||||
// casePanel.getCaseRoot(),
|
||||
// casePanel.getCaseName()
|
||||
// )
|
||||
// );
|
||||
//
|
||||
// // Update the progress info.
|
||||
// task.setProgress(caseNo++);
|
||||
//}
|
||||
|
||||
|
||||
// Refresh the case browser panel
|
||||
caseBrowserPanel_.refreshCaseBrowser(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
App.handleAllExceptions(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
App.getTaskManager().endTask();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/** Save open case. Ask first. */
|
||||
public void saveCaseNice(String caseRoot, String caseName)
|
||||
{
|
||||
CasePanel casePanel = getCasePanel(caseRoot, caseName);
|
||||
|
||||
if (casePanel != null)
|
||||
{
|
||||
// Give option of saving if modified
|
||||
casePanel.checkAndSave
|
||||
(
|
||||
false,
|
||||
"Case " + caseName
|
||||
+ " has been changed. Save before invoking utility?",
|
||||
"Save Case"
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/** Shut down the CaseManager object and close all open cases. */
|
||||
public void shutdown()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Close all cases.
|
||||
closeAllCases();
|
||||
|
||||
// Unregister as a CaseStatusListener.
|
||||
caseBrowserPanel_.removeCaseStatusListener(this);
|
||||
|
||||
// Shutdown the case browser.
|
||||
caseBrowserPanel_.shutdown();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
App.handleAllExceptions(ex);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
public CaseBrowserPanel getCaseBrowser()
|
||||
{
|
||||
return caseBrowserPanel_;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
public CasePanel getCasePanel(String caseRoot, String caseName)
|
||||
{
|
||||
CasePanel casePanel = null;
|
||||
|
||||
String rootAndCase = caseRoot + "/" + caseName;
|
||||
|
||||
if (caseMap_.containsKey(rootAndCase))
|
||||
{
|
||||
// Create a new case panel object to manage the case.
|
||||
casePanel = (CasePanel)caseMap_.get(rootAndCase);
|
||||
}
|
||||
|
||||
return casePanel;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
protected void addToolbarButton(AbstractAction action)
|
||||
{
|
||||
// Add new button to the toolbar using the action object.
|
||||
javax.swing.JButton button = toolBar_.add(action);
|
||||
|
||||
// Set the tooltip text.
|
||||
button.setToolTipText((String)action.getValue
|
||||
(
|
||||
Action.SHORT_DESCRIPTION)
|
||||
);
|
||||
button.setText("");
|
||||
button.setFont(toolBar_.getFont()); // Use same font as toolbar.
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//---- CaseManagerListener Interface
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
public void addCaseManagerListener(CaseManagerListener l)
|
||||
{
|
||||
listenerList_.add(CaseManagerListener.class, l);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
public void removeCaseManagerListener(CaseManagerListener l)
|
||||
{
|
||||
listenerList_.remove(CaseManagerListener.class, l);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
protected void fireOpenCase
|
||||
(
|
||||
String caseRoot,
|
||||
String caseName,
|
||||
ICaseServer caseServer
|
||||
)
|
||||
{
|
||||
// Create event object.
|
||||
CaseManagerEvent evt = new CaseManagerEvent
|
||||
(
|
||||
this,
|
||||
caseRoot,
|
||||
caseName,
|
||||
caseServer
|
||||
);
|
||||
|
||||
// Process the listeners last to first, notifying those that are
|
||||
// interested in this event.
|
||||
Object[] listeners = listenerList_.getListenerList();
|
||||
for (int i=listeners.length-2; i>= 0; i-=2)
|
||||
{
|
||||
if (listeners[i] == CaseManagerListener.class)
|
||||
{
|
||||
((CaseManagerListener)listeners[i+1]).caseOpened(evt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
protected void fireOpenPostCase
|
||||
(
|
||||
String caseRoot,
|
||||
String caseName,
|
||||
ICasePostServer casePostServer
|
||||
)
|
||||
{
|
||||
// Create event object.
|
||||
CaseManagerEvent evt = new CaseManagerEvent
|
||||
(
|
||||
this,
|
||||
caseRoot,
|
||||
caseName,
|
||||
casePostServer
|
||||
);
|
||||
|
||||
// Process the listeners last to first, notifying those that are
|
||||
// interested in this event.
|
||||
Object[] listeners = listenerList_.getListenerList();
|
||||
for (int i=listeners.length-2; i>= 0; i-=2)
|
||||
{
|
||||
if (listeners[i] == CaseManagerListener.class)
|
||||
{
|
||||
((CaseManagerListener)listeners[i+1]).casePostOpened(evt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
protected void fireCloseCase(String caseRoot, String caseName)
|
||||
{
|
||||
// Create event object.
|
||||
CaseManagerEvent evt = new CaseManagerEvent(this, caseRoot, caseName);
|
||||
|
||||
// Process the listeners last to first, notifying those that are
|
||||
// interested in this event.
|
||||
Object[] listeners = listenerList_.getListenerList();
|
||||
for (int i=listeners.length-2; i>= 0; i-=2)
|
||||
{
|
||||
if (listeners[i] == CaseManagerListener.class)
|
||||
{
|
||||
((CaseManagerListener)listeners[i+1]).caseClosed(evt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
protected void fireClosePostCase(String caseRoot, String caseName)
|
||||
{
|
||||
// Create event object.
|
||||
CaseManagerEvent evt = new CaseManagerEvent(this, caseRoot, caseName);
|
||||
|
||||
// Process the listeners last to first, notifying those that are
|
||||
// interested in this event.
|
||||
Object[] listeners = listenerList_.getListenerList();
|
||||
for (int i=listeners.length-2; i>= 0; i-=2)
|
||||
{
|
||||
if (listeners[i] == CaseManagerListener.class)
|
||||
{
|
||||
((CaseManagerListener)listeners[i+1]).casePostClosed(evt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
protected void fireDeleteCase(String caseRoot, String caseName)
|
||||
{
|
||||
// Create event object.
|
||||
CaseManagerEvent evt = new CaseManagerEvent(this, caseRoot, caseName);
|
||||
|
||||
// Process the listeners last to first, notifying those that are
|
||||
// interested in this event.
|
||||
Object[] listeners = listenerList_.getListenerList();
|
||||
for (int i=listeners.length-2; i>= 0; i-=2)
|
||||
{
|
||||
if (listeners[i] == CaseManagerListener.class)
|
||||
{
|
||||
((CaseManagerListener)listeners[i+1]).caseDeleted(evt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
protected void fireCasePanelSelected(String caseRoot, String caseName)
|
||||
{
|
||||
// Create event object.
|
||||
CaseManagerEvent evt = new CaseManagerEvent(this, caseRoot, caseName);
|
||||
|
||||
// Process the listeners last to first, notifying those that are
|
||||
// interested in this event.
|
||||
Object[] listeners = listenerList_.getListenerList();
|
||||
for (int i=listeners.length-2; i>= 0; i-=2)
|
||||
{
|
||||
if (listeners[i] == CaseManagerListener.class)
|
||||
{
|
||||
((CaseManagerListener)listeners[i+1]).casePanelSelected(evt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
protected void fireCaseBrowserSelected()
|
||||
{
|
||||
// Create event object.
|
||||
CaseManagerEvent evt = new CaseManagerEvent(this);
|
||||
|
||||
// Process the listeners last to first, notifying those that are
|
||||
// interested in this event.
|
||||
Object[] listeners = listenerList_.getListenerList();
|
||||
for (int i=listeners.length-2; i>= 0; i-=2)
|
||||
{
|
||||
if (listeners[i] == CaseManagerListener.class)
|
||||
{
|
||||
((CaseManagerListener)listeners[i+1]).caseBrowserSelected(evt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the FormEditor.
|
||||
*/
|
||||
private void initComponents()//GEN-BEGIN:initComponents
|
||||
{
|
||||
tabbedPanel_ = new javax.swing.JTabbedPane();
|
||||
|
||||
setLayout(new java.awt.GridBagLayout());
|
||||
java.awt.GridBagConstraints gridBagConstraints1;
|
||||
|
||||
tabbedPanel_.setTabPlacement(javax.swing.JTabbedPane.BOTTOM);
|
||||
tabbedPanel_.setFont(new java.awt.Font("Dialog", 0, 10));
|
||||
gridBagConstraints1 = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints1.gridx = 0;
|
||||
gridBagConstraints1.gridy = 0;
|
||||
gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
|
||||
gridBagConstraints1.weightx = 1.0;
|
||||
gridBagConstraints1.weighty = 1.0;
|
||||
add(tabbedPanel_, gridBagConstraints1);
|
||||
|
||||
}//GEN-END:initComponents
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JTabbedPane tabbedPanel_;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//---- CaseStatusListener Interface
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
public void caseOpened(CaseStatusEvent evt)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Make sure the event object has a case server reference.
|
||||
if (evt.caseServer() != null)
|
||||
{
|
||||
// See if we already have this case.
|
||||
String key = evt.caseRoot() + "/" + evt.caseName();
|
||||
|
||||
if (!caseMap_.containsKey(key))
|
||||
{
|
||||
// Create a new case panel object to manage the case.
|
||||
// Note: will throw exception if case in error.
|
||||
CasePanel casePanel = new CasePanel
|
||||
(
|
||||
evt.caseBrowser(),
|
||||
evt.caseServer()
|
||||
);
|
||||
|
||||
// Register this object as a CaseStatusListener.
|
||||
casePanel.addCaseStatusListener(this);
|
||||
|
||||
|
||||
// Add new tab.
|
||||
tabbedPanel_.addTab(evt.caseName(), casePanel);
|
||||
caseMap_.put(key, casePanel);
|
||||
|
||||
// Pop the new tab to the front.
|
||||
tabbedPanel_.setSelectedComponent(casePanel);
|
||||
|
||||
// Inform case manager listeners.
|
||||
fireOpenCase
|
||||
(
|
||||
evt.caseRoot(),
|
||||
evt.caseName(),
|
||||
evt.caseServer()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (FoamXIOError ioErr)
|
||||
{
|
||||
// io error. Add caseBrowser information
|
||||
if (evt.caseBrowser() != null)
|
||||
{
|
||||
// Add caseBrowser info
|
||||
App.handleAllExceptions
|
||||
(
|
||||
new CaseBrowserIOException
|
||||
(
|
||||
ioErr,
|
||||
evt.caseBrowser()
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
App.handleAllExceptions(ioErr);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// caseBrowserPanel_.refreshCaseNode
|
||||
// (
|
||||
// evt.caseRoot(),
|
||||
// evt.caseName()
|
||||
// );
|
||||
App.handleAllExceptions(ex);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
public void casePostOpened(CaseStatusEvent evt)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Make sure the event object has a case server reference.
|
||||
if (evt.casePostServer() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// See if we already have this case.
|
||||
String key = evt.caseRoot() + "/" + evt.caseName();
|
||||
|
||||
if (casePostMap_.containsKey(key))
|
||||
{
|
||||
System.out.println("Already postprocessing case " + key);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("Starting postprocessing case " + key);
|
||||
}
|
||||
|
||||
//PostApp pp =
|
||||
// new PostApp
|
||||
// (
|
||||
// evt.casePostServer(),
|
||||
// evt.caseRoot(),
|
||||
// evt.caseName()
|
||||
// );
|
||||
////MainFrame mf = new MainFrame(pp, 300, 600);
|
||||
//
|
||||
//// Register this object as a CaseStatusListener.
|
||||
//pp.getPostWindow().addCaseStatusListener(this);
|
||||
//
|
||||
//casePostMap_.put(key, pp);
|
||||
|
||||
// Inform case manager listeners.
|
||||
fireOpenPostCase
|
||||
(
|
||||
evt.caseRoot(),
|
||||
evt.caseName(),
|
||||
evt.casePostServer()
|
||||
);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
App.handleAllExceptions(ex);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
public void caseClosed(CaseStatusEvent evt)
|
||||
{
|
||||
try
|
||||
{
|
||||
// See if we have this case.
|
||||
String key = evt.caseRoot() + "/" + evt.caseName();
|
||||
|
||||
if (caseMap_.containsKey(key))
|
||||
{
|
||||
// Get CasePanel object for this case.
|
||||
CasePanel casePanel = (CasePanel)caseMap_.get(key);
|
||||
|
||||
// Unregister as a CaseStatusListener.
|
||||
casePanel.removeCaseStatusListener(this);
|
||||
|
||||
// Close the case.
|
||||
casePanel.closeCase(CasePanel.KILL_SERVER);
|
||||
|
||||
// Remove tab.
|
||||
tabbedPanel_.remove(casePanel);
|
||||
caseMap_.remove(key);
|
||||
|
||||
// Pop the case browser tab to the front.
|
||||
tabbedPanel_.setSelectedComponent(caseBrowserPanel_);
|
||||
|
||||
// Refresh the case browser panel
|
||||
caseBrowserPanel_.refreshCaseNode
|
||||
(
|
||||
evt.caseRoot(),
|
||||
evt.caseName()
|
||||
);
|
||||
|
||||
// Inform case manager listeners.
|
||||
fireCloseCase(evt.caseRoot(), evt.caseName());
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
App.handleAllExceptions(ex);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
public void casePostClosed(CaseStatusEvent evt)
|
||||
{
|
||||
try
|
||||
{
|
||||
//// See if we have this case.
|
||||
//String key = evt.caseRoot() + "/" + evt.caseName();
|
||||
//
|
||||
//if (casePostMap_.containsKey(key))
|
||||
//{
|
||||
// System.out.println
|
||||
// (
|
||||
// "CaseManager:casePostClosed for " + evt.caseName()
|
||||
// );
|
||||
//
|
||||
// PostApp pp = (PostApp)casePostMap_.get(key);
|
||||
//
|
||||
// PostWindow ps = pp.getPostWindow();
|
||||
//
|
||||
// // Unregister as a CaseStatusListener.
|
||||
// ps.removeCaseStatusListener(this);
|
||||
//
|
||||
// pp.destroy();
|
||||
//
|
||||
// casePostMap_.remove(key);
|
||||
//
|
||||
// // Inform case manager listeners.
|
||||
// fireClosePostCase(evt.caseRoot(), evt.caseName());
|
||||
//}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
App.handleAllExceptions(ex);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
public void caseDeleted(CaseStatusEvent evt)
|
||||
{
|
||||
try
|
||||
{
|
||||
// See if we have this case.
|
||||
String key = evt.caseRoot() + "/" + evt.caseName();
|
||||
if (caseMap_.containsKey(key))
|
||||
{
|
||||
// Get CasePanel object for this case.
|
||||
CasePanel casePanel = (CasePanel)caseMap_.get(key);
|
||||
|
||||
// Unregister as a CaseStatusListener.
|
||||
casePanel.removeCaseStatusListener(this);
|
||||
|
||||
// Close the case.
|
||||
casePanel.closeCase(CasePanel.KILL_SERVER);
|
||||
|
||||
// Remove tab.
|
||||
tabbedPanel_.remove(casePanel);
|
||||
caseMap_.remove(key);
|
||||
|
||||
// Pop the case browser tab to the front.
|
||||
tabbedPanel_.setSelectedComponent(caseBrowserPanel_);
|
||||
|
||||
// Refresh the case browser.
|
||||
caseBrowserPanel_.deleteCaseNode
|
||||
(
|
||||
evt.caseRoot(),
|
||||
evt.caseName()
|
||||
);
|
||||
|
||||
// Inform case manager listeners.
|
||||
fireDeleteCase(evt.caseRoot(), evt.caseName());
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
App.handleAllExceptions(ex);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//---- ChangeEventListener Interface
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
public void stateChanged(javax.swing.event.ChangeEvent evt)
|
||||
{
|
||||
try
|
||||
{
|
||||
// See which tab has been selected;
|
||||
Component comp = tabbedPanel_.getSelectedComponent();
|
||||
if (comp instanceof CaseBrowserPanel)
|
||||
{
|
||||
// Tell the case browser tab that it's selected.
|
||||
caseBrowserPanel_.tabSelected();
|
||||
|
||||
// Deselect all case tabs.
|
||||
Component[] tabs = tabbedPanel_.getComponents();
|
||||
for (int i = 0; i <tabs.length; i++)
|
||||
{
|
||||
if (tabs[i] instanceof CasePanel)
|
||||
{
|
||||
CasePanel cp = (CasePanel)tabs[i];
|
||||
cp.tabDeselected();
|
||||
}
|
||||
}
|
||||
|
||||
// Fire a tab selection event to interested listeners.
|
||||
fireCaseBrowserSelected();
|
||||
}
|
||||
else if (comp instanceof CasePanel)
|
||||
{
|
||||
// Deselect all case tabs and the case browser tab.
|
||||
caseBrowserPanel_.tabDeselected();
|
||||
Component[] tabs = tabbedPanel_.getComponents();
|
||||
for (int i = 0; i <tabs.length; i++)
|
||||
{
|
||||
if (tabs[i] instanceof CasePanel)
|
||||
{
|
||||
CasePanel cp = (CasePanel)tabs[i];
|
||||
cp.tabDeselected();
|
||||
}
|
||||
}
|
||||
|
||||
// Tell the case panel that it's selected.
|
||||
CasePanel cp = (CasePanel)comp;
|
||||
cp.tabSelected();
|
||||
|
||||
// Fire a tab selection event to interested listeners.
|
||||
fireCasePanelSelected(cp.getCaseRoot(), cp.getCaseName());
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
App.handleAllExceptions(ex);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//---- Action Classes
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
// private class SaveCurrentCaseAction
|
||||
// extends AbstractAction
|
||||
// {
|
||||
// SaveCurrentCaseAction()
|
||||
// {
|
||||
// putValue
|
||||
// (
|
||||
// Action.SMALL_ICON,
|
||||
// App.getResources().getIcon
|
||||
// (
|
||||
// "CaseManager.SaveCurrentCaseImage"
|
||||
// )
|
||||
// );
|
||||
// putValue(Action.NAME, "SaveCurrentCase");
|
||||
// putValue(Action.SHORT_DESCRIPTION, "Save Current Case");
|
||||
// putValue(Action.LONG_DESCRIPTION, "Save Current Case");
|
||||
// }
|
||||
//
|
||||
// public void actionPerformed(ActionEvent evt)
|
||||
// {
|
||||
// // Show busy cursor.
|
||||
// BusyCursor cursor = new BusyCursor(App.getRootFrame());
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// Component comp = tabbedPanel_.getSelectedComponent();
|
||||
// if (comp instanceof CasePanel)
|
||||
// {
|
||||
// CasePanel cp = (CasePanel)comp;
|
||||
// cp.saveCase();
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// App.handleAllExceptions(ex);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
// private class SaveAllCasesAction
|
||||
// extends AbstractAction
|
||||
// {
|
||||
// SaveAllCasesAction()
|
||||
// {
|
||||
// putValue
|
||||
// (
|
||||
// Action.SMALL_ICON,
|
||||
// App.getResources().getIcon("CaseManager.SaveAllCasesImage")
|
||||
// );
|
||||
// putValue(Action.NAME, "SaveAllCases");
|
||||
// putValue(Action.SHORT_DESCRIPTION, "Save All Cases");
|
||||
// putValue(Action.LONG_DESCRIPTION, "Save All Cases");
|
||||
// }
|
||||
//
|
||||
// public void actionPerformed(ActionEvent evt)
|
||||
// {
|
||||
// // Show busy cursor.
|
||||
// BusyCursor cursor = new BusyCursor(App.getRootFrame());
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// Component[] tabs = tabbedPanel_.getComponents();
|
||||
// for (int i = 0; i <tabs.length; i++)
|
||||
// {
|
||||
// if (tabs[i] instanceof CasePanel)
|
||||
// {
|
||||
// CasePanel cp = (CasePanel)tabs[i];
|
||||
// cp.saveCase();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// App.handleAllExceptions(ex);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
// private class CloseCurrentCaseAction
|
||||
// extends AbstractAction
|
||||
// {
|
||||
// CloseCurrentCaseAction()
|
||||
// {
|
||||
// putValue
|
||||
// (
|
||||
// Action.SMALL_ICON,
|
||||
// App.getResources().getIcon("CaseManager.CloseCurrentCaseImage")
|
||||
// );
|
||||
// putValue(Action.NAME, "CloseCurrentCase");
|
||||
// putValue(Action.SHORT_DESCRIPTION, "Close Current Case");
|
||||
// putValue(Action.LONG_DESCRIPTION, "Close Current Case");
|
||||
// }
|
||||
//
|
||||
// public void actionPerformed(ActionEvent evt)
|
||||
// {
|
||||
// // Show busy cursor.
|
||||
// BusyCursor cursor = new BusyCursor(App.getRootFrame());
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// Component comp = tabbedPanel_.getSelectedComponent();
|
||||
// if (comp instanceof CasePanel)
|
||||
// {
|
||||
// CasePanel cp = (CasePanel)comp;
|
||||
// boolean doClose = cp.checkAndSave
|
||||
// (
|
||||
// true,
|
||||
// "Case has been changed. Save before closing?",
|
||||
// "Save Case"
|
||||
// );
|
||||
// if (doClose)
|
||||
// {
|
||||
// // Do exactly if 'close case' on casePanel was pressed
|
||||
// caseClosed
|
||||
// (
|
||||
// new CaseStatusEvent
|
||||
// (
|
||||
// this,
|
||||
// cp.getCaseRoot(),
|
||||
// cp.getCaseName()
|
||||
// )
|
||||
// );
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// App.handleAllExceptions(ex);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
// private class CloseAllCasesAction
|
||||
// extends AbstractAction
|
||||
// {
|
||||
// CloseAllCasesAction()
|
||||
// {
|
||||
// putValue
|
||||
// (
|
||||
// Action.SMALL_ICON,
|
||||
// App.getResources().getIcon("CaseManager.CloseAllCasesImage")
|
||||
// );
|
||||
// putValue(Action.NAME, "CloseAllCases");
|
||||
// putValue(Action.SHORT_DESCRIPTION, "Close All Cases");
|
||||
// putValue(Action.LONG_DESCRIPTION, "Close All Cases");
|
||||
// }
|
||||
//
|
||||
// public void actionPerformed(ActionEvent evt)
|
||||
// {
|
||||
// // Show busy cursor.
|
||||
// BusyCursor cursor = new BusyCursor(App.getRootFrame());
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// closeAllCases();
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// App.handleAllExceptions(ex);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//--------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,115 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
package FoamX.CaseManagement;
|
||||
|
||||
import FoamXServer.CaseServer.ICaseServer;
|
||||
import FoamXServer.CasePostServer.ICasePostServer;
|
||||
|
||||
public class CaseManagerEvent
|
||||
extends java.util.EventObject
|
||||
{
|
||||
protected String caseRoot_;
|
||||
protected String caseName_;
|
||||
protected ICaseServer caseServer_;
|
||||
protected ICasePostServer casePostServer_;
|
||||
|
||||
/** CaseBrowserEvent constructor. */
|
||||
public CaseManagerEvent(Object source)
|
||||
{
|
||||
super(source);
|
||||
caseRoot_ = "";
|
||||
caseName_ = "";
|
||||
caseServer_ = null;
|
||||
casePostServer_ = null;
|
||||
}
|
||||
|
||||
public CaseManagerEvent
|
||||
(
|
||||
Object source,
|
||||
String caseRoot,
|
||||
String caseName,
|
||||
ICaseServer caseServer
|
||||
)
|
||||
{
|
||||
super(source);
|
||||
caseRoot_ = caseRoot;
|
||||
caseName_ = caseName;
|
||||
caseServer_ = caseServer;
|
||||
casePostServer_ = null;
|
||||
}
|
||||
|
||||
public CaseManagerEvent
|
||||
(
|
||||
Object source,
|
||||
String caseRoot,
|
||||
String caseName,
|
||||
ICasePostServer casePostServer
|
||||
)
|
||||
{
|
||||
super(source);
|
||||
caseRoot_ = caseRoot;
|
||||
caseName_ = caseName;
|
||||
caseServer_ = null;
|
||||
casePostServer_ = casePostServer;
|
||||
}
|
||||
|
||||
public CaseManagerEvent(Object source, String caseRoot, String caseName)
|
||||
{
|
||||
super(source);
|
||||
caseRoot_ = caseRoot;
|
||||
caseName_ = caseName;
|
||||
caseServer_ = null;
|
||||
casePostServer_ = null;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "CaseManagerEvent : " + caseRoot_ + " " + caseName_;
|
||||
}
|
||||
|
||||
public String caseRoot()
|
||||
{
|
||||
return caseRoot_;
|
||||
}
|
||||
|
||||
public String caseName()
|
||||
{
|
||||
return caseName_;
|
||||
}
|
||||
|
||||
public ICaseServer caseServer()
|
||||
{
|
||||
return caseServer_;
|
||||
}
|
||||
|
||||
public ICasePostServer casePostServer()
|
||||
{
|
||||
return casePostServer_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
package FoamX.CaseManagement;
|
||||
|
||||
public interface CaseManagerListener
|
||||
extends java.util.EventListener
|
||||
{
|
||||
public abstract void caseOpened(CaseManagerEvent evt);
|
||||
public abstract void casePostOpened(CaseManagerEvent evt);
|
||||
public abstract void caseClosed(CaseManagerEvent evt);
|
||||
public abstract void casePostClosed(CaseManagerEvent evt);
|
||||
public abstract void caseDeleted(CaseManagerEvent evt);
|
||||
public abstract void casePanelSelected(CaseManagerEvent evt);
|
||||
public abstract void caseBrowserSelected(CaseManagerEvent evt);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user