SET(_env "${_item}=$ENV{${_item}};${_env_${_item}}${sep}${_env}")
ENDIF()
ELSE()
- SET(_env "${_item}=$ENV{${_item}}:${_env_${_item}}${sep}${_env}")
+ STRING(REPLACE ";" ":" _iii "$ENV{${_item}}")
+ SET(_env "${_item}=${_iii}:${_env_${_item}}${sep}${_env}")
ENDIF()
ENDFOREACH()
# Get module name as substring of "Salome<ModuleName>"
- STRING(SUBSTRING "${PROJECT_NAME}" 6 -1 PRNAME)
+ STRING(REGEX MATCH "^Salome" _is_salome_project ${PROJECT_NAME})
+ IF(_is_salome_project)
+ STRING(SUBSTRING "${PROJECT_NAME}" 6 -1 PRNAME)
+ ELSE()
+ SET(PRNAME ${PROJECT_NAME})
+ ENDIF()
SET(_env "${PRNAME}_ROOT_DIR=${CMAKE_INSTALL_PREFIX}${sep}${_env}")
# Creating follow string for Windows environement:
SET(PLATFORM_LIBS Ws2_32.lib)
LIST(APPEND PLATFORM_LIBS Userenv.lib) # At least for GEOM suit
- # Disable iterator debugging on WINDOWS to avoid runtime error during checking iterators
- # _SECURE_SCL
- # If defined as 1, unsafe iterator use causes a runtime error.
- # If defined as 0, checked iterators are disabled.
- # The default value for _SECURE_SCL is 1
- # _SECURE_SCL_THROWS
- # If defined as 1, an out of range iterator use causes an exception at runtime.
- # If defined as 0, the program is terminated by calling invalid_parameter.
- # The default value for _SECURE_SCL_THROWS is 0
-
- ADD_DEFINITIONS(-D_SECURE_SCL=0 -D_SECURE_SCL_THROWS=0)
-
- # The symbol _HAS_ITERATOR_DEBUGGING can be used to turn off the iterator debugging feature in a debug build
- # If defined as 1, iterator debugging is enabled.
- # If defined as 0, iterator debugging is disabled.
- # The default value for _HAS_ITERATOR_DEBUGGING is 1
-
- IF(NOT CMAKE_BUILD_TYPE STREQUAL "RELEASE" AND NOT CMAKE_BUILD_TYPE STREQUAL "Release")
- ADD_DEFINITIONS(-D_HAS_ITERATOR_DEBUGGING=0)
- ENDIF(NOT CMAKE_BUILD_TYPE STREQUAL "RELEASE" AND NOT CMAKE_BUILD_TYPE STREQUAL "Release")
+################################################################################################
+#
+# RNV: In the SALOME sometimes operating with STL collections is done in not fully valid way.
+# To avoid run-time exception in Debug mode default values of the _SECURE_SCL,
+# _SECURE_SCL_THROWS and _HAS_ITERATOR_DEBUGGING macros were redefined. It solved a problem
+# then we used tne Microsoft Visual Studio 2008 to build SALOME on Windows platform.
+# But in the Microsoft Visual Studio 2010 these macros affect on the size of STL collection
+# classes(in difference from the Microsoft Visual Studio 2008: in this version of MSVS size
+# of the STL collection classes does not depend on these macros).
+# All pre-requisite products are built by MSVS 2010 in Debug mode with the default
+# values of the metioned above macros (namely _SECURE_SCL=1, _HAS_ITERATOR_DEBUGGING=1 and
+# _SECURE_SCL_THROWS=1). So SALOME modules should be build in the same configuration.
+#
+################################################################################################
+#
+# # Disable iterator debugging on WINDOWS to avoid runtime error during checking iterators
+# # _SECURE_SCL
+# # If defined as 1, unsafe iterator use causes a runtime error.
+# # If defined as 0, checked iterators are disabled.
+# # The default value for _SECURE_SCL is 1
+# # _SECURE_SCL_THROWS
+# # If defined as 1, an out of range iterator use causes an exception at runtime.
+# # If defined as 0, the program is terminated by calling invalid_parameter.
+# # The default value for _SECURE_SCL_THROWS is 0
+#
+# ADD_DEFINITIONS(-D_SECURE_SCL=0 -D_SECURE_SCL_THROWS=0)
+#
+# # The symbol _HAS_ITERATOR_DEBUGGING can be used to turn off the iterator debugging feature in a debug build
+# # If defined as 1, iterator debugging is enabled.
+# # If defined as 0, iterator debugging is disabled.
+# # The default value for _HAS_ITERATOR_DEBUGGING is 1
+#
+# IF(NOT CMAKE_BUILD_TYPE STREQUAL "RELEASE" AND NOT CMAKE_BUILD_TYPE STREQUAL "Release")
+# ADD_DEFINITIONS(-D_HAS_ITERATOR_DEBUGGING=0)
+# ENDIF(NOT CMAKE_BUILD_TYPE STREQUAL "RELEASE" AND NOT CMAKE_BUILD_TYPE STREQUAL "Release")
+################################################################################################
IF(MACHINE_IS_64)
SET(SIZE_OF_LONG 4) # set sizeof(long) to 4 byte
}
CMakeLists.txt
---------
+--------------
Create and add library to the project::
# --- options ---
The plugin can be a C++ plugin implemented in a dynamic library (.so file) or a Python plugin implemented in a Python module (.py).
It is possible to implement two kinds of algorithm : synchronous or asynchronous.
+The algorithm uses a pool of samples to be evaluated.
+When all the samples of the pool are evaluated, the algorithm stops.
+
Synchronous algorithm
--------------------------------------------------
In synchronous mode, the OptimizerLoop calls the algorithm to know what are the types of the input port (sample sent to the internal node),
- **getTCForIn**, this method must return the YACS type of the input port of the internal node
- **getTCForOut**, this method must return the YACS type of the output port of the internal node
+- **getTCForAlgoInit** (optional), this method returns the type of the "algoInit" port, string if undefined
+- **getTCForAlgoResult** (optional), this method returns the type of the "algoResult" port, string if undefined
- **initialize** (optional), this method is called during the algorithm initialization
- **start**, this method is called at the beginning of iterations
- **takeDecision**, this method is called at each iteration
- **finish** (optional), this method is called to finish the algorithm at the end of the iteration process
+- **getAlgoResult** (optional), this method returns the value of the "algoResult" port, "NULL" if undefined
In Python you need to implement another method:
''''''''''''''''''''
Here is a small example of a C++ synchronous algorithm:
-.. code-block:: cpp
-
- #include <cmath>
-
- #include "OptimizerAlg.hxx"
-
- using namespace YACS::ENGINE;
-
- extern "C"
- {
- OptimizerAlgBase * createOptimizerAlgSyncExample(Pool * pool);
- }
-
- class OptimizerAlgSyncExample : public OptimizerAlgSync
- {
- private:
- int _idTest;
- TypeCode *_tcIn;
- TypeCode *_tcOut;
- public:
- OptimizerAlgSyncExample(Pool *pool);
- virtual ~OptimizerAlgSyncExample();
- TypeCode *getTCForIn() const;
- TypeCode *getTCForOut() const;
- void start();
- void takeDecision();
- void initialize(const Any *input) throw(YACS::Exception);
- void finish();
- };
-
- OptimizerAlgSyncExample::OptimizerAlgSyncExample(Pool *pool)
- : OptimizerAlgSync(pool), _tcIn(0), _tcOut(0), _idTest(0)
- {
- _tcIn=new TypeCode(Double);
- _tcOut=new TypeCode(Int);
- }
-
- OptimizerAlgSyncExample::~OptimizerAlgSyncExample()
- {
- _tcIn->decrRef();
- _tcOut->decrRef();
- }
-
- //! Return the typecode of the expected input type
- TypeCode * OptimizerAlgSyncExample::getTCForIn() const
- {
- return _tcIn;
- }
-
- //! Return the typecode of the expected output type
- TypeCode * OptimizerAlgSyncExample::getTCForOut() const
- {
- return _tcOut;
- }
-
- //! Start to fill the pool with samples to evaluate
- void OptimizerAlgSyncExample::start()
- {
- _idTest=0;
- Any *val=AtomAny::New(1.2);
- _pool->pushInSample(4,val);
- val=AtomAny::New(3.4);
- _pool->pushInSample(9,val);
- }
-
- //! This method is called each time a sample has been evaluated.
- /*!
- * It can either add new samples to evaluate in the pool, do nothing (wait
- * for more samples), or empty the pool to finish the evaluation.
- */
- void OptimizerAlgSyncExample::takeDecision()
- {
- if(_idTest==1)
- {
- Any *val=AtomAny::New(5.6);
- _pool->pushInSample(16,val);
- val=AtomAny::New(7.8);
- _pool->pushInSample(25,val);
- val=AtomAny::New(9. );
- _pool->pushInSample(36,val);
- val=AtomAny::New(12.3);
- _pool->pushInSample(49,val);
- }
- else if(_idTest==4)
- {
- Any *val=AtomAny::New(45.6);
- _pool->pushInSample(64,val);
- val=AtomAny::New(78.9);
- _pool->pushInSample(81,val);
- }
- else
- {
- Any *tmp= _pool->getCurrentInSample();
- if(fabs(tmp->getDoubleValue()-45.6)<1.e-12)
- _pool->destroyAll();
- }
- _idTest++;
- }
-
- //! Optional method to initialize the algorithm.
- /*!
- * For now, the parameter input is always NULL. It might be used in the
- * future to initialize an algorithm with custom data.
- */
- void OptimizerAlgSyncExample::initialize(const Any *input)
- throw (YACS::Exception)
- {
- }
-
- /*!
- * Optional method called when the algorithm has finished, successfully or
- * not, to perform any necessary clean up.
- */
- void OptimizerAlgSyncExample::finish()
- {
- }
-
- //! Factory method to create the algorithm.
- OptimizerAlgBase * createOptimizerAlgSyncExample(Pool *pool)
- {
- return new OptimizerAlgSyncExample(pool);
- }
-
+.. literalinclude:: ../src/yacsloader/Test/OptimizerAlgSyncExample.cxx
+ :language: cpp
Here, the entry point in the dynamic library is the name of the factory function : createOptimizerAlgSyncExample
that returns an instance of the OptimizerAlgSyncExample class that implements the algorithm.
Python plugin example
''''''''''''''''''''''
-Here, the same example of a synchronous algorithm in Python::
-
- import SALOMERuntime
-
- class myalgosync(SALOMERuntime.OptimizerAlgSync):
- def __init__(self):
- SALOMERuntime.OptimizerAlgSync.__init__(self, None)
- r=SALOMERuntime.getSALOMERuntime()
- self.tin=r.getTypeCode("double")
- self.tout=r.getTypeCode("int")
-
- def setPool(self,pool):
- """Must be implemented to set the pool"""
- self.pool=pool
-
- def getTCForIn(self):
- """returns typecode of type expected as Input"""
- return self.tin
-
- def getTCForOut(self):
- """returns typecode of type expected as Output"""
- return self.tout
-
- def initialize(self,input):
- """Optional method called on initialization. Do nothing here"""
-
- def start(self):
- """Start to fill the pool with samples to evaluate."""
- self.iter=0
- self.pool.pushInSample(4,1.2)
- self.pool.pushInSample(9,3.4)
-
- def takeDecision(self):
- """ This method is called each time a sample has been evaluated. It can
- either add new samples to evaluate in the pool, do nothing (wait for
- more samples), or empty the pool to finish the evaluation.
- """
- currentId=self.pool.getCurrentId()
-
- if self.iter==1:
- self.pool.pushInSample(16,5.6)
- self.pool.pushInSample(25,7.8)
- self.pool.pushInSample(36,9.)
- self.pool.pushInSample(49,12.3)
- elif self.iter==4:
- self.pool.pushInSample(64,45.6)
- self.pool.pushInSample(81,78.9)
- else:
- val=self.pool.getCurrentInSample()
- if abs(val.getDoubleValue()-45.6) < 1.e-12:
- self.pool.destroyAll()
- self.iter=self.iter+1
-
- def finish(self):
- """Optional method called when the algorithm has finished, successfully
- or not, to perform any necessary clean up. Do nothing here"""
+Here, the same example of a synchronous algorithm in Python:
+
+.. literalinclude:: ../src/yacsloader/Test/algosyncexample.py
Here, the entry point in the Python module is directly the name of the class that implements the algorithm : myalgosync.
- **getTCForIn**, this method must return the YACS type of the input port of the internal node
- **getTCForOut**, this method must return the YACS type of the output port of the internal node
+- **getTCForAlgoInit** (optional), this method returns the type of the "algoInit" port, string if undefined
+- **getTCForAlgoResult** (optional), this method returns the type of the "algoResult" port, string if undefined
- **initialize** (optional), this method is called during the algorithm initialization
- **startToTakeDecision**, this method is called to start the iteration process in a separate thread. It is the body of the algorithm.
- **finish** (optional), this method is called to finish the algorithm at the end of the iteration process
+- **getAlgoResult** (optional), this method returns the value of the "algoResult" port, "NULL" if undefined
In Python you need to implement another method:
''''''''''''''''''''
Here is a small example of a C++ asynchronous algorithm:
-.. code-block:: cpp
-
- #include "OptimizerAlg.hxx"
-
- using namespace YACS::ENGINE;
-
- extern "C"
- {
- OptimizerAlgBase * createOptimizerAlgASyncExample(Pool * pool);
- }
-
- class OptimizerAlgASyncExample : public OptimizerAlgASync
- {
- private:
- TypeCode * _tcIn;
- TypeCode * _tcOut;
- public:
- OptimizerAlgASyncExample(Pool * pool);
- virtual ~OptimizerAlgASyncExample();
- TypeCode * getTCForIn() const;
- TypeCode * getTCForOut() const;
- void startToTakeDecision();
- };
-
- OptimizerAlgASyncExample::OptimizerAlgASyncExample(Pool * pool)
- : OptimizerAlgASync(pool), _tcIn(0), _tcOut(0)
- {
- _tcIn = new TypeCode(Double);
- _tcOut = new TypeCode(Int);
- }
-
- OptimizerAlgASyncExample::~OptimizerAlgASyncExample()
- {
- _tcIn->decrRef();
- _tcOut->decrRef();
- }
-
- //! Return the typecode of the expected input type
- TypeCode *OptimizerAlgASyncExample::getTCForIn() const
- {
- return _tcIn;
- }
-
- //! Return the typecode of the expected output type
- TypeCode *OptimizerAlgASyncExample::getTCForOut() const
- {
- return _tcOut;
- }
-
- //! This method is called only once to launch the algorithm.
- /*!
- * It must first fill the pool with samples to evaluate and call
- * signalMasterAndWait() to block until a sample has been evaluated. When
- * returning from this method, it MUST check for an eventual termination
- * request (with the method isTerminationRequested()). If the termination
- * is requested, the method must perform any necessary cleanup and return
- * as soon as possible. Otherwise it can either add new samples to evaluate
- * in the pool, do nothing (wait for more samples), or empty the pool and
- * return to finish the evaluation.
- */
- void OptimizerAlgASyncExample::startToTakeDecision()
- {
- double val = 1.2;
- for (int i=0 ; i<5 ; i++) {
- // push a sample in the input of the slave node
- _pool->pushInSample(i, AtomAny::New(val));
- // wait until next sample is ready
- signalMasterAndWait();
- // check error notification
- if (isTerminationRequested()) {
- _pool->destroyAll();
- return;
- }
-
- // get a sample from the output of the slave node
- Any * v = _pool->getCurrentOutSample();
- val += v->getIntValue();
- }
-
- // in the end destroy the pool content
- _pool->destroyAll();
- }
-
- //! Factory method to create the algorithm.
- OptimizerAlgBase * createOptimizerAlgASyncExample(Pool * pool)
- {
- return new OptimizerAlgASyncExample(pool);
- }
+.. literalinclude:: ../src/yacsloader/Test/OptimizerAlgASyncExample.cxx
+ :language: cpp
Here, the entry point in the dynamic library is the name of the factory function : createOptimizerAlgASyncExample
Python plugin example
''''''''''''''''''''''''
-Here is an example of an asynchronous algorithm implemented in Python::
-
- import SALOMERuntime
-
- class myalgoasync(SALOMERuntime.OptimizerAlgASync):
- def __init__(self):
- SALOMERuntime.OptimizerAlgASync.__init__(self, None)
- r=SALOMERuntime.getSALOMERuntime()
- self.tin=r.getTypeCode("double")
- self.tout=r.getTypeCode("int")
-
- def setPool(self,pool):
- """Must be implemented to set the pool"""
- self.pool=pool
-
- def getTCForIn(self):
- """returns typecode of type expected as Input"""
- return self.tin
-
- def getTCForOut(self):
- """returns typecode of type expected as Output"""
- return self.tout
-
- def startToTakeDecision(self):
- """This method is called only once to launch the algorithm. It must
- first fill the pool with samples to evaluate and call
- self.signalMasterAndWait() to block until a sample has been
- evaluated. When returning from this method, it MUST check for an
- eventual termination request (with the method
- self.isTerminationRequested()). If the termination is requested, the
- method must perform any necessary cleanup and return as soon as
- possible. Otherwise it can either add new samples to evaluate in the
- pool, do nothing (wait for more samples), or empty the pool and
- return to finish the evaluation.
- """
- val=1.2
- for iter in xrange(5):
- #push a sample in the input of the slave node
- self.pool.pushInSample(iter,val)
- #wait until next sample is ready
- self.signalMasterAndWait()
- #check error notification
- if self.isTerminationRequested():
- self.pool.destroyAll()
- return
-
- #get a sample from the output of the slave node
- currentId=self.pool.getCurrentId()
- v=self.pool.getCurrentOutSample()
- val=val+v.getIntValue()
-
- #in the end destroy the pool content
- self.pool.destroyAll()
+Here is an example of an asynchronous algorithm implemented in Python:
+
+.. literalinclude:: ../src/yacsloader/Test/algoasyncexample.py
Here, the entry point in the Python module is directly the name of the class that implements the algorithm : myalgoasync.
+Managing the pool of samples
+---------------------------------
+
+Samples can be added to the pool at the initialization of the algorithm or
+every time a sample is evaluated (while "taking decision").
+The algorithm stops to take decisions when every sample is evaluated.
+
+A sample has:
+
+- an identifier - *Id*
+- a priority - it is used to choose the order of evaluation
+- a value - *In*
+- an evaluated or computed value - *Out*
+
+The current sample is the sample used by the latest terminated evaluation.
+
+These are the methods needed to manage the pool of samples:
+
+.. code-block:: cpp
+
+ class Pool
+ {
+ //...
+ public:
+ //For algorithm use
+ int getCurrentId() const ;
+ Any *getCurrentInSample() const ;
+ Any *getCurrentOutSample() const ;
+ Any *getOutSample(int id);
+ void pushInSample(int id, Any *inSample, unsigned char priority = 0);
+ void destroyAll();
+ //...
+ }
+
+In C++, the samples are of type ``YACS::ENGINE::Any``, in order to support any
+type supported by YACS. For conversion to standard types, use:
+
+- ``getIntValue``
+- ``getBoolValue``
+- ``getDoubleValue``
+- ``getStringValue``
+
+It is possible to create a pointer to a new object with:
+
+- ``YACS::ENGINE::AtomAny::New``
+
+For further information, see `include/salome/Any.hxx <file:../../../../../include/salome/Any.hxx>`_.
C++ algorithm calling Python code
--------------------------------------------------
Dataflow link
++++++++++++++++++++++++++++
-The first step in defining a dataflow link is to obtain port objects using one of the methods described above.
-The edAddDFLink method for the context node is then used, transferring the two ports to be connected to it.
-The following gives an example of a dataflow link between the output port p1 of node n3 and the input port of node n4::
+The first step in defining a dataflow link is to obtain port objects using one of the methods described above.
+Then, the edAddLink method links an output port to an input port::
pout=n3.getOutputPort("p1")
pin=n4.getInputPort("p1")
- p.edAddDFLink(pout,pin)
+ p.edAddLink(pout,pin)
-Data link
-++++++++++++++++++++++++++++
-A data link is defined as being a dataflow link using the edAddLink method instead of edAddDFLink.
-The same example as above with a data link::
+Most of the time, when you need a dataflow link between two ports, you also need a control link between the nodes
+of the ports. In this case you can use the method edAddDFLink::
pout=n3.getOutputPort("p1")
pin=n4.getInputPort("p1")
- p.edAddLink(pout,pin)
+ p.edAddDFLink(pout,pin)
+
+edAddDFLink is equivalent to edAddCFLink followed by edAddLink.
Initialising an input data port
'''''''''''''''''''''''''''''''''''''''''''''''
r = pilot.getRuntime()
p=r.createProc("pr")
ti=p.getTypeCode("int")
+ td=p.getTypeCode("double")
#node1
n1=r.createScriptNode("","node1")
p.edAddChild(n1)
p.edAddCFLink(n1,n2)
p.edAddCFLink(n1,n4)
#dataflow links
- pout=n3.getOutputPort("p1")
- pin=n4.getInputPort("p1")
- #dataflow links
- p.edAddDFLink(n1.getOutputPort("p1"),n2.getInputPort("p1"))
- p.edAddDFLink(n1.getOutputPort("p1"),n4.getInputPort("p1"))
+ p.edAddLink(n1.getOutputPort("p1"),n2.getInputPort("p1"))
+ p.edAddLink(n1.getOutputPort("p1"),n4.getInputPort("p1"))
#initialisation ports
n1.getInputPort("p1").edInitPy(5)
n2.setScript("p1=2*p1")
n2.edAddInputPort("p1",ti)
n2.edAddOutputPort("p1",ti)
- b.edAddCFLink(n1,n2)
b.edAddDFLink(n1.getOutputPort("p1"),n2.getInputPort("p1"))
.. _py_forloop:
Node::~Node()
{
+ delete _inPropertyPort;
}
/**
class Any;
class OptimizerLoop;
+ /*! \brief Pool used to manage the samples of the optimizer loop plugin.
+ *
+ * Every sample has an identifier (Id), a priority, an initial value (In)
+ * and an evaluation value (Out).
+ * The current sample is the sample used by the latest terminated evaluation.
+ */
class YACSLIBENGINE_EXPORT Pool
{
friend class OptimizerLoop;
*
* \param inst: the component instance
* \param name: the component instance name
- * \param restCtr: try to reuse instance number previously released, false by default
+ * \param resetCtr: try to reuse instance number previously released, false by default
*/
void Proc::addComponentInstance(ComponentInstance* inst, const std::string& name, bool resetCtr)
{
_wid->gridLayout1->addWidget(_formEachLoop);
_formEachLoop->sb_nbranch->setMinimum(1);
_formEachLoop->sb_nbranch->setMaximum(INT_MAX);
+ if (!QtGuiContext::getQtCurrent()->isEdition())
+ _formEachLoop->setEnabled (false);
Node* node=_subjectNode->getNode();
ForEachLoop *fe = dynamic_cast<ForEachLoop*>(node);
if(fe)
_formLoop->sb_nsteps->setMinimum(0);
_formLoop->sb_nsteps->setMaximum(INT_MAX);
+ if (!QtGuiContext::getQtCurrent()->isEdition())
+ _formLoop->setEnabled (false);
+
connect(_formLoop->sb_nsteps, SIGNAL(editingFinished()),
this, SLOT(onNbStepsEdited()));
}
_glayout->addLayout( glt , 1);
_glayout->addWidget( _sci );
+ if (!QtGuiContext::getQtCurrent()->isEdition())
+ {
+ gener_template->setEnabled (false);
+ _liFuncName->setEnabled (false);
+ }
+
connect(_liFuncName, SIGNAL(textChanged(const QString&)),
this, SLOT(onFuncNameModified(const QString&)));
_valueDelegate = new ValueDelegate(parent);
_tvSwitch->tv_nodes->setItemDelegateForColumn(YValue, _valueDelegate);
_tvSwitch->setEditableCase(true);
+ if (!QtGuiContext::getQtCurrent()->isEdition())
+ _tvSwitch->setEnabled (false);
connect(_valueDelegate, SIGNAL(commitData(QWidget*)),
this, SLOT(onCommitData(QWidget*)));
#include "EditionWhile.hxx"
#include "FormLoop.hxx"
#include "guiObservers.hxx"
+#include "QtGuiContext.hxx"
//#define _DEVDEBUG_
#include "YacsTrace.hxx"
_formWhile->sb_nsteps->setMinimum(0);
_formWhile->sb_nsteps->setMaximum(1);
_formWhile->label->setText("Condition");
+ if (!QtGuiContext::getQtCurrent()->isEdition())
+ _formWhile->setEnabled (false);
connect(_formWhile->sb_nsteps, SIGNAL(editingFinished()),
this, SLOT(onConditionEdited()));
}
tr("Load Schema to run"), tr("Load a schema for run"),
0, _parent, false, this, SLOT(onLoadAndRunSchema()));
- _chooseBatchJobAct = _wrapper->createAction(getMenuId(), tr("Choose Batch Job for watch"), QIcon("icons:batch.png"),
- tr("Choose Batch Job for watch"), tr("Choose Batch Job for watch"),
+ _chooseBatchJobAct = _wrapper->createAction(getMenuId(), tr("Choose Batch Job to watch"), QIcon("icons:batch.png"),
+ tr("Choose Batch Job to watch"), tr("Choose Batch Job to watch"),
0, _parent, false, this, SLOT(onChooseBatchJob()));
_startResumeAct = _wrapper->createAction(getMenuId(), tr("Start or Resume Schema execution"), QIcon("icons:suspend_resume.png"),
inode->setWidth(pres._width);
inode->setHeight(pres._height);
inode->setExpanded(pres._expanded);
- inode->setExpandedPos(QPointF(pres._expx, pres._expy));
+ QPointF anExpandedPos = QPointF(pres._expx, pres._expy);
+ if (anExpandedPos.isNull())
+ anExpandedPos = inode->pos();
+ inode->setExpandedPos(anExpandedPos);
inode->setExpandedWH(pres._expWidth, pres._expHeight);
inode->setShownState(shownState(pres._shownState));
// collect nodes to correct it's Y-position if this collides with parent's header
- if (inode->getParent() && inode->y() < inode->getParent()->getHeaderBottom())
- nodesToMove[inode] = QPointF(inode->x(), inode->getParent()->getHeaderBottom()+1);
+ if (inode->getParent() ) {
+ qreal anX = inode->x();
+ qreal anY = inode->y();
+ if (inode->getShownState() == shrinkHidden) {
+ anX = inode->getExpandedX();
+ anY = inode->getExpandedY();
+ }
+ if (anY < inode->getParent()->getHeaderBottom())
+ nodesToMove[inode] = QPointF(anX, inode->getParent()->getHeaderBottom()+1);
+ }
}
}
QtGuiContext::getQtCurrent()->setLoadingPresentation(false);
{
DEBTRACE(logger->getStr());
}
- QString fn=QString::fromStdString(filename);
+ QString fn=QString::fromUtf8(filename.c_str());
if(edit)
createContext(proc, fn, "", true);
else
if (!fi.exists() && fi.suffix() != "xml")
fn += ".xml";
- DEBTRACE("file loaded : " <<fn.toStdString());
+ DEBTRACE("file loaded : " <<fn.toUtf8().constData());
YACS::ENGINE::Proc *proc = 0;
try {
- proc = _loader->load(fn.toLatin1());
+ proc = _loader->load(fn.toUtf8().constData());
}
catch (...) {
}
}
if (fn.isEmpty()) return;
- DEBTRACE("GenericGui::onExportSchema: " << fn.toStdString());
+ DEBTRACE("GenericGui::onExportSchema: " << fn.toUtf8().constData());
//to be sure that all pending changes are effective
_parent->setFocus();
QtGuiContext::getQtCurrent()->setFileName(fn);
VisitorSaveGuiSchema aWriter(proc);
- aWriter.openFileSchema( fn.toStdString() );
+ aWriter.openFileSchema( fn.toUtf8().constData() );
aWriter.visitProc();
aWriter.closeFileSchema();
QtGuiContext::getQtCurrent()->setNotSaved(false);
QString fn = getSaveFileName(fo);
if (fn.isEmpty()) return;
- DEBTRACE("GenericGui::onExportSchemaAs: " << fn.toStdString());
+ DEBTRACE("GenericGui::onExportSchemaAs: " << fn.toUtf8().constData());
QtGuiContext::getQtCurrent()->setFileName(fn);
VisitorSaveGuiSchema aWriter(proc);
- aWriter.openFileSchema(fn.toStdString());
+ aWriter.openFileSchema(fn.toUtf8().constData());
aWriter.visitProc();
aWriter.closeFileSchema();
_isSaved = true;
void SceneNodeItem::setTopLeft(QPointF topLeft)
{
+ if (_shownState == shrinkHidden) {
+ _expandedPos = topLeft;
+ return;
+ }
QPointF oldPos = pos();
setPos(topLeft);
_height = _expandedHeight;
_shownState = expandShown;
adjustHeader();
+ rebuildLinks();
}
ENABLE_TESTING()
ENDIF(URANIE AND WIN32)
-IF(SALOME_BUILD_DOC)
- FIND_PACKAGE(SalomeDoxygen)
- FIND_PACKAGE(SalomeGraphviz)
- FIND_PACKAGE(SalomeSphinx)
- SALOME_LOG_OPTIONAL_PACKAGE(Doxygen SALOME_BUILD_DOC)
- SALOME_LOG_OPTIONAL_PACKAGE(Graphviz SALOME_BUILD_DOC)
- SALOME_LOG_OPTIONAL_PACKAGE(Sphinx SALOME_BUILD_DOC)
-ENDIF(SALOME_BUILD_DOC)
-
IF(SALOME_YACS_USE_SWIG)
FIND_PACKAGE(SalomePython)
FIND_PACKAGE(SalomeSWIG)
# configuration options related to the input files
#---------------------------------------------------------------------------
-INPUT = @srcdir@/doxfiles/intro.dox \
- @srcdir@/doxfiles/cppexamples.dox \
- @srcdir@/doxfiles/pyexamples.dox \
- @srcdir@/doxfiles/pmml.dox \
- @srcdir@/doxfiles/install.dox \
- @srcdir@/../../src/PMML
+INPUT = @CMAKE_CURRENT_SOURCE_DIR@/doxfiles/intro.dox \
+ @CMAKE_CURRENT_SOURCE_DIR@/doxfiles/cppexamples.dox \
+ @CMAKE_CURRENT_SOURCE_DIR@/doxfiles/pyexamples.dox \
+ @CMAKE_CURRENT_SOURCE_DIR@/doxfiles/pmml.dox \
+ @CMAKE_CURRENT_SOURCE_DIR@/doxfiles/install.dox \
+ @CMAKE_SOURCE_DIR@/src/pmml
FILE_PATTERNS = PMMLlib.* \
*.dox
RECURSIVE = YES
EXCLUDE = CVS
EXCLUDE_PATTERNS = *~
-EXAMPLE_PATH = @srcdir@/../../src/PMML \
- @srcdir@/../../src/PMML/Test \
- @srcdir@/../../src/PMML_Swig
+EXAMPLE_PATH = @CMAKE_SOURCE_DIR@/src/pmml \
+ @CMAKE_SOURCE_DIR@/src/pmml/Test \
+ @CMAKE_SOURCE_DIR@/src/pmml/pmml_Swig
EXAMPLE_PATTERNS = *.cxx *.py
EXAMPLE_RECURSIVE = NO
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
-HTML_HEADER = @builddir@/static/header.html
-HTML_FOOTER = @srcdir@/static/footer.html
-HTML_EXTRA_STYLESHEET = @srcdir@/static/salome_extra.css
+HTML_HEADER = @CMAKE_CURRENT_BINARY_DIR@/static/header.html
+HTML_FOOTER = @CMAKE_CURRENT_SOURCE_DIR@/static/footer.html
+HTML_EXTRA_STYLESHEET = @CMAKE_CURRENT_SOURCE_DIR@/static/salome_extra.css
GENERATE_HTMLHELP = NO
GENERATE_CHI = YES
BINARY_TOC = NO
using namespace std;
using namespace YACS::ENGINE;
-void RuntimeSALOME::setRuntime(long flags) // singleton creation (not thread safe!)
+void RuntimeSALOME::setRuntime(long flags, int argc, char* argv[]) // singleton creation (not thread safe!)
{
if (! Runtime::_singleton)
{
- RuntimeSALOME* r=new RuntimeSALOME(flags);
+ RuntimeSALOME* r=new RuntimeSALOME(flags, argc, argv);
Runtime::_singleton = r;
r->initBuiltins();
}
typeMap["dataref"]= t;
}
-RuntimeSALOME::RuntimeSALOME(long flags)
+RuntimeSALOME::RuntimeSALOME(long flags, int argc, char* argv[])
{
// If all flags (apart the IsPyExt flags) are unset, force them to true
if ((flags - flags & RuntimeSALOME::IsPyExt) == 0)
if (_usePython) _setOfImplementation.insert(PythonNode::IMPL_NAME);
if (_useCorba) _setOfImplementation.insert(CORBANode::IMPL_NAME);
if (_useXml) _setOfImplementation.insert(XmlNode::IMPL_NAME);
- init(flags);
+ init(flags, argc, argv);
}
RuntimeSALOME::~RuntimeSALOME()
* bit1 (UseXml) true if python nodes are needed
* bit1 (UseCpp) true if C++ nodes are needed
* bit1 (UseSalome) true if Salome nodes are needed
+ * \param argc number of command line arguments (used to initialize the Python interpreter)
+ * \param argv command line arguments (used to initialize the Python interpreter)
*
*/
-void RuntimeSALOME::init(long flags)
+void RuntimeSALOME::init(long flags, int argc, char* argv[])
{
bool ispyext = flags & RuntimeSALOME::IsPyExt;
if (_useCorba)
#else
Py_InitializeEx(0); // do not install signal handlers
#endif
+ if (argc > 0 && argv != NULL)
+ PySys_SetArgv(argc, argv);
+ else
+ {
+ int pyArgc = 1;
+ char* pyArgv[1];
+ char defaultName[] = "SALOME_YACS_RUNTIME";
+ pyArgv[0] = defaultName;
+ PySys_SetArgv(pyArgc, pyArgv);
+ }
PyEval_InitThreads(); /* Create (and acquire) the interpreter lock (for threads)*/
PyEval_SaveThread(); /* Release the thread state */
//here we do not have the Global Interpreter Lock
UseSalome = 32
} FLAGS;
- static void setRuntime(long flags = UsePython+UseCorba+UseXml+UseCpp+UseSalome); // singleton creation
+ // singleton creation
+ static void setRuntime(long flags = UsePython+UseCorba+UseXml+UseCpp+UseSalome,
+ int argc = 0, char* argv[] = NULL);
friend RuntimeSALOME* getSALOMERuntime();
virtual std::string getVersion() const;
- virtual void init(long flags);
+ virtual void init(long flags, int argc, char* argv[]);
virtual void fini();
virtual InputPort* createInputPort(const std::string& name,
protected:
RuntimeSALOME(); // singleton
- RuntimeSALOME(long flags); // singleton
+ RuntimeSALOME(long flags, int argc, char* argv[]); // singleton
void initBuiltins();
CORBA::ORB_var _orb;
PyObject * _pyorb;
obj->info.message = "";
obj->info.code = 0;
+ Out[0] = NULL;
if (std::strncmp(service, "f", 1) == 0)
{
double _arg0 = In[0]->getDoubleValue();
double _res = obj->f(_arg0);
- Out[0] = YACS::ENGINE::AtomAny::New(_res);
+ if (obj->info.code == 0)
+ Out[0] = YACS::ENGINE::AtomAny::New(_res);
}
else
{
obj->info.message = "service ";
obj->info.message += service;
obj->info.message += " doesn't exist in TestComponent";
- Out[0] = NULL;
}
*r = obj->info;
}
<context>
<name>@default</name>
<message>
- <source>Choose Batch Job for watch</source>
+ <source>Choose Batch Job to watch</source>
<translation>Choisir le job batch à surveiller</translation>
</message>
<message>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
-<TS>
+<TS version="2.0" language="ja" sourcelanguage="en">
<context>
- <name>Yacsgui</name>
+ <name>@default</name>
+ <message>
+ <source>Choose Batch Job to watch</source>
+ <translation>バッチジョブの監視を選択</translation>
+ </message>
+ <message>
+ <source>Select one Batch Job to watch</source>
+ <translation>バッチジョブの監視を選択</translation>
+ </message>
<message>
<source>PREF_TAB_GENERAL</source>
- <translation>一般的な</translation>
+ <translation>一般</translation>
</message>
<message>
<source>PREF_GROUP_COMPONENT</source>
</message>
<message>
<source>PREF_TAB_STATE</source>
- <translation>ノードの状態</translation>
+ <translation>ノード状態</translation>
</message>
<message>
<source>PREF_GROUP_EDIT</source>
- <translation>ç\8a¶æ\85\8bã\82\92ç·¨é\9b\86ã\81\97ã\81¾ã\81\99ã\80\82</translation>
+ <translation>ç·¨é\9b\86</translation>
</message>
<message>
<source>PREF_GROUP_RUN</source>
- <translation>実行状態</translation>
+ <translation>実行</translation>
</message>
<message>
<source>PREF_TAB_NODE</source>
</message>
<message>
<source>PREF_GROUP_NODE</source>
- <translation>ノード</translation>
+ <translation>節点</translation>
</message>
<message>
<source>PREF_GROUP_HEADER</source>
</message>
<message>
<source>PREF_GROUP_CONTROL</source>
- <translation>制御ポート</translation>
+ <translation>ポート制御</translation>
</message>
<message>
<source>PREF_GROUP_PORT</source>
- <translation>ã\83\87ã\83¼ã\82¿ã\83\95ã\83ã\83¼ ã\83\9dã\83¼ã\83\88</translation>
+ <translation>ã\83\9dã\83¼ã\83\88ã\83\87ã\83¼ã\82¿ã\83\95ã\83ã\83¼</translation>
</message>
<message>
<source>PREF_GROUP_DRAG</source>
- <translation>ドラッグします。</translation>
+ <translation>ドラッグ</translation>
</message>
<message>
<source>PREF_GROUP_GENERAL</source>
</message>
<message>
<source>COMPONENT_INSTANCE_NEW</source>
- <translation>新しい各サービス ノードのコンポーネントのインスタンスを作成します。</translation>
+ <translation>各新しいサービス ノードのコンポーネント インスタンスの作成</translation>
+ </message>
+ <message>
+ <source>Link colors</source>
+ <translation>リンクの色</translation>
+ </message>
+ <message>
+ <source>Link draw color</source>
+ <translation>リンクを作成する色</translation>
+ </message>
+ <message>
+ <source>Link select color</source>
+ <translation>リンクを選択する色</translation>
+ </message>
+ <message>
+ <source>Stream link draw color</source>
+ <translation>ストリーム リンクを作成する色</translation>
+ </message>
+ <message>
+ <source>Stream link select color</source>
+ <translation>ストリーム リンクを選択する色</translation>
+ </message>
+ <message>
+ <source>Control link draw color</source>
+ <translation>制御リンクを作成する色</translation>
+ </message>
+ <message>
+ <source>Control link select color</source>
+ <translation>制御リンクを選択する色</translation>
+ </message>
+ <message>
+ <source>Emphasis link color</source>
+ <translation>リンクを強調する色</translation>
+ </message>
+ <message>
+ <source>link pen darkness</source>
+ <translation>暗いペンリンク</translation>
+ </message>
+ <message>
+ <source>Pen</source>
+ <translation>ペン</translation>
+ </message>
+ <message>
+ <source>Brush</source>
+ <translation>筆</translation>
+ </message>
+ <message>
+ <source>High pen</source>
+ <translation>ペントップ</translation>
+ </message>
+ <message>
+ <source>High brush</source>
+ <translation>筆トップ</translation>
+ </message>
+ <message>
+ <source>On dragging</source>
+ <translation>ドラッグ中</translation>
</message>
<message>
<source>ERROR</source>
<translation>プラグイン</translation>
</message>
</context>
+ <context>
+ <name>YACS::HMI::ComposedNodeMenu</name>
+ <message>
+ <source>Create Node</source>
+ <translation>ノードを作成</translation>
+ </message>
+ </context>
+ <context>
+ <name>YACS::HMI::GenericGui</name>
+ <message>
+ <source>Create a new YACS Schema</source>
+ <translation>新しい YACS スキーマを作成</translation>
+ </message>
+ <message>
+ <source>New Schema</source>
+ <translation>新しいスキーマ</translation>
+ </message>
+ <message>
+ <source>Import a YACS Schema for edition</source>
+ <translation>編集のためのYACSスキーマ読み込み</translation>
+ </message>
+ <message>
+ <source>Import Schema</source>
+ <translation>スキーマ読み込み</translation>
+ </message>
+ <message>
+ <source>Import a SUPERV Schema for edition</source>
+ <translation>編集のためのSUPERV スキーマ読み込み</translation>
+ </message>
+ <message>
+ <source>Import SUPERV Schema</source>
+ <translation>SUPERV スキーマ読み込み</translation>
+ </message>
+ <message>
+ <source>Save the current YACS Schema</source>
+ <translation>現在のYACSスキーマの保存</translation>
+ </message>
+ <message>
+ <source>Save Schema</source>
+ <translation>スキーマの保存</translation>
+ </message>
+ <message>
+ <source>Save the current YACS Schema As...</source>
+ <translation>現在のYACSスキーマの保存...</translation>
+ </message>
+ <message>
+ <source>Save Schema As</source>
+ <translation>スキーマの保存...</translation>
+ </message>
+ <message>
+ <source>Import a Schema as a Catalog</source>
+ <translation>カタログとしてスキーマを読み込む</translation>
+ </message>
+ <message>
+ <source>Import Catalog</source>
+ <translation>カタログの読み込み</translation>
+ </message>
+ <message>
+ <source>Prepare the current edited schema for run</source>
+ <translation>実行時に編集されているスキーマの準備</translation>
+ </message>
+ <message>
+ <source>Run Current Schema</source>
+ <translation>現在のスキーマの実行</translation>
+ </message>
+ <message>
+ <source>Load a previous run state for this schema, prepare to run</source>
+ <translation>このスキーマの以前の実行状態を読み込み、実行するための準備</translation>
+ </message>
+ <message>
+ <source>Load Run State</source>
+ <translation>実行状態の読み込み</translation>
+ </message>
+ <message>
+ <source>Load a schema for run</source>
+ <translation>起動するスキーマの読み込み</translation>
+ </message>
+ <message>
+ <source>Load Schema to run</source>
+ <translation>実行するスキーマの読み込み</translation>
+ </message>
+ <message>
+ <source>Load Batch Schema for edition</source>
+ <translation>バッチ用のスキーマの読み込み</translation>
+ </message>
+ <message>
+ <source>Load Batch Schema</source>
+ <translation>バッチスキーマの読み込み</translation>
+ </message>
+ <message>
+ <source>Start or Resume Schema execution</source>
+ <translation>開始または再開スキーマの実行</translation>
+ </message>
+ <message>
+ <source>Start/Resume execution</source>
+ <translation>実行の開始/再開</translation>
+ </message>
+ <message>
+ <source>Abort the current execution</source>
+ <translation>現在の実行を中止</translation>
+ </message>
+ <message>
+ <source>Abort execution</source>
+ <translation>実行の中止</translation>
+ </message>
+ <message>
+ <source>Suspend the current execution</source>
+ <translation>現在の実行を中断</translation>
+ </message>
+ <message>
+ <source>Suspend execution</source>
+ <translation>実行の中断</translation>
+ </message>
+ <message>
+ <source>Reset the current execution</source>
+ <translation>現在の実行をリセット</translation>
+ </message>
+ <message>
+ <source>Reset execution</source>
+ <translation>実行のリセット</translation>
+ </message>
+ <message>
+ <source>Save the current run state</source>
+ <translation>現在の実行状態を保存</translation>
+ </message>
+ <message>
+ <source>Save State</source>
+ <translation>状態の保存</translation>
+ </message>
+ <message>
+ <source>Edit again the current schema in a new context</source>
+ <translation>新しいコンテキストで現在のスキーマを再編集</translation>
+ </message>
+ <message>
+ <source>Edit Again</source>
+ <translation>再編集</translation>
+ </message>
+ <message>
+ <source>get YACS container log</source>
+ <translation>YACSコンテナログの取得</translation>
+ </message>
+ <message>
+ <source>YACS Container Log</source>
+ <translation>YACSコンテナログ</translation>
+ </message>
+ <message>
+ <source>get Node Error Report</source>
+ <translation>ノードエラーレポートの取得</translation>
+ </message>
+ <message>
+ <source>Node Error Report</source>
+ <translation>ノードエラーレポート</translation>
+ </message>
+ <message>
+ <source>get Node Error Details</source>
+ <translation>ノードエラーの詳細を取得</translation>
+ </message>
+ <message>
+ <source>Node Error Details</source>
+ <translation>ノードエラーの詳細</translation>
+ </message>
+ <message>
+ <source>get Node Container Log</source>
+ <translation>ノードコンテナログの取得</translation>
+ </message>
+ <message>
+ <source>Node Container Log</source>
+ <translation> ノードコンテナログ</translation>
+ </message>
+ <message>
+ <source>Edit Data Types</source>
+ <translation>データ型の編集</translation>
+ </message>
+ <message>
+ <source>Create Data Types</source>
+ <translation>データ型の作成</translation>
+ </message>
+ <message>
+ <source>Import Data Types, use drag and drop from catalog</source>
+ <translation>データ型のインポート(カタログからのドラッグ&ドロップを使用)</translation>
+ </message>
+ <message>
+ <source>Import Data Types</source>
+ <translation>データ型のインポート</translation>
+ </message>
+ <message>
+ <source>Create a New Container</source>
+ <translation>新しいコンテナの作成</translation>
+ </message>
+ <message>
+ <source>Create Container</source>
+ <translation>コンテナの作成</translation>
+ </message>
+ <message>
+ <source>Select a Component Instance</source>
+ <translation>コンポーネントインスタンスの選択</translation>
+ </message>
+ <message>
+ <source>Create a New SALOME Component Instance</source>
+ <translation>新しいSALOMEコンポーネントインスタンスの作成</translation>
+ </message>
+ <message>
+ <source>new Component Instance</source>
+ <translation>新しいコンポーネントインスタンス</translation>
+ </message>
+ <message>
+ <source>Create a New SALOME Python Component</source>
+ <translation>新しいSALOME Python コンポーネントの作成</translation>
+ </message>
+ <message>
+ <source>SALOME Python Component</source>
+ <translation>SALOME Python コンポーネント</translation>
+ </message>
+ <message>
+ <source>Create a New CORBA Component</source>
+ <translation>新しい CORBA コンポーネントの作成</translation>
+ </message>
+ <message>
+ <source>CORBA Component</source>
+ <translation>CORBAコンポーネント</translation>
+ </message>
+ <message>
+ <source>Create a New SALOME Service Node</source>
+ <translation>新しいSALOME サービスノードの作成</translation>
+ </message>
+ <message>
+ <source>SALOME Service Node</source>
+ <translation>SALOMEサービスノード</translation>
+ </message>
+ <message>
+ <source>Create a New Inline Service Node</source>
+ <translation>新しいインラインサービスノードの作成</translation>
+ </message>
+ <message>
+ <source>Inline Service Node</source>
+ <translation>インラインサービスノード</translation>
+ </message>
+ <message>
+ <source>Create a New CORBA Service Node</source>
+ <translation>新しいCORBAサービスノードの作成</translation>
+ </message>
+ <message>
+ <source>CORBA Node</source>
+ <translation>CORBAノード</translation>
+ </message>
+ <message>
+ <source>Create a New Node referencing a Node</source>
+ <translation>ノードを参照する新しいノードを作成</translation>
+ </message>
+ <message>
+ <source>Ref on Node</source>
+ <translation>ノードの参照</translation>
+ </message>
+ <message>
+ <source>Create a New C++ Node</source>
+ <translation>新しいC++ノードの作成</translation>
+ </message>
+ <message>
+ <source>Cpp Node</source>
+ <translation>Cppノード</translation>
+ </message>
+ <message>
+ <source>Create a New Input data Node</source>
+ <translation>新しい入力データノードの作成</translation>
+ </message>
+ <message>
+ <source>Input Data Node</source>
+ <translation>入力データノード</translation>
+ </message>
+ <message>
+ <source>Create a New Output data Node</source>
+ <translation>新しい出力データノードの作成</translation>
+ </message>
+ <message>
+ <source>Output Data Node</source>
+ <translation>出力データノード</translation>
+ </message>
+ <message>
+ <source>Create a New Input Study Node</source>
+ <translation>新しい入力Studyノードの作成</translation>
+ </message>
+ <message>
+ <source>Input Study Node</source>
+ <translation>入力Studyノード</translation>
+ </message>
+ <message>
+ <source>Create a New Output Study Node</source>
+ <translation>新しい出力Studyノードの作成</translation>
+ </message>
+ <message>
+ <source>Output Study Node</source>
+ <translation>出力Studyノード</translation>
+ </message>
+ <message>
+ <source>Create a New Inline Python Script Node</source>
+ <translation>新しいインラインPythonスクリプトノードの作成</translation>
+ </message>
+ <message>
+ <source>Inline Script Node</source>
+ <translation>インラインスクリプトノード</translation>
+ </message>
+ <message>
+ <source>Create a New Inline Python Function Node</source>
+ <translation>新しいインラインPython関数ノードの作成</translation>
+ </message>
+ <message>
+ <source>Inline Function Node</source>
+ <translation>インライン関数ノード</translation>
+ </message>
+ <message>
+ <source>Create a New Bloc Node</source>
+ <translation>新しいブロックノードの作成</translation>
+ </message>
+ <message>
+ <source>bloc Node</source>
+ <translation>ブロックノード</translation>
+ </message>
+ <message>
+ <source>Create a New For Loop Node</source>
+ <translation>新しい For loop ノードの作成</translation>
+ </message>
+ <message>
+ <source>For Loop Node</source>
+ <translation>For Loop ノード</translation>
+ </message>
+ <message>
+ <source>Create a New For Each Loop Node</source>
+ <translation>新しい For Each Loop ノードの作成</translation>
+ </message>
+ <message>
+ <source>For Each Loop Node</source>
+ <translation>For Each Loop ノード</translation>
+ </message>
+ <message>
+ <source>Create a New While Loop Node</source>
+ <translation>新しい While Loop ノードの作成</translation>
+ </message>
+ <message>
+ <source>While Loop Node</source>
+ <translation>While Loop Node</translation>
+ </message>
+ <message>
+ <source>Create a New Switch Node</source>
+ <translation>新しいスイッチノードの作成</translation>
+ </message>
+ <message>
+ <source>Switch Node</source>
+ <translation>スイッチノード</translation>
+ </message>
+ <message>
+ <source>Create a New Optimizer Loop Node</source>
+ <translation>新しい最適化ループノードの作成</translation>
+ </message>
+ <message>
+ <source>Optimizer Loop</source>
+ <translation>最適化ループ</translation>
+ </message>
+ <message>
+ <source>Create a New Optimizer Loop</source>
+ <translation>新しい最適化ループの作成</translation>
+ </message>
+ <message>
+ <source>Create a New Node from Catalog, use drag and drop from catalog</source>
+ <translation>カタログから新しいノードを作成,カタログからドラッグ&ドロップを使用</translation>
+ </message>
+ <message>
+ <source>Node from Catalog</source>
+ <translation>カタログからのノード</translation>
+ </message>
+ <message>
+ <source>Delete a Schema Item</source>
+ <translation>スキーマ項目の削除</translation>
+ </message>
+ <message>
+ <source>Delete Item</source>
+ <translation>項目の削除</translation>
+ </message>
+ <message>
+ <source>Cut a Schema Item</source>
+ <translation>スキーマ項目の切り取り</translation>
+ </message>
+ <message>
+ <source>Cut Item</source>
+ <translation>項目の切り取り</translation>
+ </message>
+ <message>
+ <source>Copy a Schema Item</source>
+ <translation>スキーマ項目のコピー</translation>
+ </message>
+ <message>
+ <source>Copy Item</source>
+ <translation>項目のコピー</translation>
+ </message>
+ <message>
+ <source>Paste a Schema Item</source>
+ <translation>スキーマ項目のペースト</translation>
+ </message>
+ <message>
+ <source>Paste Item</source>
+ <translation>項目のペースト</translation>
+ </message>
+ <message>
+ <source>Put node in block</source>
+ <translation>ブロック内のノードを置く</translation>
+ </message>
+ <message>
+ <source>Put Graph Content in Node</source>
+ <translation type="unfinished">ノード内のグラフの内容を置く</translation>
+ </message>
+ <message>
+ <source>arrange nodes on that bloc level, without recursion</source>
+ <translation>再帰せずにそのブロックレベル上にノードを配置</translation>
+ </message>
+ <message>
+ <source>arrange local nodes</source>
+ <translation>ローカルノードを配置</translation>
+ </message>
+ <message>
+ <source>arrange nodes on that bloc level, with recursion</source>
+ <translation>再帰を伴ってそのブロックレベル上にノードを配置</translation>
+ </message>
+ <message>
+ <source>arrange nodes recursion</source>
+ <translation>ノードの再帰の配置</translation>
+ </message>
+ <message>
+ <source>compute orthogonal links</source>
+ <translation>直交リンクの計算</translation>
+ </message>
+ <message>
+ <source>compute links</source>
+ <translation>リンクの計算</translation>
+ </message>
+ <message>
+ <source>zoom 2D view to selected bloc</source>
+ <translation>2Dビューを選択したブロックにズーム</translation>
+ </message>
+ <message>
+ <source>zoom to bloc</source>
+ <translation>ブロックにズーム</translation>
+ </message>
+ <message>
+ <source>zoom 2D view to the selected composed node</source>
+ <translation>2Dビューを選択中の構成ノードにズーム</translation>
+ </message>
+ <message>
+ <source>center 2D view on selected node</source>
+ <translation>選択中のノード上に2Dビューを集中</translation>
+ </message>
+ <message>
+ <source>center on node</source>
+ <translation>ノードに集中</translation>
+ </message>
+ <message>
+ <source>shrink or expand the selected node</source>
+ <translation>選択中のノードを展開または縮小</translation>
+ </message>
+ <message>
+ <source>shrink/expand</source>
+ <translation>展開/縮小</translation>
+ </message>
+ <message>
+ <source>draw straight or orthogonal links</source>
+ <translation>直線または直交リンクを描画</translation>
+ </message>
+ <message>
+ <source>straight/orthogonal</source>
+ <translation>直線/直交</translation>
+ </message>
+ <message>
+ <source>compute othogonal links automatically when nodes move</source>
+ <translation>ノード移動時に直交リンクを自動的に計算</translation>
+ </message>
+ <message>
+ <source>automatic link</source>
+ <translation>自動リンク</translation>
+ </message>
+ <message>
+ <source>simplify links by removing unnecessary direction changes</source>
+ <translation>不要な方向変更の削除によるリンクの簡素化</translation>
+ </message>
+ <message>
+ <source>simplify links</source>
+ <translation>リンクの簡素化</translation>
+ </message>
+ <message>
+ <source>force orthogonal links by adding an edge on simples links</source>
+ <translation>簡素リンク上でのエッジの追加による直交リンクの強制</translation>
+ </message>
+ <message>
+ <source>force ortho links</source>
+ <translation>直交リンクの強制</translation>
+ </message>
+ <message>
+ <source>allow more path for the links, for a better separation</source>
+ <translation>リンクやより良い分離のためにより多くのパスを許可</translation>
+ </message>
+ <message>
+ <source>separate links</source>
+ <translation>分離リンク</translation>
+ </message>
+ <message>
+ <source>select reference</source>
+ <translation>参照の選択</translation>
+ </message>
+ <message>
+ <source>active whatsThis Mode to get help on widgets</source>
+ <translation>ウィジェット上のヘルプ取得のためにWhatsThisモードを有効</translation>
+ </message>
+ <message>
+ <source>whatsThis Mode</source>
+ <translation>WhatsThisモード</translation>
+ </message>
+ <message>
+ <source>set execution mode without stop</source>
+ <translation>停止せずに実行モードをセット</translation>
+ </message>
+ <message>
+ <source>mode without stop</source>
+ <translation>不停止モード</translation>
+ </message>
+ <message>
+ <source>set execution mode with stop on breakpoints</source>
+ <translation>ブレイクポイントで停止する実行モードを設定</translation>
+ </message>
+ <message>
+ <source>mode breakpoints</source>
+ <translation>モードのブレイクポイント</translation>
+ </message>
+ <message>
+ <source>set execution mode step by step</source>
+ <translation>Step by Step 実行モードの設定</translation>
+ </message>
+ <message>
+ <source>mode step by step</source>
+ <translation>モードのStep by Step</translation>
+ </message>
+ <message>
+ <source>Force stop on first error during execution</source>
+ <translation>実行中に発生した最初のエラーで強制停止</translation>
+ </message>
+ <message>
+ <source>stop on error</source>
+ <translation>エラー時に停止</translation>
+ </message>
+ <message>
+ <source>toggle 2D scene item visibility</source>
+ <translation>2 D シーン アイテムの表示切り替え</translation>
+ </message>
+ <message>
+ <source>visible/hidden</source>
+ <translation>表示/非表示</translation>
+ </message>
+ <message>
+ <source>Show all the links</source>
+ <translation>すべてのリンクを表示</translation>
+ </message>
+ <message>
+ <source>show all links</source>
+ <translation>すべてのリンクを表示</translation>
+ </message>
+ <message>
+ <source>Hide all the links</source>
+ <translation>すべてのリンクを非表示</translation>
+ </message>
+ <message>
+ <source>hide all links</source>
+ <translation>すべてのリンクを非表示</translation>
+ </message>
+ <message>
+ <source>Show only links from/to this port</source>
+ <translation>このポートとのリンクのみ表示</translation>
+ </message>
+ <message>
+ <source>show only links</source>
+ <translation>リンクのみ表示</translation>
+ </message>
+ <message>
+ <source>Show links from/to this port</source>
+ <translation>このポートとのリンクを表示</translation>
+ </message>
+ <message>
+ <source>show links</source>
+ <translation>リンクを表示</translation>
+ </message>
+ <message>
+ <source>Hide links from/to this port</source>
+ <translation>このポートとのリンクを非表示</translation>
+ </message>
+ <message>
+ <source>hide links</source>
+ <translation>リンクを非表示</translation>
+ </message>
+ <message>
+ <source>Show only control links from/to this node</source>
+ <translation>このノードとの制御リンクのみ表示</translation>
+ </message>
+ <message>
+ <source>show only Control links</source>
+ <translation>制御リンクのみ表示</translation>
+ </message>
+ <message>
+ <source>Show control links from/to this node</source>
+ <translation>このノードとの制御リンクを表示</translation>
+ </message>
+ <message>
+ <source>show control links</source>
+ <translation>制御リンクを表示</translation>
+ </message>
+ <message>
+ <source>Hide control links from/to this node</source>
+ <translation>このノードとの制御リンクを非表示</translation>
+ </message>
+ <message>
+ <source>hide control links</source>
+ <translation>制御リンクを非表示</translation>
+ </message>
+ <message>
+ <source>Show only this link</source>
+ <translation>このリンクのみ表示</translation>
+ </message>
+ <message>
+ <source>show only</source>
+ <translation>表示のみ</translation>
+ </message>
+ <message>
+ <source>Show this link</source>
+ <translation>このリンクを表示</translation>
+ </message>
+ <message>
+ <source>show</source>
+ <translation>表示</translation>
+ </message>
+ <message>
+ <source>Hide this link</source>
+ <translation>このリンクを非表示</translation>
+ </message>
+ <message>
+ <source>hide</source>
+ <translation>非表示</translation>
+ </message>
+ <message>
+ <source>emphasis on links from/to this port</source>
+ <translation>このポートとのリンクを強調</translation>
+ </message>
+ <message>
+ <source>emphasize links</source>
+ <translation>強調リンク</translation>
+ </message>
+ <message>
+ <source>emphasis on control links from/to this node</source>
+ <translation>このノードとの制御リンクの強調</translation>
+ </message>
+ <message>
+ <source>emphasize control links</source>
+ <translation>制御リンクの強調</translation>
+ </message>
+ <message>
+ <source>emphasis on this link</source>
+ <translation>このリンクの強調</translation>
+ </message>
+ <message>
+ <source>emphasize</source>
+ <translation>強調</translation>
+ </message>
+ <message>
+ <source>remove all emphasis</source>
+ <translation>すべての強調を削除</translation>
+ </message>
+ <message>
+ <source>undo last action</source>
+ <translation>最後の操作をundo</translation>
+ </message>
+ <message>
+ <source>undo</source>
+ <translation>undo</translation>
+ </message>
+ <message>
+ <source>redo last action</source>
+ <translation>最後の操作をredo</translation>
+ </message>
+ <message>
+ <source>redo</source>
+ <translation>redo</translation>
+ </message>
+ <message>
+ <source>show undo commands</source>
+ <translation>undoコマンドを表示</translation>
+ </message>
+ <message>
+ <source>show undo</source>
+ <translation>undoを表示</translation>
+ </message>
+ <message>
+ <source>show redo commands</source>
+ <translation>redoコマンドを表示</translation>
+ </message>
+ <message>
+ <source>show redo</source>
+ <translation>redoを表示</translation>
+ </message>
+ <message>
+ <source>File</source>
+ <translation>ファイル</translation>
+ </message>
+ <message>
+ <source>YACS Toolbar</source>
+ <translation>YACSツールバー</translation>
+ </message>
+ <message>
+ <source>XML-Files (*.xml);;All Files (*)</source>
+ <translation>XMLファイル (*.xml);;すべてのファイル (*)</translation>
+ </message>
+ </context>
+ <context>
+ <name>YACS::HMI::MenusBase</name>
+ <message>
+ <source>Elapse Time Statistics</source>
+ <translation>経過時間の統計</translation>
+ </message>
+ </context>
+ <context>
+ <name>YACS::HMI::ProcMenu</name>
+ <message>
+ <source>Create Node</source>
+ <translation>ノードを作成</translation>
+ </message>
+ </context>
</TS>
#include "OptimizerAlg.hxx"
-using namespace YACS::ENGINE;
+#include <iostream>
+//using namespace YACS::ENGINE;
extern "C"
{
- OptimizerAlgBase * createOptimizerAlgASyncExample(Pool * pool);
+ YACS::ENGINE::OptimizerAlgBase * createOptimizerAlgASyncExample(YACS::ENGINE::Pool * pool);
}
-class OptimizerAlgASyncExample : public OptimizerAlgASync
- {
+class OptimizerAlgASyncExample : public YACS::ENGINE::OptimizerAlgASync
+{
private:
- TypeCode * _tcIn;
- TypeCode * _tcOut;
+ YACS::ENGINE::TypeCode *_tcInt;
+ YACS::ENGINE::TypeCode *_tcDouble;
public:
- OptimizerAlgASyncExample(Pool * pool);
+ OptimizerAlgASyncExample(YACS::ENGINE::Pool *pool);
virtual ~OptimizerAlgASyncExample();
- TypeCode * getTCForIn() const;
- TypeCode * getTCForOut() const;
- void startToTakeDecision();
- };
+
+ //! returns typecode of type expected as Input. OwnerShip of returned pointer is held by this.
+ virtual YACS::ENGINE::TypeCode *getTCForIn() const;
+ //! returns typecode of type expected as Output. OwnerShip of returned pointer is held by this.
+ virtual YACS::ENGINE::TypeCode *getTCForOut() const;
+ //! returns typecode of type expected for algo initialization. OwnerShip of returned pointer is held by this.
+ virtual YACS::ENGINE::TypeCode *getTCForAlgoInit() const;
+ //! returns typecode of type expected as algo result. OwnerShip of returned pointer is held by this.
+ virtual YACS::ENGINE::TypeCode *getTCForAlgoResult() const;
+ virtual void initialize(const YACS::ENGINE::Any *input) throw (YACS::Exception);
+ virtual void startToTakeDecision();
+ virtual void finish();//! Called when optimization has succeed.
+ virtual YACS::ENGINE::Any * getAlgoResult();
+};
-OptimizerAlgASyncExample::OptimizerAlgASyncExample(Pool * pool) : OptimizerAlgASync(pool),
- _tcIn(0), _tcOut(0)
+OptimizerAlgASyncExample::OptimizerAlgASyncExample(YACS::ENGINE::Pool *pool)
+ : YACS::ENGINE::OptimizerAlgASync(pool), _tcInt(0), _tcDouble(0)
{
- _tcIn = new TypeCode(Double);
- _tcOut = new TypeCode(Int);
+ _tcDouble = new YACS::ENGINE::TypeCode(YACS::ENGINE::Double);
+ _tcInt = new YACS::ENGINE::TypeCode(YACS::ENGINE::Int);
}
OptimizerAlgASyncExample::~OptimizerAlgASyncExample()
{
- _tcIn->decrRef();
- _tcOut->decrRef();
+ _tcDouble->decrRef();
+ _tcInt->decrRef();
+}
+
+//! Return the typecode of the expected input of the internal node
+YACS::ENGINE::TypeCode * OptimizerAlgASyncExample::getTCForIn() const
+{
+ return _tcDouble;
+}
+
+//! Return the typecode of the expected output of the internal node
+YACS::ENGINE::TypeCode * OptimizerAlgASyncExample::getTCForOut() const
+{
+ return _tcInt;
}
-//! Return the typecode of the expected input type
-TypeCode *OptimizerAlgASyncExample::getTCForIn() const
+//! Return the typecode of the expected input of the algorithm (algoInit port)
+YACS::ENGINE::TypeCode * OptimizerAlgASyncExample::getTCForAlgoInit() const
{
- return _tcIn;
+ return _tcInt;
}
-//! Return the typecode of the expected output type
-TypeCode *OptimizerAlgASyncExample::getTCForOut() const
+//! Return the typecode of the expected output of the algorithm (algoResult port)
+YACS::ENGINE::TypeCode * OptimizerAlgASyncExample::getTCForAlgoResult() const
{
- return _tcOut;
+ return _tcInt;
+}
+
+//! Optional method to initialize the algorithm.
+/*!
+ * For now, the parameter input is always NULL. It might be used in the
+ * future to initialize an algorithm with custom data.
+ */
+void OptimizerAlgASyncExample::initialize(const YACS::ENGINE::Any *input)
+ throw (YACS::Exception)
+{
+ std::cout << "Algo initialize, input = " << input->getIntValue() << std::endl;
}
//! This method is called only once to launch the algorithm.
/*!
- * It must first fill the pool with samples to evaluate and call signalMasterAndWait()
- * to block until a sample has been evaluated. When returning from this method, it MUST
- * check for an eventual termination request (with the method isTerminationRequested()).
- * If the termination is requested, the method must perform any necessary cleanup and
- * return as soon as possible. Otherwise it can either add new samples to evaluate in
- * the pool, do nothing (wait for more samples), or empty the pool and return to finish
- * the evaluation.
+ * It must first fill the pool with samples to evaluate and call
+ * signalMasterAndWait() to block until a sample has been evaluated. When
+ * returning from this method, it MUST check for an eventual termination
+ * request (with the method isTerminationRequested()). If the termination
+ * is requested, the method must perform any necessary cleanup and return
+ * as soon as possible. Otherwise it can either add new samples to evaluate
+ * in the pool, do nothing (wait for more samples), or empty the pool and
+ * return to finish the evaluation.
*/
void OptimizerAlgASyncExample::startToTakeDecision()
{
- double val = 1.2;
- for (int i=0 ; i<5 ; i++) {
- // push a sample in the input of the slave node
- _pool->pushInSample(i, AtomAny::New(val));
- // wait until next sample is ready
- signalMasterAndWait();
- // check error notification
- if (isTerminationRequested()) {
- _pool->destroyAll();
- return;
+ std::cout << "startToTakeDecision" << std::endl;
+ int iter = 0;
+ YACS::ENGINE::Any *val=YACS::ENGINE::AtomAny::New(0.5);
+ _pool->pushInSample(iter, val);
+
+ signalMasterAndWait();
+ while(!isTerminationRequested())
+ {
+ int currentId = _pool->getCurrentId();
+ double valIn = _pool->getCurrentInSample()->getDoubleValue();
+ int valOut = _pool->getCurrentOutSample()->getIntValue();
+
+ std::cout << "Compute currentId=" << currentId;
+ std::cout << ", valIn=" << valIn;
+ std::cout << ", valOut=" << valOut << std::endl;
+
+ iter++;
+ if(iter < 3)
+ {
+ YACS::ENGINE::Any *val=YACS::ENGINE::AtomAny::New(valIn + 1);
+ _pool->pushInSample(iter, val);
}
-
- // get a sample from the output of the slave node
- Any * v = _pool->getCurrentOutSample();
- val += v->getIntValue();
+ signalMasterAndWait();
}
+}
- // in the end destroy the pool content
+/*!
+ * Optional method called when the algorithm has finished, successfully or
+ * not, to perform any necessary clean up.
+ */
+void OptimizerAlgASyncExample::finish()
+{
+ std::cout << "Algo finish" << std::endl;
_pool->destroyAll();
}
+/*!
+ * Return the value of the algoResult port.
+ */
+YACS::ENGINE::Any * OptimizerAlgASyncExample::getAlgoResult()
+{
+ YACS::ENGINE::Any *val=YACS::ENGINE::AtomAny::New(42);
+ return val;
+}
+
//! Factory method to create the algorithm.
-OptimizerAlgBase * createOptimizerAlgASyncExample(Pool * pool)
+YACS::ENGINE::OptimizerAlgBase * createOptimizerAlgASyncExample(YACS::ENGINE::Pool *pool)
{
return new OptimizerAlgASyncExample(pool);
-}
+}
\ No newline at end of file
#include "OptimizerAlg.hxx"
-using namespace YACS::ENGINE;
+#include <iostream>
+//using namespace YACS::ENGINE;
extern "C"
{
- OptimizerAlgBase * createOptimizerAlgSyncExample(Pool * pool);
+ YACS::ENGINE::OptimizerAlgBase * createOptimizerAlgSyncExample(YACS::ENGINE::Pool * pool);
}
-class OptimizerAlgSyncExample : public OptimizerAlgSync
- {
+class OptimizerAlgSyncExample : public YACS::ENGINE::OptimizerAlgSync
+{
private:
- int _idTest;
- TypeCode *_tcIn;
- TypeCode *_tcOut;
+ int _iter;
+ YACS::ENGINE::TypeCode *_tcInt;
+ YACS::ENGINE::TypeCode *_tcDouble;
public:
- OptimizerAlgSyncExample(Pool *pool);
+ OptimizerAlgSyncExample(YACS::ENGINE::Pool *pool);
virtual ~OptimizerAlgSyncExample();
- TypeCode *getTCForIn() const;
- TypeCode *getTCForOut() const;
- void start();
- void takeDecision();
- void initialize(const Any *input) throw(YACS::Exception);
- void finish();
- };
-
-OptimizerAlgSyncExample::OptimizerAlgSyncExample(Pool *pool) : OptimizerAlgSync(pool),
- _tcIn(0), _tcOut(0),
- _idTest(0)
+
+ //! returns typecode of type expected as Input. OwnerShip of returned pointer is held by this.
+ virtual YACS::ENGINE::TypeCode *getTCForIn() const;
+ //! returns typecode of type expected as Output. OwnerShip of returned pointer is held by this.
+ virtual YACS::ENGINE::TypeCode *getTCForOut() const;
+ //! returns typecode of type expected for algo initialization. OwnerShip of returned pointer is held by this.
+ virtual YACS::ENGINE::TypeCode *getTCForAlgoInit() const;
+ //! returns typecode of type expected as algo result. OwnerShip of returned pointer is held by this.
+ virtual YACS::ENGINE::TypeCode *getTCForAlgoResult() const;
+ virtual void initialize(const YACS::ENGINE::Any *input) throw (YACS::Exception);
+ virtual void start(); //! Update _pool attribute before performing anything.
+ virtual void takeDecision();//! _pool->getCurrentId gives the \b id at the origin of this call.
+ //! Perform the job of analysing to know what new jobs to do (_pool->pushInSample)
+ //! or in case of convergence _pool->destroyAll
+ virtual void finish();//! Called when optimization has succeed.
+ virtual YACS::ENGINE::Any * getAlgoResult();
+};
+
+OptimizerAlgSyncExample::OptimizerAlgSyncExample(YACS::ENGINE::Pool *pool)
+ : YACS::ENGINE::OptimizerAlgSync(pool), _tcInt(0), _tcDouble(0), _iter(0)
{
- _tcIn=new TypeCode(Double);
- _tcOut=new TypeCode(Int);
+ _tcDouble = new YACS::ENGINE::TypeCode(YACS::ENGINE::Double);
+ _tcInt = new YACS::ENGINE::TypeCode(YACS::ENGINE::Int);
}
OptimizerAlgSyncExample::~OptimizerAlgSyncExample()
{
- std::cout << "Destroying OptimizerAlgSyncExample" << std::endl;
- _tcIn->decrRef();
- _tcOut->decrRef();
- std::cout << "Destroyed OptimizerAlgSyncExample" << std::endl;
+ _tcDouble->decrRef();
+ _tcInt->decrRef();
}
-//! Return the typecode of the expected input type
-TypeCode * OptimizerAlgSyncExample::getTCForIn() const
+//! Return the typecode of the expected input of the internal node
+YACS::ENGINE::TypeCode * OptimizerAlgSyncExample::getTCForIn() const
{
- return _tcIn;
+ return _tcDouble;
}
-//! Return the typecode of the expected output type
-TypeCode * OptimizerAlgSyncExample::getTCForOut() const
+//! Return the typecode of the expected output of the internal node
+YACS::ENGINE::TypeCode * OptimizerAlgSyncExample::getTCForOut() const
{
- return _tcOut;
+ return _tcInt;
+}
+
+//! Return the typecode of the expected input of the algorithm (algoInit port)
+YACS::ENGINE::TypeCode * OptimizerAlgSyncExample::getTCForAlgoInit() const
+{
+ return _tcInt;
+}
+
+//! Return the typecode of the expected output of the algorithm (algoResult port)
+YACS::ENGINE::TypeCode * OptimizerAlgSyncExample::getTCForAlgoResult() const
+{
+ return _tcInt;
+}
+
+//! Optional method to initialize the algorithm.
+/*!
+ * For now, the parameter input is always NULL. It might be used in the
+ * future to initialize an algorithm with custom data.
+ */
+void OptimizerAlgSyncExample::initialize(const YACS::ENGINE::Any *input)
+ throw (YACS::Exception)
+{
+ std::cout << "Algo initialize, input = " << input->getIntValue() << std::endl;
}
//! Start to fill the pool with samples to evaluate
void OptimizerAlgSyncExample::start()
{
- _idTest=0;
- Any *val=AtomAny::New(1.2);
- _pool->pushInSample(4,val);
- val=AtomAny::New(3.4);
- _pool->pushInSample(9,val);
+ std::cout << "Algo start " << std::endl;
+ _iter=0;
+ YACS::ENGINE::Any *val=YACS::ENGINE::AtomAny::New(0.5);
+ _pool->pushInSample(_iter,val);
}
//! This method is called each time a sample has been evaluated.
/*!
- * It can either add new samples to evaluate in the pool, do nothing (wait for more
- * samples), or empty the pool to finish the evaluation.
+ * It can either add new samples to evaluate in the pool, do nothing (wait
+ * for more samples), or empty the pool to finish the evaluation.
*/
void OptimizerAlgSyncExample::takeDecision()
{
- if(_idTest==1)
- {
- Any *val=AtomAny::New(5.6);
- _pool->pushInSample(16,val);
- val=AtomAny::New(7.8);
- _pool->pushInSample(25,val);
- val=AtomAny::New(9. );
- _pool->pushInSample(36,val);
- val=AtomAny::New(12.3);
- _pool->pushInSample(49,val);
- }
- else if(_idTest==4)
- {
- Any *val=AtomAny::New(45.6);
- _pool->pushInSample(64,val);
- val=AtomAny::New(78.9);
- _pool->pushInSample(81,val);
- }
- else
- {
- Any *tmp= _pool->getCurrentInSample();
- if(fabs(tmp->getDoubleValue()-45.6)<1.e-12)
- _pool->destroyAll();
- }
- _idTest++;
+ int currentId = _pool->getCurrentId();
+ double valIn = _pool->getCurrentInSample()->getDoubleValue();
+ int valOut = _pool->getCurrentOutSample()->getIntValue();
+
+ std::cout << "Algo takeDecision currentId=" << currentId;
+ std::cout << ", valIn=" << valIn;
+ std::cout << ", valOut=" << valOut << std::endl;
+
+ _iter++;
+ if(_iter < 3)
+ {
+ YACS::ENGINE::Any *val=YACS::ENGINE::AtomAny::New(valIn + 1);
+ _pool->pushInSample(_iter, val);
+ }
}
-//! Optional method to initialize the algorithm.
/*!
- * For now, the parameter input is always NULL. It might be used in the future to
- * initialize an algorithm with custom data.
+ * Optional method called when the algorithm has finished, successfully or
+ * not, to perform any necessary clean up.
*/
-void OptimizerAlgSyncExample::initialize(const Any *input) throw (YACS::Exception)
+void OptimizerAlgSyncExample::finish()
{
+ std::cout << "Algo finish" << std::endl;
+ _pool->destroyAll();
}
/*!
- * Optional method called when the algorithm has finished, successfully or not, to
- * perform any necessary clean up.
+ * Return the value of the algoResult port.
*/
-void OptimizerAlgSyncExample::finish()
+YACS::ENGINE::Any * OptimizerAlgSyncExample::getAlgoResult()
{
+ YACS::ENGINE::Any *val=YACS::ENGINE::AtomAny::New(42);
+ return val;
}
//! Factory method to create the algorithm.
-OptimizerAlgBase * createOptimizerAlgSyncExample(Pool *pool)
+YACS::ENGINE::OptimizerAlgBase * createOptimizerAlgSyncExample(YACS::ENGINE::Pool *pool)
{
return new OptimizerAlgSyncExample(pool);
-}
+}
\ No newline at end of file
r=SALOMERuntime.getSALOMERuntime()
self.tin=r.getTypeCode("double")
self.tout=r.getTypeCode("int")
+ self.tAlgoInit=r.getTypeCode("int")
+ self.tAlgoResult=r.getTypeCode("int")
def setPool(self,pool):
"""Must be implemented to set the pool"""
self.pool=pool
def getTCForIn(self):
- """returns typecode of type expected as Input"""
+ """return typecode of type expected as Input of the internal node """
return self.tin
def getTCForOut(self):
- """returns typecode of type expected as Output"""
+ """return typecode of type expected as Output of the internal node"""
return self.tout
- def startToTakeDecision(self):
- """This method is called only once to launch the algorithm. It must first fill the
- pool with samples to evaluate and call self.signalMasterAndWait() to block until a
- sample has been evaluated. When returning from this method, it MUST check for an
- eventual termination request (with the method self.isTerminationRequested()). If
- the termination is requested, the method must perform any necessary cleanup and
- return as soon as possible. Otherwise it can either add new samples to evaluate in
- the pool, do nothing (wait for more samples), or empty the pool and return to
- finish the evaluation.
+ def getTCForAlgoInit(self):
+ """return typecode of type expected as input for initialize """
+ return self.tAlgoInit
+
+ def getTCForAlgoResult(self):
+ """return typecode of type expected as output of the algorithm """
+ return self.tAlgoResult
+
+ def initialize(self,input):
+ """Optional method called on initialization.
+ The type of "input" is returned by "getTCForAlgoInit"
"""
- val=1.2
- for iter in xrange(5):
- #push a sample in the input of the slave node
- self.pool.pushInSample(iter,val)
- #wait until next sample is ready
- self.signalMasterAndWait()
- #check error notification
- if self.isTerminationRequested():
- self.pool.destroyAll()
- return
+ print "Algo initialize, input = ", input.getIntValue()
- #get a sample from the output of the slave node
+ def startToTakeDecision(self):
+ """This method is called only once to launch the algorithm. It must
+ first fill the pool with samples to evaluate and call
+ self.signalMasterAndWait() to block until a sample has been
+ evaluated. When returning from this method, it MUST check for an
+ eventual termination request (with the method
+ self.isTerminationRequested()). If the termination is requested, the
+ method must perform any necessary cleanup and return as soon as
+ possible. Otherwise it can either add new samples to evaluate in the
+ pool, do nothing (wait for more samples), or empty the pool and
+ return to finish the evaluation.
+ """
+ print "startToTakeDecision"
+ # fill the pool with samples
+ iter=0
+ self.pool.pushInSample(0, 0.5)
+
+ #
+ self.signalMasterAndWait()
+ while not self.isTerminationRequested():
currentId=self.pool.getCurrentId()
- v=self.pool.getCurrentOutSample()
- val=val+v.getIntValue()
+ valIn = self.pool.getCurrentInSample().getDoubleValue()
+ valOut = self.pool.getCurrentOutSample().getIntValue()
+ print "Compute currentId=%s, valIn=%s, valOut=%s" % (currentId, valIn, valOut)
+ iter=iter+1
+
+ if iter < 3:
+ nextSample = valIn + 1
+ self.pool.pushInSample(iter, nextSample)
+
+ self.signalMasterAndWait()
- #in the end destroy the pool content
+ def finish(self):
+ """Optional method called when the algorithm has finished, successfully
+ or not, to perform any necessary clean up."""
+ print "Algo finish"
self.pool.destroyAll()
+
+ def getAlgoResult(self):
+ """return the result of the algorithm.
+ The object returned is of type indicated by getTCForAlgoResult.
+ """
+ return 42
+
+
r=SALOMERuntime.getSALOMERuntime()
self.tin=r.getTypeCode("double")
self.tout=r.getTypeCode("int")
+ self.tAlgoInit=r.getTypeCode("int")
+ self.tAlgoResult=r.getTypeCode("int")
def setPool(self,pool):
"""Must be implemented to set the pool"""
self.pool=pool
def getTCForIn(self):
- """returns typecode of type expected as Input"""
+ """return typecode of type expected as Input of the internal node """
return self.tin
def getTCForOut(self):
- """returns typecode of type expected as Output"""
+ """return typecode of type expected as Output of the internal node"""
return self.tout
+ def getTCForAlgoInit(self):
+ """return typecode of type expected as input for initialize """
+ return self.tAlgoInit
+
+ def getTCForAlgoResult(self):
+ """return typecode of type expected as output of the algorithm """
+ return self.tAlgoResult
+
def initialize(self,input):
- """Optional method called on initialization. Do nothing here"""
+ """Optional method called on initialization.
+ The type of "input" is returned by "getTCForAlgoInit"
+ """
+ print "Algo initialize, input = ", input.getIntValue()
def start(self):
"""Start to fill the pool with samples to evaluate."""
+ print "Algo start "
self.iter=0
- self.pool.pushInSample(4,1.2)
- self.pool.pushInSample(9,3.4)
+ # pushInSample(id, value)
+ self.pool.pushInSample(self.iter, 0.5)
def takeDecision(self):
- """ This method is called each time a sample has been evaluated. It can either add
- new samples to evaluate in the pool, do nothing (wait for more samples), or empty
- the pool to finish the evaluation.
+ """ This method is called each time a sample has been evaluated. It can
+ either add new samples to evaluate in the pool, do nothing (wait for
+ more samples), or empty the pool to finish the evaluation.
"""
currentId=self.pool.getCurrentId()
+ valIn = self.pool.getCurrentInSample().getDoubleValue()
+ valOut = self.pool.getCurrentOutSample().getIntValue()
+ print "Algo takeDecision currentId=%s, valIn=%s, valOut=%s" % (currentId, valIn, valOut)
- if self.iter==1:
- self.pool.pushInSample(16,5.6)
- self.pool.pushInSample(25,7.8)
- self.pool.pushInSample(36,9.)
- self.pool.pushInSample(49,12.3)
- elif self.iter==4:
- self.pool.pushInSample(64,45.6)
- self.pool.pushInSample(81,78.9)
- else:
- val=self.pool.getCurrentInSample()
- if abs(val.getDoubleValue()-45.6) < 1.e-12:
- self.pool.destroyAll()
self.iter=self.iter+1
+ if self.iter < 3:
+ # continue
+ nextSample = valIn + 1
+ self.pool.pushInSample(self.iter, nextSample)
def finish(self):
- """Optional method called when the algorithm has finished, successfully or not, to
- perform any necessary clean up. Do nothing here"""
+ """Optional method called when the algorithm has finished, successfully
+ or not, to perform any necessary clean up."""
+ print "Algo finish"
+ self.pool.destroyAll()
+
+ def getAlgoResult(self):
+ """return the result of the algorithm.
+ The object returned is of type indicated by getTCForAlgoResult.
+ """
+ return 42
+
+
#endif
timer("Starting ");
- RuntimeSALOME::setRuntime();
+ long flags = RuntimeSALOME::UsePython + RuntimeSALOME::UseCorba + RuntimeSALOME::UseXml + \
+ RuntimeSALOME::UseCpp + RuntimeSALOME::UseSalome;
+ RuntimeSALOME::setRuntime(flags, argc, argv);
// Try to load the session catalog if it exists
try
<objref name="file" id="file"/>
<type name="int" kind="int"/>
<sequence name="intvec" content="int"/>
+ <struct name="stringpair">
+ <member name="name" type="string"/>
+ <member name="value" type="string"/>
+ </struct>
+ <sequence name="propvec" content="stringpair"/>
<objref name="pyobj" id="python:obj:1.0"/>
+ <sequence name="seqboolvec" content="boolvec"/>
+ <sequence name="seqdblevec" content="dblevec"/>
+ <sequence name="seqintvec" content="intvec"/>
<sequence name="stringvec" content="string"/>
+ <sequence name="seqstringvec" content="stringvec"/>
<container name="DefaultContainer">
<property name="container_name" value="FactoryServer"/>
<property name="name" value="localhost"/>
</container>
- <optimizer name="OptimizerLoop0" nbranch="4" lib="libTestOptLoop" entry="createOptimizerAlgASyncExample">
- <inline name="PyFunction1">
- <function name="myfunc">
- <code><![CDATA[def myfunc(inValue):
- outValue = int(3*inValue+5)
- print "Received", inValue, ", returning", outValue
- return outValue
-]]></code>
- </function>
- <inport name="inValue" type="double"/>
- <outport name="outValue" type="int"/>
+ <optimizer name="OptimizerLoop1" nbranch="1" lib="libTestOptLoop" entry="createOptimizerAlgASyncExample">
+ <inline name="PyScript7">
+ <script><code><![CDATA[o9 = int(i8)
+print "traitement:", i8
+]]></code></script>
+ <load container="DefaultContainer"/>
+ <inport name="i8" type="double"/>
+ <outport name="o9" type="int"/>
</inline>
</optimizer>
+ <datanode name="DataIn3">
+ <parameter name="o4" type="int">
+ <value><int>5</int></value>
+ </parameter>
+ </datanode>
+ <outnode name="OutNode5">
+ <parameter name="i6" type="int"/>
+ </outnode>
+ <control> <fromnode>OptimizerLoop1</fromnode> <tonode>OutNode5</tonode> </control>
+ <control> <fromnode>DataIn3</fromnode> <tonode>OptimizerLoop1</tonode> </control>
+ <datalink control="false">
+ <fromnode>OptimizerLoop1</fromnode> <fromport>algoResults</fromport>
+ <tonode>OutNode5</tonode> <toport>i6</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>OptimizerLoop1</fromnode> <fromport>evalSamples</fromport>
+ <tonode>OptimizerLoop1.PyScript7</tonode> <toport>i8</toport>
+ </datalink>
<datalink control="false">
- <fromnode>OptimizerLoop0</fromnode> <fromport>evalSamples</fromport>
- <tonode>OptimizerLoop0.PyFunction1</tonode> <toport>inValue</toport>
+ <fromnode>DataIn3</fromnode> <fromport>o4</fromport>
+ <tonode>OptimizerLoop1</tonode> <toport>algoInit</toport>
</datalink>
<datalink control="false">
- <fromnode>OptimizerLoop0.PyFunction1</fromnode> <fromport>outValue</fromport>
- <tonode>OptimizerLoop0</tonode> <toport>evalResults</toport>
+ <fromnode>OptimizerLoop1.PyScript7</fromnode> <fromport>o9</fromport>
+ <tonode>OptimizerLoop1</tonode> <toport>evalResults</toport>
</datalink>
<parameter>
- <tonode>OptimizerLoop0</tonode><toport>nbBranches</toport>
- <value><int>4</int></value>
+ <tonode>OptimizerLoop1</tonode><toport>nbBranches</toport>
+ <value><int>1</int></value>
</parameter>
- <presentation name="OptimizerLoop0" x="6" y="34" width="168" height="178.5" expanded="1" expx="6" expy="34" expWidth="168" expHeight="178.5" shownState="0"/>
- <presentation name="OptimizerLoop0.PyFunction1" x="6" y="111.5" width="158" height="63" expanded="1" expx="6" expy="111.5" expWidth="158" expHeight="63" shownState="0"/>
- <presentation name="__ROOT__" x="0" y="0" width="178" height="216.5" expanded="1" expx="0" expy="0" expWidth="178" expHeight="216.5" shownState="0"/>
+ <presentation name="DataIn3" x="11" y="86" width="158" height="63" expanded="1" expx="11" expy="86" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="OptimizerLoop1" x="238.5" y="83.5" width="204.5" height="216" expanded="1" expx="238.5" expy="83.5" expWidth="204.5" expHeight="216" shownState="0"/>
+ <presentation name="OutNode5" x="488.5" y="84" width="158" height="63" expanded="1" expx="488.5" expy="84" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="OptimizerLoop1.PyScript7" x="42.5" y="149" width="158" height="63" expanded="1" expx="42.5" expy="149" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="__ROOT__" x="0" y="0" width="650.5" height="303.5" expanded="1" expx="0" expy="0" expWidth="650.5" expHeight="303.5" shownState="0"/>
</proc>
<objref name="file" id="file"/>
<type name="int" kind="int"/>
<sequence name="intvec" content="int"/>
+ <struct name="stringpair">
+ <member name="name" type="string"/>
+ <member name="value" type="string"/>
+ </struct>
+ <sequence name="propvec" content="stringpair"/>
<objref name="pyobj" id="python:obj:1.0"/>
+ <sequence name="seqboolvec" content="boolvec"/>
+ <sequence name="seqdblevec" content="dblevec"/>
+ <sequence name="seqintvec" content="intvec"/>
<sequence name="stringvec" content="string"/>
+ <sequence name="seqstringvec" content="stringvec"/>
<container name="DefaultContainer">
<property name="container_name" value="FactoryServer"/>
<property name="name" value="localhost"/>
</container>
- <optimizer name="OptimizerLoop0" nbranch="4" lib="algoasyncexample.py" entry="myalgoasync">
- <inline name="PyFunction0">
- <function name="myfunc">
- <code><![CDATA[def myfunc(inputValue):
- outputValue = int(inputValue*3+5)
- print "Received", inputValue, ", returning", outputValue
- return outputValue
-]]></code>
- </function>
- <inport name="inputValue" type="double"/>
- <outport name="outputValue" type="int"/>
+ <optimizer name="OptimizerLoop1" nbranch="1" lib="algoasyncexample.py" entry="myalgoasync">
+ <inline name="PyScript7">
+ <script><code><![CDATA[o9 = int(i8)
+print "traitement:", i8
+]]></code></script>
+ <load container="DefaultContainer"/>
+ <inport name="i8" type="double"/>
+ <outport name="o9" type="int"/>
</inline>
</optimizer>
+ <datanode name="DataIn3">
+ <parameter name="o4" type="int">
+ <value><int>5</int></value>
+ </parameter>
+ </datanode>
+ <outnode name="OutNode5">
+ <parameter name="i6" type="int"/>
+ </outnode>
+ <control> <fromnode>OptimizerLoop1</fromnode> <tonode>OutNode5</tonode> </control>
+ <control> <fromnode>DataIn3</fromnode> <tonode>OptimizerLoop1</tonode> </control>
+ <datalink control="false">
+ <fromnode>OptimizerLoop1</fromnode> <fromport>algoResults</fromport>
+ <tonode>OutNode5</tonode> <toport>i6</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>OptimizerLoop1</fromnode> <fromport>evalSamples</fromport>
+ <tonode>OptimizerLoop1.PyScript7</tonode> <toport>i8</toport>
+ </datalink>
<datalink control="false">
- <fromnode>OptimizerLoop0</fromnode> <fromport>evalSamples</fromport>
- <tonode>OptimizerLoop0.PyFunction0</tonode> <toport>inputValue</toport>
+ <fromnode>DataIn3</fromnode> <fromport>o4</fromport>
+ <tonode>OptimizerLoop1</tonode> <toport>algoInit</toport>
</datalink>
<datalink control="false">
- <fromnode>OptimizerLoop0.PyFunction0</fromnode> <fromport>outputValue</fromport>
- <tonode>OptimizerLoop0</tonode> <toport>evalResults</toport>
+ <fromnode>OptimizerLoop1.PyScript7</fromnode> <fromport>o9</fromport>
+ <tonode>OptimizerLoop1</tonode> <toport>evalResults</toport>
</datalink>
<parameter>
- <tonode>OptimizerLoop0</tonode><toport>nbBranches</toport>
- <value><int>4</int></value>
+ <tonode>OptimizerLoop1</tonode><toport>nbBranches</toport>
+ <value><int>1</int></value>
</parameter>
- <presentation name="OptimizerLoop0" x="6" y="34" width="167" height="191" expanded="1" expx="6" expy="34" expWidth="167" expHeight="191" shownState="0"/>
- <presentation name="OptimizerLoop0.PyFunction0" x="5" y="124" width="158" height="63" expanded="1" expx="5" expy="124" expWidth="158" expHeight="63" shownState="0"/>
- <presentation name="__ROOT__" x="0" y="0" width="177" height="229" expanded="1" expx="0" expy="0" expWidth="177" expHeight="229" shownState="0"/>
+ <presentation name="DataIn3" x="11" y="86" width="158" height="63" expanded="1" expx="11" expy="86" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="OptimizerLoop1" x="238.5" y="83.5" width="204.5" height="216" expanded="1" expx="238.5" expy="83.5" expWidth="204.5" expHeight="216" shownState="0"/>
+ <presentation name="OutNode5" x="488.5" y="84" width="158" height="63" expanded="1" expx="488.5" expy="84" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="OptimizerLoop1.PyScript7" x="42.5" y="149" width="158" height="63" expanded="1" expx="42.5" expy="149" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="__ROOT__" x="0" y="0" width="650.5" height="303.5" expanded="1" expx="0" expy="0" expWidth="650.5" expHeight="303.5" shownState="0"/>
</proc>
<objref name="file" id="file"/>
<type name="int" kind="int"/>
<sequence name="intvec" content="int"/>
+ <struct name="stringpair">
+ <member name="name" type="string"/>
+ <member name="value" type="string"/>
+ </struct>
+ <sequence name="propvec" content="stringpair"/>
<objref name="pyobj" id="python:obj:1.0"/>
+ <sequence name="seqboolvec" content="boolvec"/>
+ <sequence name="seqdblevec" content="dblevec"/>
+ <sequence name="seqintvec" content="intvec"/>
<sequence name="stringvec" content="string"/>
+ <sequence name="seqstringvec" content="stringvec"/>
<container name="DefaultContainer">
<property name="container_name" value="FactoryServer"/>
<property name="name" value="localhost"/>
</container>
- <optimizer name="OptimizerLoop0" nbranch="4" lib="libTestOptLoop" entry="createOptimizerAlgSyncExample">
- <inline name="PyFunction1">
- <function name="myfunc">
- <code><![CDATA[def myfunc(inValue):
- outValue = int(3*inValue+5)
- print "Received", inValue, ", returning", outValue
- return outValue
-]]></code>
- </function>
- <inport name="inValue" type="double"/>
- <outport name="outValue" type="int"/>
+ <optimizer name="OptimizerLoop1" nbranch="1" lib="libTestOptLoop" entry="createOptimizerAlgSyncExample">
+ <inline name="PyScript7">
+ <script><code><![CDATA[o9 = int(i8)
+print "traitement:", i8
+]]></code></script>
+ <load container="DefaultContainer"/>
+ <inport name="i8" type="double"/>
+ <outport name="o9" type="int"/>
</inline>
</optimizer>
+ <datanode name="DataIn3">
+ <parameter name="o4" type="int">
+ <value><int>5</int></value>
+ </parameter>
+ </datanode>
+ <outnode name="OutNode5">
+ <parameter name="i6" type="int"/>
+ </outnode>
+ <control> <fromnode>OptimizerLoop1</fromnode> <tonode>OutNode5</tonode> </control>
+ <control> <fromnode>DataIn3</fromnode> <tonode>OptimizerLoop1</tonode> </control>
+ <datalink control="false">
+ <fromnode>OptimizerLoop1</fromnode> <fromport>algoResults</fromport>
+ <tonode>OutNode5</tonode> <toport>i6</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>OptimizerLoop1</fromnode> <fromport>evalSamples</fromport>
+ <tonode>OptimizerLoop1.PyScript7</tonode> <toport>i8</toport>
+ </datalink>
<datalink control="false">
- <fromnode>OptimizerLoop0</fromnode> <fromport>evalSamples</fromport>
- <tonode>OptimizerLoop0.PyFunction1</tonode> <toport>inValue</toport>
+ <fromnode>DataIn3</fromnode> <fromport>o4</fromport>
+ <tonode>OptimizerLoop1</tonode> <toport>algoInit</toport>
</datalink>
<datalink control="false">
- <fromnode>OptimizerLoop0.PyFunction1</fromnode> <fromport>outValue</fromport>
- <tonode>OptimizerLoop0</tonode> <toport>evalResults</toport>
+ <fromnode>OptimizerLoop1.PyScript7</fromnode> <fromport>o9</fromport>
+ <tonode>OptimizerLoop1</tonode> <toport>evalResults</toport>
</datalink>
<parameter>
- <tonode>OptimizerLoop0</tonode><toport>nbBranches</toport>
- <value><int>4</int></value>
+ <tonode>OptimizerLoop1</tonode><toport>nbBranches</toport>
+ <value><int>1</int></value>
</parameter>
- <presentation name="OptimizerLoop0" x="6" y="34" width="169" height="187.5" expanded="1" expx="6" expy="34" expWidth="169" expHeight="187.5" shownState="0"/>
- <presentation name="OptimizerLoop0.PyFunction1" x="7" y="120.5" width="158" height="63" expanded="1" expx="7" expy="120.5" expWidth="158" expHeight="63" shownState="0"/>
- <presentation name="__ROOT__" x="0" y="0" width="179" height="225.5" expanded="1" expx="0" expy="0" expWidth="179" expHeight="225.5" shownState="0"/>
+ <presentation name="DataIn3" x="11" y="86" width="158" height="63" expanded="1" expx="11" expy="86" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="OptimizerLoop1" x="238.5" y="83.5" width="204.5" height="216" expanded="1" expx="238.5" expy="83.5" expWidth="204.5" expHeight="216" shownState="0"/>
+ <presentation name="OutNode5" x="488.5" y="84" width="158" height="63" expanded="1" expx="488.5" expy="84" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="OptimizerLoop1.PyScript7" x="42.5" y="149" width="158" height="63" expanded="1" expx="42.5" expy="149" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="__ROOT__" x="0" y="0" width="650.5" height="303.5" expanded="1" expx="0" expy="0" expWidth="650.5" expHeight="303.5" shownState="0"/>
</proc>
<objref name="file" id="file"/>
<type name="int" kind="int"/>
<sequence name="intvec" content="int"/>
+ <struct name="stringpair">
+ <member name="name" type="string"/>
+ <member name="value" type="string"/>
+ </struct>
+ <sequence name="propvec" content="stringpair"/>
<objref name="pyobj" id="python:obj:1.0"/>
+ <sequence name="seqboolvec" content="boolvec"/>
+ <sequence name="seqdblevec" content="dblevec"/>
+ <sequence name="seqintvec" content="intvec"/>
<sequence name="stringvec" content="string"/>
+ <sequence name="seqstringvec" content="stringvec"/>
<container name="DefaultContainer">
<property name="container_name" value="FactoryServer"/>
<property name="name" value="localhost"/>
</container>
- <optimizer name="OptimizerLoop0" nbranch="4" lib="algosyncexample.py" entry="myalgosync">
- <inline name="PyFunction0">
- <function name="myfunc">
- <code><![CDATA[def myfunc(inputValue):
- outputValue = int(inputValue*3+5)
- print "Received", inputValue, ", returning", outputValue
- return outputValue
-]]></code>
- </function>
- <inport name="inputValue" type="double"/>
- <outport name="outputValue" type="int"/>
+ <optimizer name="OptimizerLoop1" nbranch="1" lib="algosyncexample.py" entry="myalgosync">
+ <inline name="PyScript7">
+ <script><code><![CDATA[o9 = int(i8)
+print "traitement:", i8
+]]></code></script>
+ <load container="DefaultContainer"/>
+ <inport name="i8" type="double"/>
+ <outport name="o9" type="int"/>
</inline>
</optimizer>
+ <datanode name="DataIn3">
+ <parameter name="o4" type="int">
+ <value><int>5</int></value>
+ </parameter>
+ </datanode>
+ <outnode name="OutNode5">
+ <parameter name="i6" type="int"/>
+ </outnode>
+ <control> <fromnode>OptimizerLoop1</fromnode> <tonode>OutNode5</tonode> </control>
+ <control> <fromnode>DataIn3</fromnode> <tonode>OptimizerLoop1</tonode> </control>
+ <datalink control="false">
+ <fromnode>OptimizerLoop1</fromnode> <fromport>algoResults</fromport>
+ <tonode>OutNode5</tonode> <toport>i6</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>OptimizerLoop1</fromnode> <fromport>evalSamples</fromport>
+ <tonode>OptimizerLoop1.PyScript7</tonode> <toport>i8</toport>
+ </datalink>
<datalink control="false">
- <fromnode>OptimizerLoop0</fromnode> <fromport>evalSamples</fromport>
- <tonode>OptimizerLoop0.PyFunction0</tonode> <toport>inputValue</toport>
+ <fromnode>DataIn3</fromnode> <fromport>o4</fromport>
+ <tonode>OptimizerLoop1</tonode> <toport>algoInit</toport>
</datalink>
<datalink control="false">
- <fromnode>OptimizerLoop0.PyFunction0</fromnode> <fromport>outputValue</fromport>
- <tonode>OptimizerLoop0</tonode> <toport>evalResults</toport>
+ <fromnode>OptimizerLoop1.PyScript7</fromnode> <fromport>o9</fromport>
+ <tonode>OptimizerLoop1</tonode> <toport>evalResults</toport>
</datalink>
<parameter>
- <tonode>OptimizerLoop0</tonode><toport>nbBranches</toport>
- <value><int>4</int></value>
+ <tonode>OptimizerLoop1</tonode><toport>nbBranches</toport>
+ <value><int>1</int></value>
</parameter>
- <presentation name="OptimizerLoop0.PyFunction0" x="6" y="111.5" width="158" height="63" expanded="1" expx="6" expy="111.5" expWidth="158" expHeight="63" shownState="0"/>
- <presentation name="OptimizerLoop0" x="6" y="34" width="168" height="178.5" expanded="1" expx="6" expy="34" expWidth="168" expHeight="178.5" shownState="0"/>
- <presentation name="__ROOT__" x="0" y="0" width="178" height="216.5" expanded="1" expx="0" expy="0" expWidth="178" expHeight="216.5" shownState="0"/>
+ <presentation name="DataIn3" x="11" y="86" width="158" height="63" expanded="1" expx="11" expy="86" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="OptimizerLoop1" x="238.5" y="83.5" width="204.5" height="216" expanded="1" expx="238.5" expy="83.5" expWidth="204.5" expHeight="216" shownState="0"/>
+ <presentation name="OutNode5" x="488.5" y="84" width="158" height="63" expanded="1" expx="488.5" expy="84" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="OptimizerLoop1.PyScript7" x="42.5" y="149" width="158" height="63" expanded="1" expx="42.5" expy="149" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="__ROOT__" x="0" y="0" width="650.5" height="303.5" expanded="1" expx="0" expy="0" expWidth="650.5" expHeight="303.5" shownState="0"/>
</proc>