38 #include <Epetra_Vector.h> 39 #include <lifev/zero_dimensional/solver/ZeroDimensionalCircuitData.hpp> 49 std::cout <<
"Id = " << id();
50 std::cout <<
"\t type = ";
81 output =
"voltageSource";
86 output =
"currentSource";
99 M_nodeIndex.reserve ( 2 );
105 std::cout <<
"\t Node1= " << nodeIndex ( 0 ) <<
"\t Node2= " << nodeIndex ( 1 );
110 Int Index = M_nodeIndex.at ( 0 );
113 theNode->setElementListIndex ( M_id );
114 Int otherEndIndex = M_nodeIndex.at ( 1 );
115 theNode->setNodeListIndex ( otherEndIndex );
117 Index = M_nodeIndex.at ( 1 );
118 theNode = Nodes->nodeListAt ( Index );
120 theNode->setElementListIndex ( M_id );
121 otherEndIndex = M_nodeIndex.at ( 0 );
122 theNode->setNodeListIndex ( otherEndIndex );
127 if ( M_nodeIndex.at ( 0 ) == nodeId )
147 std::cout <<
"\t parameter = " << parameter() << std::endl;
155 for (
Int i = 0; i < 2; i++ )
157 const Int& theNodeCounter = ( i ) % 2;
158 const Int& theOtherNodeCounter = ( i + 1 ) % 2;
159 const ZeroDimensionalNode& theNodeTest = * ( Nodes->nodeListAt ( M_nodeIndex[theNodeCounter] ) );
160 const ZeroDimensionalNode& theOtherNodeTest = * ( Nodes->nodeListAt ( M_nodeIndex[theOtherNodeCounter] ) );
165 B.addToCoefficient ( equationRow,
166 theNode.variableIndex(),
171 B.addToCoefficient ( equationRow,
172 theOtherNode.variableIndex(),
187 M_current = ( Nodes.nodeListAt ( M_nodeIndex.at ( 0 ) )->voltage() - Nodes.nodeListAt ( M_nodeIndex.at ( 1 ) )->voltage() ) * M_parameter;
188 M_deltaCurrent = ( Nodes.nodeListAt ( M_nodeIndex.at ( 0 ) )->deltaVoltage() - Nodes.nodeListAt ( M_nodeIndex.at ( 1 ) )->deltaVoltage() )
203 std::cout <<
"\t FB = " << forwardBias() <<
"\t alpha = " << alpha() <<
"\t beta = " << beta() << std::endl;
222 Real deltaVoltage = ( Nodes.nodeListAt ( M_nodeIndex.at ( 0 ) )->voltage() - Nodes.nodeListAt ( M_nodeIndex.at ( 1 ) )->voltage() );
225 M_deltaCurrent = ( Nodes.nodeListAt ( M_nodeIndex.at ( 0 ) )->deltaVoltage() - Nodes.nodeListAt ( M_nodeIndex.at ( 1 ) )->deltaVoltage() )
235 const Int& theNodeCounter = 0;
236 const Int& theOtherNodeCounter = 1;
237 const ZeroDimensionalNode& theNodeTest = * ( Nodes->nodeListAt ( M_nodeIndex[theNodeCounter] ) );
238 const ZeroDimensionalNode& theOtherNodeTest = * ( Nodes->nodeListAt ( M_nodeIndex[theOtherNodeCounter] ) );
255 std::cout <<
"\t parameter = " << parameter() << std::endl;
260 M_current = ( Nodes.nodeListAt ( M_nodeIndex.at ( 0 ) )->deltaVoltage() - Nodes.nodeListAt ( M_nodeIndex.at ( 1 ) )->deltaVoltage() ) * M_parameter;
268 for (
Int i = 0; i < 2; i++ )
270 const Int& theNodeCounter = ( i ) % 2;
271 const Int& theOtherNodeCounter = ( i + 1 ) % 2;
272 const ZeroDimensionalNode& theNodeTest = * ( Nodes->nodeListAt ( M_nodeIndex[theNodeCounter] ) );
273 const ZeroDimensionalNode& theOtherNodeTest = * ( Nodes->nodeListAt ( M_nodeIndex[theOtherNodeCounter] ) );
278 A.addToCoefficient ( equationRow,
279 theNode.variableIndex(),
284 A.addToCoefficient ( equationRow,
285 theOtherNode.variableIndex(),
310 std::cout <<
"\t parameter = " << parameter() << std::endl;
314 std::cout <<
"\t EquationRow= " << M_equationRow <<
"\t VariableIndex= " << M_variableIndex;
329 for (
Int i = 0; i < 2; i++ )
331 const Int& theNodeCounter = ( i ) % 2;
332 const ZeroDimensionalNode& theNodeTest = * ( Nodes->nodeListAt ( M_nodeIndex[theNodeCounter] ) );
337 B.addToCoefficient ( equationRow,
339 direction ( theNode.id() ) );
343 A.addToCoefficient ( M_equationRow,
348 const Int& theNodeCounter = ( i ) % 2;
349 const Int& theOtherNodeCounter = ( i + 1 ) % 2;
350 const ZeroDimensionalNode& theNodeTest = * ( Nodes->nodeListAt ( M_nodeIndex[theNodeCounter] ) );
351 const ZeroDimensionalNode& theOtherNodeTest = * ( Nodes->nodeListAt ( M_nodeIndex[theOtherNodeCounter] ) );
355 B.addToCoefficient ( M_equationRow,
356 theNode.variableIndex(),
368 B.addToCoefficient ( M_equationRow,
369 theOtherNode.variableIndex(),
393 std::cout <<
"\t Node1= " << nodeIndex() << std::endl;
409 theNode->setElementListIndex ( M_id );
410 Int otherEndIndex = -1;
411 theNode->setNodeListIndex ( otherEndIndex );
419 Int length = indexList.size();
420 for (
Int i = 0; i < length; ++i )
443 theNode->setElementListIndex ( M_id );
444 Int otherEndIndex = -1;
445 theNode->setNodeListIndex ( otherEndIndex );
462 std::cerr <<
"Error at ZeroDimensionalElementCurrentSource::buildABC, source connected to voltage";
477 std::cout <<
"Id = " << id();
478 std::cout <<
"\t type = ";
479 std::cout << enum2string ( type() ) <<
"\t";
482 for ( UInt i = 0; i < M_elementListIndex.size(); i++ )
484 std::cout <<
"{" << M_elementListIndex.at ( i ) <<
"," << M_nodeListIndex.at ( i ) <<
"} ";
486 std::cout << std::endl;
497 output =
"knownNode";
502 output =
"unknownNode";
512 Real currentBalance = 0.0;
513 Int length = M_elementListIndex.size();
514 for (
Int i = 0; i < length; ++i )
542 std::cout <<
"\t EquationRow= " << M_equationRow <<
"\t VariableIndex= " << M_variableIndex;
574 std::cout <<
"=============== Show all ZeroDimensional Elements ===========" << std::endl;
575 for ( iterZeroDimensionalElement_Type theElement = M_elementList->begin(); theElement != M_elementList->end(); theElement++ )
577 ( *theElement )->showMe ( flag );
593 std::cout <<
"=============== Show all ZeroDimensional Nodes ===========" << std::endl;
594 for ( iterZeroDimensionalNode_Type theNode = M_nodeList->begin(); theNode != M_nodeList->end(); theNode++ )
596 ( *theNode )->showMe ( flag );
611 M_Elements->showMe ( flag );
612 M_Nodes->showMe ( flag );
627 stringstream stringStreamLine1 ( stringstream::in | stringstream::out );
628 stringstream stringStreamLine2 ( stringstream::in | stringstream::out );
631 Int numberOfNodes = 0;
632 Int numberOfElements = 0;
633 Int numberOfTerminalNodes = 0;
637 Real parameter1 = 0.0;
638 Real forwardBias = 0.0;
643 std::vector< ZeroDimensionalNodeType > nodesType;
647 infile.open ( fileName,
649 if ( infile.is_open() )
652 getline ( infile, stringline1 );
653 stringStreamLine1 << stringline1;
654 stringStreamLine1 >> stringtmp;
655 numberOfElements = std::atoi ( stringtmp.c_str() );
656 stringStreamLine1 >> stringtmp;
657 numberOfNodes = std::atoi ( stringtmp.c_str() );
658 stringStreamLine1 >> stringtmp;
659 numberOfTerminalNodes = std::atoi ( stringtmp.c_str() );
660 getline ( infile, stringline2 );
664 stringStreamLine2 << stringline2;
665 for (
Int i = 0; i < numberOfTerminalNodes; i++ )
667 stringStreamLine2 >> stringtmp;
668 nodeId = std::atoi ( stringtmp.c_str() );
669 terminalNodes.push_back ( nodeId );
672 for (
Int i = 0; i < numberOfNodes; i++ )
674 nodesType.push_back ( unknownNode );
675 nodesConnectingSource.push_back ( -1 );
678 for (
Int i = 0; i < numberOfElements; i++ )
680 stringstream stringStreamLine3 ( stringstream::in | stringstream::out );
681 getline ( infile, stringline3 );
682 stringStreamLine3 << stringline3;
683 stringStreamLine3 >> stringtmp;
684 ID = std::atoi ( stringtmp.c_str() );
685 stringStreamLine3 >> stringtmp;
686 boolElementType[0] = stringtmp.compare (
"resistor" );
687 boolElementType[1] = stringtmp.compare (
"capacitor" );
688 boolElementType[2] = stringtmp.compare (
"inductor" );
689 boolElementType[3] = stringtmp.compare (
"voltageSource" );
690 boolElementType[4] = stringtmp.compare (
"currentSource" );
691 boolElementType[5] = stringtmp.compare (
"diode" );
693 stringStreamLine3 >> stringtmp;
694 Node1 = std::atoi ( stringtmp.c_str() );
696 if ( !boolElementType[0] )
698 stringStreamLine3 >> stringtmp;
699 Node2 = std::atoi ( stringtmp.c_str() );
700 stringStreamLine3 >> stringtmp;
701 parameter1 = std::atof ( stringtmp.c_str() );
704 if ( !boolElementType[1] )
706 stringStreamLine3 >> stringtmp;
707 Node2 = std::atoi ( stringtmp.c_str() );
708 stringStreamLine3 >> stringtmp;
709 parameter1 = std::atof ( stringtmp.c_str() );
712 if ( !boolElementType[2] )
714 stringStreamLine3 >> stringtmp;
715 Node2 = std::atoi ( stringtmp.c_str() );
716 stringStreamLine3 >> stringtmp;
717 parameter1 = std::atof ( stringtmp.c_str() );
720 if ( !boolElementType[5] )
722 stringStreamLine3 >> stringtmp;
723 Node2 = std::atoi ( stringtmp.c_str() );
724 stringStreamLine3 >> stringtmp;
725 forwardBias = std::atof ( stringtmp.c_str() );
726 stringStreamLine3 >> stringtmp;
727 alpha = std::atof ( stringtmp.c_str() );
728 stringStreamLine3 >> stringtmp;
729 beta = std::atof ( stringtmp.c_str() );
737 cerr <<
"Error opening circuit file";
741 for ( iterVecInt_Type theNodeId = terminalNodes.begin(); theNodeId != terminalNodes.end(); theNodeId++ )
744 switch ( bc->bc ( *theNodeId ).bcType() )
747 nodesConnectingSource.at ( *theNodeId ) = createElementVoltageSource ( *theNodeId );
748 nodesType.at ( *theNodeId ) = knownNode;
751 createElementCurrentSource ( *theNodeId );
758 for (
Int i = 0; i < numberOfNodes; i++ )
760 if ( nodesType.at ( i ) == knownNode )
763 createKnownNode ( i, M_Elements->voltageSourceMap ( nodesConnectingSource.at ( i ) ) );
771 for ( Int i = 0; i < M_Elements->elementCounter(); i++ )
773 M_Elements->elementListAt ( i )->connectElement ( M_Nodes );
785 theElement->setId ( ID );
786 if ( M_Elements->elementCounter() != ID )
788 std::cerr <<
"Error: Element Id error at " << ID;
791 theElement->setNodeIndex ( node1 );
792 theElement->setNodeIndex ( node2 );
793 if ( parameter <= 0 )
795 std::cerr <<
"Error: Resistance value <=0, ID = " << ID;
798 theElement->setParameter ( 1.0 / parameter );
799 M_Elements->setelementList ( theElement );
800 M_Elements->setResistorList ( theElement );
808 theElement->setId ( ID );
809 if ( M_Elements->elementCounter() != ID )
811 std::cerr <<
"Error: Element Id error at " << ID;
814 theElement->setNodeIndex ( node1 );
815 theElement->setNodeIndex ( node2 );
816 theElement->setParameter ( parameter );
817 M_Elements->setelementList ( theElement );
818 M_Elements->setCapacitorList ( theElement );
826 theElement->setId ( ID );
828 if ( M_Elements->elementCounter() != ID )
830 std::cerr <<
"Error: Element Id error at " << ID;
833 theElement->setNodeIndex ( node1 );
834 theElement->setNodeIndex ( node2 );
835 theElement->setParameter ( 1.0 / parameter );
836 M_Elements->setelementList ( theElement );
837 M_Elements->setInductorList ( theElement );
847 theElement->setId ( ID );
848 if ( M_Elements->elementCounter() != ID )
850 std::cerr <<
"Error: Element Id error at " << ID;
853 theElement->setNodeIndex ( node1 );
854 theElement->setNodeIndex ( node2 );
855 theElement->setParameter ( 0 );
856 theElement->setforwardBias ( forwardBias );
857 theElement->setalpha ( alpha );
858 theElement->setbeta ( beta );
859 M_Elements->setelementList ( theElement );
860 M_Elements->setDiodeList ( theElement );
866 theElement->setId ( M_Elements->elementCounter() );
867 theElement->setNodeIndex ( node1 );
868 M_Elements->setelementList ( theElement );
869 M_Elements->setVoltageSourceList ( theElement );
870 M_Elements->setVoltageSourceMap ( theElement->id(), theElement );
871 return theElement->id();
876 theElement->setId ( M_Elements->elementCounter() );
877 theElement->setNodeIndex ( node1 );
878 M_Elements->setelementList ( theElement );
879 M_Elements->setCurrentSourceList ( theElement );
885 theNode->setId ( id );
886 M_Nodes->setnodeList ( theNode );
887 M_Nodes->setunknownNodeList ( theNode );
888 M_Nodes->setunknownNodeMap ( theNode->id(), theNode );
895 theNode->setId ( id );
896 M_Nodes->setnodeList ( theNode );
897 M_Nodes->setknownNodeList ( theNode );
898 M_Nodes->setknownNodeMap ( theNode->id(), theNode );
904 theNode->setId ( id );
905 M_Nodes->setnodeList ( theNode );
906 M_Nodes->setknownNodeList ( theNode );
907 M_Nodes->setknownNodeMap ( theNode->id(), theNode );
916 for ( iterZeroDimensionalElementCurrentSource_Type theElement = currentElementList->begin(); theElement != currentElementList->end(); theElement++ )
918 ( *theElement )->setBC ( bc );
921 for ( iterZeroDimensionalElementVoltageSourcePtr_Type theElement = voltageElementList->begin(); theElement != voltageElementList->end(); theElement++ )
923 ( *theElement )->setBC ( bc );
928 const Epetra_Vector* x,
929 const Epetra_Vector* x_dot )
934 for ( iterZeroDimensionalNodeUnknown_Type theNode = unknownNodeList ->begin(); theNode != unknownNodeList->end(); theNode++ )
936 const Int& variableIndex = ( *theNode )->variableIndex();
937 ( *theNode )->setVoltage ( (*x) [variableIndex] );
938 ( *theNode )->setDeltaVoltage ( ( *x_dot ) [variableIndex] );
943 for ( iterZeroDimensionalElementPassiveInductor_Type theInductor = inductorList ->begin(); theInductor != inductorList->end(); theInductor++ )
945 const Int& variableIndex = ( *theInductor )->variableIndex();
946 ( *theInductor )->setCurrent ( ( *x ) [variableIndex] );
947 ( *theInductor )->setDeltaCurrent ( ( *x_dot ) [variableIndex] );
952 for ( iterZeroDimensionalNodeKnown_Type theNode = knownNodeList ->begin(); theNode != knownNodeList->end(); theNode++ )
954 ( *theNode )->setVoltageByTime ( t );
955 ( *theNode )->setDeltaVoltageByTime ( t );
958 for ( iterZeroDimensionalElementCurrentSource_Type theElement = currentElementList ->begin(); theElement != currentElementList->end(); theElement++ )
960 ( *theElement )->setCurrentByTime ( t );
964 const Epetra_Vector& y,
965 const Epetra_Vector& yp )
968 updateCircuitDataFromY ( t, &y, &yp );
972 for ( iterZeroDimensionalElement_Type theElement = elementList ->begin(); theElement != elementList->end(); theElement++ )
974 ( *theElement )->extractSolution ( *M_Nodes );
979 for ( iterZeroDimensionalElementVoltageSourcePtr_Type theElement = voltageList ->begin(); theElement != voltageList->end(); theElement++ )
981 ( *theElement )->calculateCurrent ( *M_Nodes,
987 for ( iterZeroDimensionalNode_Type theNode = nodeList ->begin(); theNode != nodeList->end(); theNode++ )
989 ( *theNode )->calculateCurrentBalance ( *M_Elements );
999 A.matrixPtr()->PutScalar ( 0.0 );
1000 B.matrixPtr()->PutScalar ( 0.0 );
1001 C.epetraVector().PutScalar ( 0.0 );
1006 for ( iterZeroDimensionalElement_Type theElement = elementList ->begin(); theElement != elementList->end(); theElement++ )
1009 ( *theElement )->buildABC ( A, B, C, M_Nodes );
1017 std::string precision,
1018 std::string whiteSpace,
1025 M_formatDouble =
"% " + M_width +
"." + M_precision +
"f";
1026 M_formatInteger =
"% " + M_width +
"d";
1027 M_formatString =
"% " + M_width +
"s";
1030 std::ofstream& stream,
1034 M_formatDouble.data(),
1040 stream << std::endl;
1048 std::cerr <<
"no flag at OutPutFormat::writeDataFormat";
1053 std::ofstream& stream,
1057 UInt integerWidth (atoi (M_width.c_str() ) );
1059 std::ostringstream numberToWrite;
1060 numberToWrite << number;
1062 UInt integerWidthToUse (integerWidth);
1063 integerWidthToUse -= numberToWrite.str().size();
1065 std::ostringstream nodeStringWidth;
1066 nodeStringWidth << integerWidthToUse;
1068 std::string formatNodeString (
"% " + nodeStringWidth.str() +
"s");
1071 formatNodeString.data(),
1074 stream << M_buffer << number;
1078 stream << std::endl;
1086 std::cerr <<
"no flag at OutPutFormat::writeDataFormat";
1092 std::ofstream& stream,
1096 M_formatString.data(),
1102 stream << std::endl;
1110 std::cerr <<
"no flag at OutPutFormat::writeDataFormat";
1117 stream << std::endl;
void connectElement(zeroDimensionalNodeSPtr_Type &Nodes)
Connect elements to the nodes.
void fixBC(bcPtr_Type bc)
void showMe(const Int &flag=0)
ZeroDimensionalElementPassiveInductor - Inductor.
ZeroDimensionalNodeKnown(const zeroDimensionalElementVoltageSourcePtr_Type &theElement)
Contructor.
void extractSolution(const ZeroDimensionalNodeS &nodes)
Compute outputs (currents and voltages) from the solution vector after each succesful iteration...
void buildABC(matrix_Type &A, matrix_Type &B, vector_Type &C, const zeroDimensionalNodeSPtr_Type &Nodes)
Contribution of the element of matrix {A} and {B} and vector {C}.
void showMe(const Int &flag=0)
void createElementCapacitor(Int ID, Int node1, Int node2, Real parameter)
virtual const Real & voltage() const
virtual void showMe(const Int &flag=0)
ZeroDimensionalElementCurrentSource()
Constructor.
ZeroDimensionalElementPassiveDiode()
Constructor.
ZerodimentionalElementPassiveCapacitor - Capacitor.
ZeroDimensionalElementPassive - A class for passive elements.
std::shared_ptr< ZeroDimensionalNodeKnown > zeroDimensionalNodeKnownPtr_Type
void createElementCurrentSource(Int node1)
std::vector< Int > vecInt_Type
std::shared_ptr< vecZeroDimensionalElementCurrentSourcePtr_Type > ptrVecZeroDimensionalElementCurrentSourcePtr_Type
vecInt_Type M_elementListIndex
void buildABC(matrix_Type &A, matrix_Type &B, vector_Type &C, const zeroDimensionalNodeSPtr_Type &Nodes)
Contribution of the element of matrix {A} and {B} and vector {C}.
std::shared_ptr< ZeroDimensionalNodeS > zeroDimensionalNodeSPtr_Type
ZeroDimensionalCircuitData - Container of circuit data.
void connectElement(zeroDimensionalNodeSPtr_Type &nodes)
Impleaments the abstarct class for passive elements.
ZeroDimensionalNodeKnown()
Contructor.
const Int & equationRow() const
void createKnownNode(const Int &id, const zeroDimensionalElementVoltageSourcePtr_Type &theElement)
void calculateCurrentBalance(const ZeroDimensionalElementS &Elements)
Calculate current balance at node.
ZerodimentionalElementPassiveDiode - Diode.
ZeroDimensionalNode()
Constructor.
std::shared_ptr< vecZeroDimensionalNodeKnownPtr_Type > ptrVecZeroDimensionalNodeKnownPtr_Type
std::shared_ptr< ZeroDimensionalElementPassiveDiode > zeroDimensionalElementPassiveDiodePtr_Type
Int createElementVoltageSource(Int node1)
void showMe(const Int &flag=0)
Show some information.
void showMe(const Int &flag=0)
Show some information.
virtual void showMe(const Int &flag=0)
const Real & voltage() const
ZeroDimensionalElement - The base element class.
const std::string enum2string(const ZeroDimensionalElementType &type)
void extractSolution(const ZeroDimensionalNodeS &nodes)
Compute outputs (currents and voltages) from the solution vector after each succesful iteration...
int32_type Int
Generic integer data.
ZeroDimensionalNodeType M_type
void updateABC(matrix_Type &A, matrix_Type &B, vector_Type &C)
create matrix A,B and C.
void updateInverseJacobian(const UInt &iQuadPt)
const ZeroDimensionalElementType & type() const
ZeroDimensionalElementS()
constructor
ZeroDimensionalCircuitData()
Constructor.
const ZeroDimensionalNodeType & type() const
ZeroDimensionalElementPassiveInductor()
Constructor.
const Real & current() const
void createElementInductor(Int ID, Int node1, Int node2, Real parameter)
std::shared_ptr< vecZeroDimensionalNodePtr_Type > ptrVecZeroDimensionalNodePtr_Type
void showMe(const Int &flag=0)
Show some information.
void createElementDiode(Int ID, Int node1, Int node2, Real forwardBias, Real alpha, Real beta)
void createKnownNode(const Int &id)
ZeroDimensionalElementPassiveResistor()
Contructor.
void buildCircuit(const char *fileName, bcPtr_Type bc)
create the circuit.
void showMe(const Int &flag=0)
Show some information.
std::shared_ptr< ZeroDimensionalElementCurrentSource > zeroDimensionalElementCurrentSourcePtr_Type
ZeroDimensionalNodeKnown - This class defines the known node class. A Voltage Source element is conne...
ZeroDimensionalNodeS()
Constructor.
ZeroDimensionalElementVoltageSource - Voltage Source.
virtual Real deltaVoltage() const
void calculateCurrent(const ZeroDimensionalNodeS &Nodes, const ZeroDimensionalElementS &Elements)
calculate current passing outward in voltage source.
const vecInt_Type & elementListIndex() const
ZeroDimensionalElementType
ZeroDimensionalElementS - Container of elements.
const std::string enum2string(const ZeroDimensionalNodeType &type) const
Real direction(const Int &nodeId) const
This method specifies the convention of current direction in an element.
ZeroDimensionalElementPassiveResistor - Resistor.
virtual void assignVariableIndex(const Int &index)
Set the variable index and equation row index for Inductor.
ZeroDimensionalNodeUnknown()
Constructor.
double Real
Generic real data.
#define ZERO_DIMENTIONAL_DEFINED_ELEMENTS
void showMe(const Int &flag=0)
Show some information.
ZeroDimensionalElementVoltageSource()
Constructor.
ZeroDimensionalNodeS - Container of nodes.
void createUnknownNode(const Int &id)
void showMe(const Int &flag=0)
Display some information.
void createElementResistor(Int ID, Int node1, Int node2, Real parameter)
std::shared_ptr< vecZeroDimensionalElementPtr_Type > ptrVecZeroDimensionalElementPtr_Type
ZeroDimensionalNode - The base node class.
void connectElement(zeroDimensionalNodeSPtr_Type &Nodes)
Connect elements to the nodes.
void buildABC(matrix_Type &A, matrix_Type &B, vector_Type &C, const zeroDimensionalNodeSPtr_Type &Nodes)
Contribution of the element of matrix {A} and {B} and vector {C}.
std::shared_ptr< vecZeroDimensionalElementVoltageSourcePtr_Type > ptrVecZeroDimensionalElementVoltageSourcePtr_Type
void extractSolution(const ZeroDimensionalNodeS &nodes)
Compute outputs (currents and voltages) from the solution vector after each succesful iteration...
void assignVariableIndex(const Int &index)
assign the index of the unknown voltage.
vecInt_Type M_nodeListIndex
std::shared_ptr< vecZeroDimensionalNodeUnknownPtr_Type > ptrVecZeroDimensionalNodeUnknownPtr_Type
ZeroDimensionalElementType M_type
void updateCircuitDataFromY(const Real &t, const Epetra_Vector *y, const Epetra_Vector *yp)
(shallow) update the circuit data from the solution.
virtual Real direction(const Int &nodeId) const =0
This method specifies the convention of current direction in an element.
std::shared_ptr< ZeroDimensionalElementVoltageSource > zeroDimensionalElementVoltageSourcePtr_Type
std::shared_ptr< ZeroDimensionalNodeUnknown > zeroDimensionalNodeUnknownPtr_Type
ZeroDimensionalElementSource()
Constructor.
std::shared_ptr< ZeroDimensionalNode > zeroDimensionalNodePtr_Type
ZeroDimensionalElementPassiveCapacitor()
Constructor.
void buildABC(matrix_Type &A, matrix_Type &B, vector_Type &C, const zeroDimensionalNodeSPtr_Type &Nodes)
Contribution of the element of matrix {A} and {B} and vector {C}.
void extractSolutionFromY(const Real &t, const Epetra_Vector &y, const Epetra_Vector &yp)
(deep) update the circuit data from solution.
virtual void showMe(const Int &flag=0)
Display some information.
void showMe(const Int &flag=0)
ZeroDimensionalElementCurrentSource - Current Source.
ZeroDimensionalElementSource - Base class for source elements.
zeroDimensionalElementVoltageSourcePtr_Type M_element
std::shared_ptr< ZeroDimensionalElementPassiveCapacitor > zeroDimensionalElementPassiveCapacitorPtr_Type
std::shared_ptr< ZeroDimensionalElementPassiveInductor > zeroDimensionalElementPassiveInductorPtr_Type
ZeroDimensionalNodeUnknown - This class defines the unknown node class.
std::shared_ptr< ZeroDimensionalElementPassiveResistor > zeroDimensionalElementPassiveResistorPtr_Type
void calculateEffectiveResistance(const Real &voltage)
calculate the effective resistance.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
data_type & operator[](const UInt row)
Access operators.
std::shared_ptr< vecZeroDimensionalElementPassiveInductorPtr_Type > ptrVecZeroDimensionalElementPassiveInductorPtr_Type
void buildABC(matrix_Type &A, matrix_Type &B, vector_Type &C, const zeroDimensionalNodeSPtr_Type &Nodes)
Contribution of the element of matrix {A} and {B} and vector {C}.
ZeroDimensionalElementPassive()
Constructor.