23 #include "Calcium_Ports.hh"
37 Port(node),_depend(
"TIME_DEPENDENCY"),_schema(
"TI_SCHEM"),_delta(-1.),_level(-1),_alpha(0.),
38 _interp(
"L1_SCHEM"),_extrap(
"UNDEFINED_EXTRA_SCHEM")
44 Port(other,newHelder),_depend(other._depend),_schema(other._schema),_delta(other._delta),_level(other._level),
45 _alpha(other._alpha),_interp(other._interp),_extrap(other._extrap)
58 throw Exception(
"Can not modify DependencyType property on a connected port");
60 if(depend !=
"TIME_DEPENDENCY" && depend !=
"ITERATION_DEPENDENCY")
62 throw Exception(
"DependencyType property must be TIME_DEPENDENCY or ITERATION_DEPENDENCY");
69 if(schema !=
"TI_SCHEM" && schema !=
"TF_SCHEM" && schema !=
"ALPHA_SCHEM")
71 throw Exception(
"DateCalSchem property must be TI_SCHEM, TF_SCHEM or ALPHA_SCHEM");
77 DEBTRACE(
"InputCalStreamPort::setLevel: " << value);
78 std::istringstream iss(value);
80 if (!(iss >> temp)|| temp<1)
81 throw Exception(
"StorageLevel property must be an integer > 0");
86 std::istringstream iss(value);
88 if (!(iss >> temp)||temp<0. || temp >1.)
89 throw Exception(
"Alpha property must be a float > 0 and < 1");
94 std::istringstream iss(value);
96 if (!(iss >> temp)||temp<0. || temp >1.)
97 throw Exception(
"DeltaT property must be > 0 and < 1");
102 if(value !=
"L0_SCHEM" && value !=
"L1_SCHEM")
104 throw Exception(
"InterpolationSchem property must be L0_SCHEM or L1_SCHEM");
110 if(value !=
"E0_SCHEM" && value !=
"E1_SCHEM")
112 throw Exception(
"ExtrapolationSchem property must be E0_SCHEM or E1_SCHEM");
119 DEBTRACE(
"InputCalStreamPort::setProperty: " << name <<
" " << value);
120 if(name ==
"DependencyType")
122 else if(name ==
"DateCalSchem")
124 else if(name ==
"StorageLevel")
126 else if(name ==
"Alpha")
128 else if(name ==
"DeltaT")
130 else if(name ==
"InterpolationSchem")
132 else if(name ==
"ExtrapolationSchem")
142 Engines::Superv_Component_var compo=Engines::Superv_Component::_narrow(objComponent);
143 Ports::PortProperties_var port_properties=compo->get_port_properties(
getName().c_str());
153 port_properties->set_property(prop.c_str(),
a);
160 a <<= Ports::Calcium_Ports::TF_SCHEM;
161 else if(
_schema ==
"ALPHA_SCHEM")
162 a <<= Ports::Calcium_Ports::ALPHA_SCHEM;
163 port_properties->set_property(prop.c_str(),
a);
170 port_properties->set_property(prop.c_str(),
a);
177 port_properties->set_property(prop.c_str(),
a);
181 prop=
"InterpolationSchem";
182 a <<= Ports::Calcium_Ports::L0_SCHEM;
183 port_properties->set_property(prop.c_str(),
a);
185 if(
_extrap !=
"UNDEFINED_EXTRA_SCHEM" )
187 prop=
"ExtrapolationSchem";
189 a <<= Ports::Calcium_Ports::E0_SCHEM;
190 else if(
_extrap ==
"E1_SCHEM" )
191 a <<= Ports::Calcium_Ports::E1_SCHEM;
192 port_properties->set_property(prop.c_str(),
a);
195 catch(Ports::NotDefined&
ex)
217 Port(node),_depend(
"TIME_DEPENDENCY"),_schema(
"TI_SCHEM"),_level(-1)
224 Port(other,newHelder),
225 _depend(other._depend),_schema(other._schema),_level(other._level)
238 throw Exception(
"Can not modify DependencyType property on a connected port");
240 if(depend !=
"TIME_DEPENDENCY" && depend !=
"ITERATION_DEPENDENCY")
242 throw Exception(
"DependencyType property must be TIME_DEPENDENCY or ITERATION_DEPENDENCY");
249 if(schema !=
"TI_SCHEM" && schema !=
"TF_SCHEM" && schema !=
"ALPHA_SCHEM")
251 throw Exception(
"DateCalSchem property must be TI_SCHEM, TF_SCHEM or ALPHA_SCHEM");
257 _level =atoi(level.c_str());
262 if(name ==
"DependencyType")
264 else if(name ==
"DateCalSchem")
266 else if(name ==
"StorageLevel")
286 string what=
"not compatible type of port requested during building of link FROM ";
294 std::string what=
"incompatible DependencyType properties: "+
_depend+
" != "+ port->
getDepend();
305 DEBTRACE(
"OutputCalStreamPort::removeInPort");
308 string what=
"not compatible type of port requested during destruction of for link FROM ";
std::string getNameOfTypeOfCurrentInstance() const
std::string getName() const
virtual void initPortProperties()
Initialize port properties at the start of calculation phase.
virtual void setProperty(const std::string &name, const std::string &value)
Set a new value for a property of the port.
virtual int edGetNumberOfLinks() const
Returns number of physical backlinks NOT number of user backlinks.
Base class for all nodes.
virtual int edGetNumberOfOutLinks() const
Class for Output Calcium DataStream Ports.
void setSchema(const std::string &schema)
virtual int removeInPort(InPort *inPort, bool forward)
std::string getNameOfTypeOfCurrentInstance() const
void setProperty(const std::string &name, const std::string &value)
Set a new value for a property of the port.
void setDepend(const std::string &depend)
virtual bool addInPort(InPort *inPort)
OutputCalStreamPort(const std::string &name, Node *node, TypeCode *type)
void setLevel(const std::string &schema)
virtual ~OutputCalStreamPort()
OutputCalStreamPort * clone(Node *newHelder) const
int edRemoveInputDataStreamPort(InputDataStreamPort *inPort, bool forward)
virtual bool edAddInputDataStreamPort(InputDataStreamPort *port)
Base class for all ports.
Class for Salome component instance.
Class for Salome component Service Node.
Base class for all type objects.