[MBDyn-users] .log file output of equation and dof indices for structural displacement nodes

masarati at aero.polimi.it masarati at aero.polimi.it
Fri May 4 22:33:28 CEST 2012


> Dear Mr. Masarati,
>
> Recently I have tested the latest development snapshot which includes
> displacement only structural nodes. The .log file output of equation and
> dof indices does not work as expected because the same label is used for
> different kinds of output.

This is probably a typo.

> Moreover I would suggest to output all
> structural nodes in the "struct displacement node ..." sections, not only
> the "displacement only nodes". So if one is interested only in the
> displacement, he can access the information of all structural nodes in the
> same way.

Can you clarify/provide patch in this sense?  Do you mean with respect to
all items "struct displacement node *" or only some specific ones?

Moreover, I don't quite get the rationale of this patch in few places. 
For example:

Index: dataman2.cc
===================================================================
RCS file: /home/lagrange/CVS/mbdyn/mbdyn/base/dataman2.cc,v
retrieving revision 1.1.1.3
retrieving revision 2.2
diff -u -r1.1.1.3 -r2.2
--- dataman2.cc	30 Apr 2012 11:10:59 -0000	1.1.1.3
+++ dataman2.cc	1 May 2012 13:41:59 -0000	2.2
@@ -1,4 +1,4 @@
-/* $Header:
/home/lagrange/CVS/MechanicalVibrations/common/mbdyn/2012-05-01-struct-displacement-node-eq-index.patch,v
1.1 2012-05-01 13:46:21 lagrange Exp $ */
+/* $Header:
/home/lagrange/CVS/MechanicalVibrations/common/mbdyn/2012-05-01-struct-displacement-node-eq-index.patch,v
1.1 2012-05-01 13:46:21 lagrange Exp $ */
 /*
  * MBDyn (C) is a multibody analysis code.
  * http://www.mbdyn.org
@@ -224,7 +224,7 @@
 				if (pNode->GetStructNodeType() == StructNode::DUMMY) {
 					continue;
 				}
-				OutHdl.Log() << " " << pNode->iGetFirstIndex();
+				OutHdl.Log() << " " << pNode->iGetFirstPositionIndex();

^^^ The first position index corresponds to the first index

 			}
 		}
 		OutHdl.Log() << std::endl;
@@ -285,56 +285,72 @@
 		for (NodeContainerType::const_iterator i =
NodeData[Node::STRUCTURAL].NodeContainer.begin();
 			i != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++i)
 		{
-			const StructDispNode *pNode = dynamic_cast<const StructDispNode
*>(i->second);
-			if (dynamic_cast<const StructNode *>(pNode) == 0) {
-				OutHdl.Log() << " " << pNode->iGetFirstIndex();
+			const StructDispNode *pDispNode = dynamic_cast<const StructDispNode
*>(i->second);
+			if (pDispNode) {
+				const StructNode* pNode = dynamic_cast<const StructNode*>(pDispNode);
+				if (pNode && pNode->GetStructNodeType() == StructNode::DUMMY) {
+					continue;
+				}
+				OutHdl.Log() << " " << pDispNode->iGetFirstPositionIndex();

^^^ there is no way a dummy node is not a node; so the original test
should suffice.

 			}
 		}
 		OutHdl.Log() << std::endl;

-		OutHdl.Log() << "struct node eqs:";
+		OutHdl.Log() << "struct displacement node eqs:";
 		for (NodeContainerType::const_iterator i =
NodeData[Node::STRUCTURAL].NodeContainer.begin();
 			i != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++i)
 		{
-			const StructDispNode *pNode = dynamic_cast<const StructDispNode
*>(i->second);
-			if (dynamic_cast<const StructNode *>(pNode) == 0) {
-				OutHdl.Log() << " " << pNode->iGetFirstMomentumIndex();
+			const StructDispNode *pDispNode = dynamic_cast<const StructDispNode
*>(i->second);
+			if (pDispNode) {
+				const StructNode* pNode = dynamic_cast<const StructNode*>(pDispNode);
+				if (pNode && pNode->GetStructNodeType() == StructNode::DUMMY) {
+					continue;
+				}
+				OutHdl.Log() << " " << pDispNode->iGetFirstMomentumIndex();
 			}
 		}
 		OutHdl.Log() << std::endl;

-		OutHdl.Log() << "struct node momentum dofs:";
+		OutHdl.Log() << "struct displacement node momentum dofs:";
 		for (NodeContainerType::const_iterator i =
NodeData[Node::STRUCTURAL].NodeContainer.begin();
 			i != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++i)
 		{
-			const StructDispNode *pNode = dynamic_cast<const StructDispNode
*>(i->second);
-			if (dynamic_cast<const StructNode *>(pNode) == 0) {
-				switch (pNode->GetStructDispNodeType()) {
+			const StructDispNode *pDispNode = dynamic_cast<const StructDispNode
*>(i->second);
+			if (pDispNode) {
+				const StructNode* pNode = dynamic_cast<const StructNode*>(pDispNode);
+				if (pNode && pNode->GetStructNodeType() == StructNode::DUMMY) {
+					continue;
+				}
+				switch (pDispNode->GetStructDispNodeType()) {
 				case StructDispNode::STATIC:
 					continue;

 				default:
 					break;
 				}
-				OutHdl.Log() << " " << pNode->iGetFirstMomentumIndex();
+				OutHdl.Log() << " " << pDispNode->iGetFirstMomentumIndex();
 			}
 		}
 		OutHdl.Log() << std::endl;

-		OutHdl.Log() << "struct node momentum eqs:";
+		OutHdl.Log() << "struct displacement node momentum eqs:";
 		for (NodeContainerType::const_iterator i =
NodeData[Node::STRUCTURAL].NodeContainer.begin();
 			i != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++i)
 		{
-			const StructDispNode *pNode = dynamic_cast<const StructDispNode
*>(i->second);
-			if (dynamic_cast<const StructNode *>(pNode) == 0) {
-				switch (pNode->GetStructDispNodeType()) {
+			const StructDispNode *pDispNode = dynamic_cast<const StructDispNode
*>(i->second);
+			if (pDispNode) {
+				const StructNode* pNode = dynamic_cast<const StructNode*>(pDispNode);
+				if (pNode && pNode->GetStructNodeType() == StructNode::DUMMY) {
+					continue;
+				}
+				switch (pDispNode->GetStructDispNodeType()) {
 				case StructNode::STATIC:
 					continue;

 				default:
 					break;
 				}
-				OutHdl.Log() << " " << pNode->iGetFirstIndex();
+				OutHdl.Log() << " " << pDispNode->iGetFirstIndex();
 			}
 		}
 		OutHdl.Log() << std::endl;
@@ -357,9 +373,13 @@
 		for (NodeContainerType::const_iterator i =
NodeData[Node::STRUCTURAL].NodeContainer.begin();
 			i != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++i)
 		{
-			const StructDispNode *pNode = dynamic_cast<const StructDispNode
*>(i->second);
-			if (dynamic_cast<const StructNode *>(pNode) == 0) {
-				OutHdl.Log() << " " << pNode->GetLabel();
+			const StructDispNode *pDispNode = dynamic_cast<const StructDispNode
*>(i->second);
+			if (pDispNode) {
+				const StructNode* pNode = dynamic_cast<const StructNode*>(pDispNode);
+				if (pNode && pNode->GetStructNodeType() == StructNode::DUMMY) {
+					continue;
+				}
+				OutHdl.Log() << " " << pDispNode->GetLabel();
 			}
 		}
 		OutHdl.Log() << std::endl;


In any case, the patch looks harmless, so I'm committing it, thanks.



More information about the MBDyn-users mailing list