Unverified Commit e63fe1fe authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

please POEMS library in namespace POEMS and remove "using namespace" from headers

parent 95cb9953
Loading
Loading
Loading
Loading
+51 −48
Original line number Diff line number Diff line
@@ -19,7 +19,9 @@
#define POEMSCHAIN_H_

#include "poemslist.h"
#include <iostream>

namespace POEMS {
struct ChildRingData {
   List<int> * childRing;
   int entranceNodeId;
@@ -44,14 +46,14 @@ struct POEMSChain{
   void printTreeStructure(int tabs){
 for(int i = 0; i < tabs; i++)
 {
			cout << "\t";
    std::cout << "\t";
 }
		cout << "Chain: ";
 std::cout << "Chain: ";
 for(int i = 0; i < listOfNodes.GetNumElements(); i++)
 {
			cout << *(listOfNodes(i)) << " ";
    std::cout << *(listOfNodes(i)) << " ";
 }
		cout << endl;
 std::cout << std::endl;
 for(int i = 0; i < childChains.GetNumElements(); i++)
 {
    childChains(i)->printTreeStructure(tabs + 1);
@@ -71,4 +73,5 @@ struct POEMSChain{
 }
   }
};
}
#endif
+221 −218
Original line number Diff line number Diff line
@@ -17,10 +17,12 @@

#ifndef _SYS_PROCESSOR_H_
#define _SYS_PROCESSOR_H_
#include <iostream>
#include "poemslist.h"
#include "poemstree.h"
#include "POEMSChain.h"

namespace POEMS {

struct POEMSNode {
        List<POEMSNode> links;
@@ -141,7 +143,7 @@ POEMSChain * SystemProcessor::AddNewChain(POEMSNode * currentNode){
                tmp = new int;
                *tmp = currentNode->idNumber;
                newChain->listOfNodes.Append(tmp);      //append the current node to the chain & mark as visited
		//cout << "Appending node " << currentNode->idNumber << " to chain" << endl;
                //std::cout << "Appending node " << currentNode->idNumber << " to chain" << std::endl;
                nextNode = currentNode->links.GetHeadElement()->value;  //the next node is the first or second value stored in the links array
                                                                                                                                //of the current node.  We get the first value...
                if(!setLinkVisited(currentNode, nextNode))                                      //...and see if it points back to where we came from. If it does...
@@ -223,7 +225,7 @@ bool SystemProcessor::setLinkVisited(POEMSNode * firstNode, POEMSNode * secondNo
//value for that particular link.  Because each link is represented twice, (once at each node in the link), both of the boolean values need
//to be set in the event that the link has to be set as visited.
{
	//cout << "Checking link between nodes " << firstNode->idNumber << " and " << secondNode->idNumber << "... ";
        //std::cout << "Checking link between nodes " << firstNode->idNumber << " and " << secondNode->idNumber << "... ";
        ListElement<POEMSNode> * tmp = firstNode->links.GetHeadElement();       //get the head element of the list of pointers for node 1
        ListElement<bool> * tmp2 = firstNode->taken.GetHeadElement();           //get the head element of the list of bool isVisited flags for node 1
        while(tmp->value != NULL || tmp2->value != NULL)                                        //go through untill we reach the end of the lists
@@ -232,7 +234,7 @@ bool SystemProcessor::setLinkVisited(POEMSNode * firstNode, POEMSNode * secondNo
                {
                        if(*(tmp2->value) == true)                                                      //if the link has already been visited
                        {
				 //cout << "visited already" << endl;
                                 //std::cout << "visited already" << std::endl;
                                return false;                                                                   //return false to indicate that the link has been visited before this attempt
                        }
                        else                                                                                            //otherwise, visit it
@@ -254,7 +256,7 @@ bool SystemProcessor::setLinkVisited(POEMSNode * firstNode, POEMSNode * secondNo
                {
                        if(*(tmp2->value) == true)                                      //and it has already been visited, then signal an error; this shouldnt ever happen
                        {
				cout << "Error in parsing structure! Should never reach this condition! \n" << 
                                std::cout << "Error in parsing structure! Should never reach this condition! \n" <<
                                                "Record of visited links out of synch between two adjacent nodes.\n";
                                return false;
                        }
@@ -267,7 +269,7 @@ bool SystemProcessor::setLinkVisited(POEMSNode * firstNode, POEMSNode * secondNo
                tmp = tmp->next;
                tmp2 = tmp2->next;
        }
	//cout << "not visited" << endl;
        //std::cout << "not visited" << std::endl;
        return true;                                                                            //return true to indicate that this is the first time the link has been visited
}

@@ -284,4 +286,5 @@ int SystemProcessor::getNumberOfHeadChains(void) //This function isnt implemente
{
        return 0;
}
}
#endif
+2 −3
Original line number Diff line number Diff line
@@ -26,9 +26,8 @@
#include "rigidbody.h"
#include "vect3.h"

class Joint;

using namespace std;
using namespace POEMS;

Body::Body()
{
@@ -132,7 +131,7 @@ void Body::AddPoint(Point* point){
// global body functions
//

Body* NewBody(int type){
Body* POEMS::NewBody(int type){
  switch( BodyType(type) )
    {
      case INERTIALFRAME :  // The inertial reference frame
+2 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include "mat3x3.h"
#include "vect3.h"

namespace POEMS {
// emumerated type
enum BodyType {
  INERTIALFRAME = 0,
@@ -75,5 +76,5 @@ public:

// global body functions
Body* NewBody(int type);

}
#endif
+3 −0
Original line number Diff line number Diff line
@@ -27,6 +27,9 @@
#include "vect3.h"
#include "virtualmatrix.h"

using namespace std;
using namespace POEMS;

Body23Joint::Body23Joint(){
  DimQandU(4,2);
}
Loading