-// Copyright (C) 2006-2014 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2016 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "InlineNode.hxx"
#include "Visitor.hxx"
#include "Container.hxx"
+#include "HomogeneousPoolContainer.hxx"
#include <iostream>
#define _DEVDEBUG_
using namespace YACS::ENGINE;
using namespace std;
+const char InlineNode::LOCAL_STR[]="local";
+
+const char InlineNode::REMOTE_STR[]="remote";
InlineNode::~InlineNode()
{
void InlineNode::setExecutionMode(const std::string& mode)
{
if(mode == _mode)return;
- if(mode == "local"||mode == "remote")
+ if(mode == LOCAL_STR || mode == REMOTE_STR)
{
_mode=mode;
modified();
_container=otherC._container->clone();
}
+void InlineNode::performShallowDuplicationOfPlacement(const Node& other)
+{
+ const InlineNode &otherC=*(dynamic_cast<const InlineNode *>(&other));
+ //if other has no container don't clone: this will not have one
+ if(otherC._container)
+ {
+ _container=otherC._container;
+ _container->incrRef();
+ }
+}
+
bool InlineNode::isDeployable() const
{
- if(_mode=="remote")
+ if(_mode==REMOTE_STR)
return true;
else
return false;
}
+int InlineNode::getMaxLevelOfParallelism() const
+{
+ if(!isDeployable())
+ return 1;
+ if(!_container)
+ return 1;
+ std::map<std::string,std::string> props(_container->getProperties());
+ std::map<std::string,std::string>::iterator it(props.find(std::string("nb_proc_per_node")));
+ if(it==props.end())
+ return 1;
+ if((*it).second.empty())
+ return 1;
+ std::istringstream iss((*it).second);
+ int ret(1); iss >> ret;
+ return ret;
+}
+
+void InlineNode::partitionRegardingDPL(const PartDefinition *pd, std::map<ComposedNode *, YACS::BASES::AutoRefCnt<PartDefinition> >& zeMap)
+{
+ if(!isDeployable())
+ return ;
+ if(!_container)
+ return ;
+ HomogeneousPoolContainer *contC(dynamic_cast<HomogeneousPoolContainer *>(_container));
+ if(!contC)
+ return ;
+ YACS::BASES::AutoConstRefCnt<PartDefinition> zePd;
+ zePd.takeRef(pd);
+ YACS::BASES::AutoRefCnt<HomogeneousPoolContainer> zeCont(contC->decorate(zePd));
+ setContainer(zeCont);
+}