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

This commit is contained in:
Axel Kohlmeyer
2019-07-04 00:09:01 -04:00
parent 95cb995336
commit e63fe1fe84
85 changed files with 1361 additions and 1270 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -27,6 +27,9 @@
#include "vect3.h"
#include "virtualmatrix.h"
using namespace std;
using namespace POEMS;
Body23Joint::Body23Joint(){
DimQandU(4,2);
}

View File

@ -22,6 +22,7 @@
#include "joint.h"
#include "matrix.h"
namespace POEMS {
class Body23Joint : public Joint {
Matrix const_sP;
public:
@ -38,5 +39,5 @@ public:
void ForwardKinematics();
void BackwardKinematics();
};
}
#endif

View File

@ -21,6 +21,8 @@
#include <cstdlib>
using namespace std;
using namespace POEMS;
ColMatMap::ColMatMap(){
numrows = 0;

View File

@ -24,6 +24,7 @@
#include "virtualcolmatrix.h"
#include "virtualmatrix.h"
namespace POEMS {
class ColMatrix;
class ColMatMap : public VirtualColMatrix {
@ -64,5 +65,5 @@ public:
friend void FastCKRK5(ColMatMap& X, ColMatrix& Xi, ColMatrix* f, double* c, double dt);
friend void FastFRK5(ColMatMap& X, ColMatrix& Xi, ColMatrix* f, double* c, double dt);
};
}
#endif

View File

@ -21,6 +21,8 @@
#include <cstdlib>
using namespace std;
using namespace POEMS;
ColMatrix::ColMatrix(){
numrows = 0;

View File

@ -23,12 +23,14 @@
#include "virtualcolmatrix.h"
#include "virtualmatrix.h"
namespace POEMS {
class Matrix;
class Vect6;
class Mat3x3;
class Vect3;
class ColMatrix : public VirtualColMatrix {
protected:
double* elements;
public:
ColMatrix();
@ -81,5 +83,5 @@ public:
friend void EPdotdot_udot(ColMatrix& Audot, ColMatrix& Aqdot, ColMatrix& Aq,ColMatrix& Aqddot);
friend void qdot_to_u(ColMatrix& q, ColMatrix& u, ColMatrix& qdot);
};
}
#endif

View File

@ -15,13 +15,14 @@
* CONTACT: anderk5@rpi.edu *
*_________________________________________________________________________*/
#ifndef _DEFINES_H_
#define _DEFINES_H_
#ifndef POEMS_DEFINES_H
#define POEMS_DEFINES_H
namespace POEMS {
enum SolverType {
ONSOLVER = 0,
PARTICLESOLVER = 1
};
}
#endif

View File

@ -23,8 +23,10 @@
#include "mat3x3.h"
using namespace std;
using namespace POEMS;
void EP_Derivatives(ColMatrix& q, ColMatrix& u, ColMatrix& qdot){
void POEMS::EP_Derivatives(ColMatrix& q, ColMatrix& u, ColMatrix& qdot){
EP_Normalize(q);
int num=u.GetNumRows();
if (3<num){
@ -40,7 +42,7 @@ void EP_Derivatives(ColMatrix& q, ColMatrix& u, ColMatrix& qdot){
}
void EP_Transformation(ColMatrix& q, Mat3x3& C){
void POEMS::EP_Transformation(ColMatrix& q, Mat3x3& C){
EP_Normalize(q);
double q11 = q.elements[0]*q.elements[0];
@ -69,7 +71,7 @@ void EP_Transformation(ColMatrix& q, Mat3x3& C){
C.elements[2][1] = 2*(q23 + q14);
}
void EP_FromTransformation(ColMatrix& q, Mat3x3& C){
void POEMS::EP_FromTransformation(ColMatrix& q, Mat3x3& C){
double b[4];
// condition indicators
@ -117,7 +119,7 @@ void EP_FromTransformation(ColMatrix& q, Mat3x3& C){
EP_Normalize(q);
}
void EP_Normalize(ColMatrix& q){
void POEMS:: EP_Normalize(ColMatrix& q){
double one = 1.0/sqrt(q.elements[0]*q.elements[0] + q.elements[1]*q.elements[1] + q.elements[2]*q.elements[2] + q.elements[3]*q.elements[3]);
q.elements[0] = one*q.elements[0];
q.elements[1] = one*q.elements[1];
@ -128,7 +130,7 @@ void EP_Normalize(ColMatrix& q){
void EPdotdot_udot(ColMatrix& Audot, ColMatrix& Aqdot, ColMatrix& Aq, ColMatrix& Aqddot){
void POEMS::EPdotdot_udot(ColMatrix& Audot, ColMatrix& Aqdot, ColMatrix& Aq, ColMatrix& Aqddot){
int num=Audot.GetNumRows();
if (3<num){
for (int i=4; i<=num; i++){
@ -150,7 +152,7 @@ void EPdotdot_udot(ColMatrix& Audot, ColMatrix& Aqdot, ColMatrix& Aq, ColMatrix&
}
void qdot_to_u(ColMatrix& q, ColMatrix& u, ColMatrix& qdot){
void POEMS::qdot_to_u(ColMatrix& q, ColMatrix& u, ColMatrix& qdot){
EP_Normalize(q);
int num=qdot.GetNumRows();
if (4<num){

View File

@ -18,6 +18,7 @@
#ifndef EULERPARAMETERS_H
#define EULERPARAMETERS_H
namespace POEMS {
class ColMatrix;
class Mat3x3;
@ -32,6 +33,6 @@ void EP_Normalize(ColMatrix& q);
void EPdotdot_udot(ColMatrix& Audot, ColMatrix& Aqdot, ColMatrix& Aq,ColMatrix& Aqddot);
void qdot_to_u(ColMatrix& q, ColMatrix& u, ColMatrix& qdot);
}
#endif

View File

@ -29,12 +29,14 @@
#include "vect6.h"
using namespace std;
using namespace POEMS;
//
// Cross Product (friend of Vect3)
//
void FastCross(Vect3& a, Vect3& b, Vect3& c){
void POEMS::FastCross(Vect3& a, Vect3& b, Vect3& c){
c.elements[0] = a.elements[1]*b.elements[2] - a.elements[2]*b.elements[1];
c.elements[1] = a.elements[2]*b.elements[0] - a.elements[0]*b.elements[2];
c.elements[2] = a.elements[0]*b.elements[1] - a.elements[1]*b.elements[0];
@ -44,7 +46,7 @@ void FastCross(Vect3& a, Vect3& b, Vect3& c){
// Simple Rotation (friend of Vect3 and Mat3x3)
//
void FastSimpleRotation(Vect3& v, double q, Mat3x3& C){
void POEMS::FastSimpleRotation(Vect3& v, double q, Mat3x3& C){
// intermediate quantities
double cq = cos(q);
double sq = sin(q);
@ -69,7 +71,7 @@ void FastSimpleRotation(Vect3& v, double q, Mat3x3& C){
// Quaternion Functions
//
void FastQuaternions(ColMatrix& q, Mat3x3& C){
void POEMS::FastQuaternions(ColMatrix& q, Mat3x3& C){
double* e = q.elements;
// normalize the quaternions
@ -94,7 +96,7 @@ void FastQuaternions(ColMatrix& q, Mat3x3& C){
C.elements[2][1] = 2 * (e[2]*e[3] + e[0]*e[1]);
}
void FastQuaternionDerivatives(ColMatrix& q, ColMatrix& omega, ColMatrix& qdot){
void POEMS::FastQuaternionDerivatives(ColMatrix& q, ColMatrix& omega, ColMatrix& qdot){
double* w = omega.elements;
double* e = q.elements;
@ -104,7 +106,7 @@ void FastQuaternionDerivatives(ColMatrix& q, ColMatrix& omega, ColMatrix& qdot){
qdot.elements[3] = 0.5 * ( w[2]*e[0] + w[1]*e[1] - w[0]*e[2]);
}
void FastInvQuaternions(Mat3x3& C, ColMatrix& q){
void POEMS::FastInvQuaternions(Mat3x3& C, ColMatrix& q){
}
//
@ -121,7 +123,7 @@ void FastInvQuaternions(Mat3x3& C, ColMatrix& q){
//
// friend of Matrix
void FastLDLT(Matrix& A, Matrix& C){ // C is the LD of the LDL^T decomposition of A (SPD)
void POEMS::FastLDLT(Matrix& A, Matrix& C){ // C is the LD of the LDL^T decomposition of A (SPD)
double Lv;
int n = A.numrows;
@ -143,7 +145,7 @@ void FastLDLT(Matrix& A, Matrix& C){ // C is the LD of the LDL^T decomposition o
// friend of Mat6x6
void FastLDLT(Mat6x6& A, Mat6x6& C){ // C is the LD of the LDL^T decomposition of A (SPD)
void POEMS::FastLDLT(Mat6x6& A, Mat6x6& C){ // C is the LD of the LDL^T decomposition of A (SPD)
double v[6];
double Lv;
@ -165,7 +167,7 @@ void FastLDLT(Mat6x6& A, Mat6x6& C){ // C is the LD of the LDL^T decomposition o
}
// friend of Matrix
void FastLDLTSubs(Matrix& LD, Matrix& B, Matrix& C){
void POEMS::FastLDLTSubs(Matrix& LD, Matrix& B, Matrix& C){
int n = B.numrows;
int c = B.numcols;
double temp;
@ -190,7 +192,7 @@ void FastLDLTSubs(Matrix& LD, Matrix& B, Matrix& C){
}
// friend of Matrix
void FastLDLTSubsLH(Matrix& B, Matrix& LD, Matrix& C){
void POEMS::FastLDLTSubsLH(Matrix& B, Matrix& LD, Matrix& C){
int n = B.numcols;
int c = B.numrows;
double temp;
@ -215,7 +217,7 @@ void FastLDLTSubsLH(Matrix& B, Matrix& LD, Matrix& C){
}
// friend of Mat6x6
void FastLDLTSubs(Mat6x6& LD, Mat6x6& B, Mat6x6& C){
void POEMS::FastLDLTSubs(Mat6x6& LD, Mat6x6& B, Mat6x6& C){
double temp;
for(int k=0;k<6;k++){
@ -238,7 +240,7 @@ void FastLDLTSubs(Mat6x6& LD, Mat6x6& B, Mat6x6& C){
}
// friend of Mat6x6 & Vect6
void FastLDLTSubs(Mat6x6& LD, Vect6& B, Vect6& C){
void POEMS::FastLDLTSubs(Mat6x6& LD, Vect6& B, Vect6& C){
double temp;
for(int i=0;i<6;i++){
@ -259,7 +261,7 @@ void FastLDLTSubs(Mat6x6& LD, Vect6& B, Vect6& C){
}
// friend of Matrix
void FastLU(Matrix& A, Matrix& LU, int *indx){ // LU is the LU decomposition of A
void POEMS::FastLU(Matrix& A, Matrix& LU, int *indx){ // LU is the LU decomposition of A
int i,imax=0,j,k;
int n = A.numrows;
double big, dum, sum, temp;
@ -309,7 +311,7 @@ void FastLU(Matrix& A, Matrix& LU, int *indx){ // LU is the LU decomposition of
}
// friend of Mat3x3
void FastLU(Mat3x3& A, Mat3x3& LU, int *indx){ // LU is the LU decomposition of A
void POEMS::FastLU(Mat3x3& A, Mat3x3& LU, int *indx){ // LU is the LU decomposition of A
int i,imax=0,j,k;
double big, dum, sum, temp;
double vv[10000];
@ -357,7 +359,7 @@ void FastLU(Mat3x3& A, Mat3x3& LU, int *indx){ // LU is the LU decomposition of
}
// friend of Mat4x4
void FastLU(Mat4x4& A, Mat4x4& LU, int *indx){ // LU is the LU decomposition of A
void POEMS::FastLU(Mat4x4& A, Mat4x4& LU, int *indx){ // LU is the LU decomposition of A
int i,imax=0,j,k;
double big, dum, sum, temp;
double vv[10000];
@ -405,7 +407,7 @@ void FastLU(Mat4x4& A, Mat4x4& LU, int *indx){ // LU is the LU decomposition of
}
// friend of Mat6x6
void FastLU(Mat6x6& A, Mat6x6& LU, int *indx){ // LU is the LU decomposition of A
void POEMS::FastLU(Mat6x6& A, Mat6x6& LU, int *indx){ // LU is the LU decomposition of A
int i,imax=0,j,k;
double big, dum, sum, temp;
double vv[10000];
@ -453,7 +455,7 @@ void FastLU(Mat6x6& A, Mat6x6& LU, int *indx){ // LU is the LU decomposition of
}
// friend of Matrix
void FastLUSubs(Matrix& LU, Matrix& B, Matrix& C, int *indx){ // Appropriate Forward and Back Substitution
void POEMS::FastLUSubs(Matrix& LU, Matrix& B, Matrix& C, int *indx){ // Appropriate Forward and Back Substitution
int i,ip,j,k;
int n = B.numrows;
int c = B.numcols;
@ -477,7 +479,7 @@ void FastLUSubs(Matrix& LU, Matrix& B, Matrix& C, int *indx){ // Appropriate For
}
// friend of Matrix and Mat3x3
void FastLUSubs(Mat3x3& LU, Matrix& B, Matrix& C, int *indx){ // Appropriate Forward and Back Substitution
void POEMS::FastLUSubs(Mat3x3& LU, Matrix& B, Matrix& C, int *indx){ // Appropriate Forward and Back Substitution
int i,ip,j,k;
int n = B.numrows;
int c = B.numcols;
@ -501,7 +503,7 @@ void FastLUSubs(Mat3x3& LU, Matrix& B, Matrix& C, int *indx){ // Appropriate For
}
// friend of Matrix and Mat4x4
void FastLUSubs(Mat4x4& LU, Matrix& B, Matrix& C, int *indx){ // Appropriate Forward and Back Substitution
void POEMS::FastLUSubs(Mat4x4& LU, Matrix& B, Matrix& C, int *indx){ // Appropriate Forward and Back Substitution
int i,ip,j,k;
int n = B.numrows;
int c = B.numcols;
@ -525,7 +527,7 @@ void FastLUSubs(Mat4x4& LU, Matrix& B, Matrix& C, int *indx){ // Appropriate For
}
// friend of Matrix and Mat6x6
void FastLUSubs(Mat6x6& LU, Matrix& B, Matrix& C, int *indx){ // Appropriate Forward and Back Substitution
void POEMS::FastLUSubs(Mat6x6& LU, Matrix& B, Matrix& C, int *indx){ // Appropriate Forward and Back Substitution
int i,ip,j,k;
int n = B.numrows;
int c = B.numcols;
@ -551,7 +553,7 @@ void FastLUSubs(Mat6x6& LU, Matrix& B, Matrix& C, int *indx){ // Appropriate For
// The following LUSubsLH routine is incomplete at the moment.
// friend of Matrix
void FastLUSubsLH(Matrix& LU, Matrix& B, Matrix& C, int *indx){ // Appropriate Forward and Back Substitution
void POEMS::FastLUSubsLH(Matrix& LU, Matrix& B, Matrix& C, int *indx){ // Appropriate Forward and Back Substitution
int i,ip,j,k;
int n = B.numcols;
int c = B.numrows;
@ -582,13 +584,13 @@ void FastLUSubsLH(Matrix& LU, Matrix& B, Matrix& C, int *indx){ // Appropriate F
// Triple sum
//
void FastTripleSum(Vect3& a, Vect3& b, Vect3& c, Vect3& d){ // d = a+b+c
void POEMS::FastTripleSum(Vect3& a, Vect3& b, Vect3& c, Vect3& d){ // d = a+b+c
d.elements[0] = a.elements[0]+b.elements[0]+c.elements[0];
d.elements[1] = a.elements[1]+b.elements[1]+c.elements[1];
d.elements[2] = a.elements[2]+b.elements[2]+c.elements[2];
}
void FastTripleSumPPM(Vect3& a, Vect3& b, Vect3& c, Vect3& d){ // d = a+b-c
void POEMS::FastTripleSumPPM(Vect3& a, Vect3& b, Vect3& c, Vect3& d){ // d = a+b-c
d.elements[0] = a.elements[0]+b.elements[0]-c.elements[0];
d.elements[1] = a.elements[1]+b.elements[1]-c.elements[1];
d.elements[2] = a.elements[2]+b.elements[2]-c.elements[2];
@ -599,7 +601,7 @@ void FastTripleSumPPM(Vect3& a, Vect3& b, Vect3& c, Vect3& d){ // d = a+b-c
//
// friend of matrix
void FastMult(Matrix& A, Matrix& B, Matrix& C){ // C = A*B
void POEMS::FastMult(Matrix& A, Matrix& B, Matrix& C){ // C = A*B
// assumes dimensions are already correct!
int r = A.numrows;
int ca = A.numcols;
@ -615,7 +617,7 @@ void FastMult(Matrix& A, Matrix& B, Matrix& C){ // C = A*B
}
// friend of matrix
void FastTMult(Matrix& A, Matrix& B, Matrix& C){ // C = A*B
void POEMS::FastTMult(Matrix& A, Matrix& B, Matrix& C){ // C = A*B
// assumes dimensions are already correct!
int r = A.numcols;
int ca = A.numrows;
@ -631,14 +633,14 @@ void FastTMult(Matrix& A, Matrix& B, Matrix& C){ // C = A*B
}
// friend of Mat3x3 & Vect3
void FastMult(Mat3x3& A, Vect3& B, Vect3& C){ // C = A*B
void POEMS::FastMult(Mat3x3& A, Vect3& B, Vect3& C){ // C = A*B
C.elements[0] = A.elements[0][0]*B.elements[0] + A.elements[0][1]*B.elements[1] + A.elements[0][2]*B.elements[2];
C.elements[1] = A.elements[1][0]*B.elements[0] + A.elements[1][1]*B.elements[1] + A.elements[1][2]*B.elements[2];
C.elements[2] = A.elements[2][0]*B.elements[0] + A.elements[2][1]*B.elements[1] + A.elements[2][2]*B.elements[2];
}
// friend of Mat3x3, ColMatrix, & Vect3
void FastMult(Mat3x3& A, ColMatrix& B, Vect3& C){ // C = A*B
void POEMS::FastMult(Mat3x3& A, ColMatrix& B, Vect3& C){ // C = A*B
C.elements[0] = A.elements[0][0]*B.elements[0] + A.elements[0][1]*B.elements[1] + A.elements[0][2]*B.elements[2];
C.elements[1] = A.elements[1][0]*B.elements[0] + A.elements[1][1]*B.elements[1] + A.elements[1][2]*B.elements[2];
C.elements[2] = A.elements[2][0]*B.elements[0] + A.elements[2][1]*B.elements[1] + A.elements[2][2]*B.elements[2];
@ -646,42 +648,42 @@ void FastMult(Mat3x3& A, ColMatrix& B, Vect3& C){ // C = A*B
// friend of Mat3x3, ColMatrix, & Vect3
void FastMult(Mat3x3& A, Vect3& B, ColMatrix& C){ // C = A*B
void POEMS::FastMult(Mat3x3& A, Vect3& B, ColMatrix& C){ // C = A*B
C.elements[0] = A.elements[0][0]*B.elements[0] + A.elements[0][1]*B.elements[1] + A.elements[0][2]*B.elements[2];
C.elements[1] = A.elements[1][0]*B.elements[0] + A.elements[1][1]*B.elements[1] + A.elements[1][2]*B.elements[2];
C.elements[2] = A.elements[2][0]*B.elements[0] + A.elements[2][1]*B.elements[1] + A.elements[2][2]*B.elements[2];
}
// friend of Mat3x3 & Vect3
void FastTMult(Mat3x3& A, Vect3& B, Vect3& C){ // C = A^T*B
void POEMS::FastTMult(Mat3x3& A, Vect3& B, Vect3& C){ // C = A^T*B
C.elements[0] = A.elements[0][0]*B.elements[0] + A.elements[1][0]*B.elements[1] + A.elements[2][0]*B.elements[2];
C.elements[1] = A.elements[0][1]*B.elements[0] + A.elements[1][1]*B.elements[1] + A.elements[2][1]*B.elements[2];
C.elements[2] = A.elements[0][2]*B.elements[0] + A.elements[1][2]*B.elements[1] + A.elements[2][2]*B.elements[2];
}
// friend of Mat3x3 & Vect3
void FastNegMult(Mat3x3& A, Vect3& B, Vect3& C){ // C = -A*B
void POEMS::FastNegMult(Mat3x3& A, Vect3& B, Vect3& C){ // C = -A*B
C.elements[0] = -A.elements[0][0]*B.elements[0] - A.elements[0][1]*B.elements[1] - A.elements[0][2]*B.elements[2];
C.elements[1] = -A.elements[1][0]*B.elements[0] - A.elements[1][1]*B.elements[1] - A.elements[1][2]*B.elements[2];
C.elements[2] = -A.elements[2][0]*B.elements[0] - A.elements[2][1]*B.elements[1] - A.elements[2][2]*B.elements[2];
}
// friend of Mat3x3 & Vect3
void FastNegTMult(Mat3x3& A, Vect3& B, Vect3& C){ // C = -A^T*B
void POEMS::FastNegTMult(Mat3x3& A, Vect3& B, Vect3& C){ // C = -A^T*B
C.elements[0] = -A.elements[0][0]*B.elements[0] - A.elements[1][0]*B.elements[1] - A.elements[2][0]*B.elements[2];
C.elements[1] = -A.elements[0][1]*B.elements[0] - A.elements[1][1]*B.elements[1] - A.elements[2][1]*B.elements[2];
C.elements[2] = -A.elements[0][2]*B.elements[0] - A.elements[1][2]*B.elements[1] - A.elements[2][2]*B.elements[2];
}
// friend of Vect3
void FastMult(double a, Vect3& B, Vect3& C){ // C = a*B
void POEMS::FastMult(double a, Vect3& B, Vect3& C){ // C = a*B
C.elements[0] = a*B.elements[0];
C.elements[1] = a*B.elements[1];
C.elements[2] = a*B.elements[2];
}
// friend of Mat4x4 & Vect4
void FastMult(Mat4x4& A, Vect4& B, Vect4& C){ // C = A*B
void POEMS::FastMult(Mat4x4& A, Vect4& B, Vect4& C){ // C = A*B
C.elements[0] = A.elements[0][0]*B.elements[0] + A.elements[0][1]*B.elements[1] + A.elements[0][2]*B.elements[2] + A.elements[0][3]*B.elements[3];
C.elements[1] = A.elements[1][0]*B.elements[0] + A.elements[1][1]*B.elements[1] + A.elements[1][2]*B.elements[2] + A.elements[1][3]*B.elements[3];
C.elements[2] = A.elements[2][0]*B.elements[0] + A.elements[2][1]*B.elements[1] + A.elements[2][2]*B.elements[2] + A.elements[2][3]*B.elements[3];
@ -689,7 +691,7 @@ void FastMult(Mat4x4& A, Vect4& B, Vect4& C){ // C = A*B
}
// friend of Mat4x4 & Vect4
void FastTMult(Mat4x4& A, Vect4& B, Vect4& C){ // C = A^T*B
void POEMS::FastTMult(Mat4x4& A, Vect4& B, Vect4& C){ // C = A^T*B
C.elements[0] = A.elements[0][0]*B.elements[0] + A.elements[1][0]*B.elements[1] + A.elements[2][0]*B.elements[2] + A.elements[3][0]*B.elements[3];
C.elements[1] = A.elements[0][1]*B.elements[0] + A.elements[1][1]*B.elements[1] + A.elements[2][1]*B.elements[2] + A.elements[3][1]*B.elements[3];
C.elements[2] = A.elements[0][2]*B.elements[0] + A.elements[1][2]*B.elements[1] + A.elements[2][2]*B.elements[2] + A.elements[3][2]*B.elements[3];
@ -697,7 +699,7 @@ void FastTMult(Mat4x4& A, Vect4& B, Vect4& C){ // C = A^T*B
}
// friend of Mat4x4 & Vect4
void FastNegMult(Mat4x4& A, Vect4& B, Vect4& C){ // C = -A*B
void POEMS::FastNegMult(Mat4x4& A, Vect4& B, Vect4& C){ // C = -A*B
C.elements[0] = -A.elements[0][0]*B.elements[0] - A.elements[0][1]*B.elements[1] - A.elements[0][2]*B.elements[2] - A.elements[0][3]*B.elements[3];
C.elements[1] = -A.elements[1][0]*B.elements[0] - A.elements[1][1]*B.elements[1] - A.elements[1][2]*B.elements[2] - A.elements[1][3]*B.elements[3];
C.elements[2] = -A.elements[2][0]*B.elements[0] - A.elements[2][1]*B.elements[1] - A.elements[2][2]*B.elements[2] - A.elements[2][3]*B.elements[3];
@ -705,7 +707,7 @@ void FastNegMult(Mat4x4& A, Vect4& B, Vect4& C){ // C = -A*B
}
// friend of Mat4x4 & Vect4
void FastNegTMult(Mat4x4& A, Vect4& B, Vect4& C){ // C = -A^T*B
void POEMS::FastNegTMult(Mat4x4& A, Vect4& B, Vect4& C){ // C = -A^T*B
C.elements[0] = -A.elements[0][0]*B.elements[0] - A.elements[1][0]*B.elements[1] - A.elements[2][0]*B.elements[2] - A.elements[3][0]*B.elements[3];
C.elements[1] = -A.elements[0][1]*B.elements[0] - A.elements[1][1]*B.elements[1] - A.elements[2][1]*B.elements[2] - A.elements[3][1]*B.elements[3];
C.elements[2] = -A.elements[0][2]*B.elements[0] - A.elements[1][2]*B.elements[1] - A.elements[2][2]*B.elements[2] - A.elements[3][2]*B.elements[3];
@ -713,7 +715,7 @@ void FastNegTMult(Mat4x4& A, Vect4& B, Vect4& C){ // C = -A^T*B
}
// friend of Vect4
void FastMult(double a, Vect4& B, Vect4& C){ // C = a*B
void POEMS::FastMult(double a, Vect4& B, Vect4& C){ // C = a*B
C.elements[0] = a*B.elements[0];
C.elements[1] = a*B.elements[1];
C.elements[2] = a*B.elements[2];
@ -721,7 +723,7 @@ void FastMult(double a, Vect4& B, Vect4& C){ // C = a*B
}
// friend of Matrix & Mat6x6
void FastMultT(Matrix& A, Matrix& B, Mat6x6& C){ // C = A*B^T
void POEMS::FastMultT(Matrix& A, Matrix& B, Mat6x6& C){ // C = A*B^T
int i,j,k,n;
n = A.numcols;
@ -734,7 +736,7 @@ void FastMultT(Matrix& A, Matrix& B, Mat6x6& C){ // C = A*B^T
}
// friend Matrix, Vect6, ColMatrix
void FastMult(Matrix& A, ColMatrix& B, Vect6& C){
void POEMS::FastMult(Matrix& A, ColMatrix& B, Vect6& C){
int ca = A.numcols;
int i,k;
@ -746,7 +748,7 @@ void FastMult(Matrix& A, ColMatrix& B, Vect6& C){
}
// friend of Matrix & Mat6x6
void FastMult(Mat6x6& A, Matrix& B, Matrix& C){ // C = A*B
void POEMS::FastMult(Mat6x6& A, Matrix& B, Matrix& C){ // C = A*B
// assumes dimensions are already correct!
int cb = B.numcols;
@ -760,7 +762,7 @@ void FastMult(Mat6x6& A, Matrix& B, Matrix& C){ // C = A*B
}
// friend Matrix, Vect6, ColMatrix
void FastTMult(Matrix& A, Vect6& B, ColMatrix& C){ // C = A^T*B
void POEMS::FastTMult(Matrix& A, Vect6& B, ColMatrix& C){ // C = A^T*B
int n = C.numrows;
int i,k;
for(i=0;i<n;i++){
@ -771,7 +773,7 @@ void FastTMult(Matrix& A, Vect6& B, ColMatrix& C){ // C = A^T*B
}
// friend of Mat3x3
void FastMult(Mat3x3& A, Mat3x3& B, Mat3x3& C){ // C = A*B
void POEMS::FastMult(Mat3x3& A, Mat3x3& B, Mat3x3& C){ // C = A*B
C.elements[0][0] = A.elements[0][0]*B.elements[0][0] + A.elements[0][1]*B.elements[1][0] + A.elements[0][2]*B.elements[2][0];
C.elements[0][1] = A.elements[0][0]*B.elements[0][1] + A.elements[0][1]*B.elements[1][1] + A.elements[0][2]*B.elements[2][1];
C.elements[0][2] = A.elements[0][0]*B.elements[0][2] + A.elements[0][1]*B.elements[1][2] + A.elements[0][2]*B.elements[2][2];
@ -786,7 +788,7 @@ void FastMult(Mat3x3& A, Mat3x3& B, Mat3x3& C){ // C = A*B
}
// friend of Mat3x3
void FastMultT(Mat3x3& A, Mat3x3& B, Mat3x3& C){ // C = A*B^T
void POEMS::FastMultT(Mat3x3& A, Mat3x3& B, Mat3x3& C){ // C = A*B^T
C.elements[0][0] = A.elements[0][0]*B.elements[0][0] + A.elements[0][1]*B.elements[0][1] + A.elements[0][2]*B.elements[0][2];
C.elements[0][1] = A.elements[0][0]*B.elements[1][0] + A.elements[0][1]*B.elements[1][1] + A.elements[0][2]*B.elements[1][2];
C.elements[0][2] = A.elements[0][0]*B.elements[2][0] + A.elements[0][1]*B.elements[2][1] + A.elements[0][2]*B.elements[2][2];
@ -801,7 +803,7 @@ void FastMultT(Mat3x3& A, Mat3x3& B, Mat3x3& C){ // C = A*B^T
}
// friend of Mat4x4
void FastMult(Mat4x4& A, Mat4x4& B, Mat4x4& C){ // C = A*B
void POEMS::FastMult(Mat4x4& A, Mat4x4& B, Mat4x4& C){ // C = A*B
C.elements[0][0] = A.elements[0][0]*B.elements[0][0] + A.elements[0][1]*B.elements[1][0] + A.elements[0][2]*B.elements[2][0] + A.elements[0][3]*B.elements[3][0];
C.elements[0][1] = A.elements[0][0]*B.elements[0][1] + A.elements[0][1]*B.elements[1][1] + A.elements[0][2]*B.elements[2][1] + A.elements[0][3]*B.elements[3][1];
C.elements[0][2] = A.elements[0][0]*B.elements[0][2] + A.elements[0][1]*B.elements[1][2] + A.elements[0][2]*B.elements[2][2] + A.elements[0][3]*B.elements[3][2];
@ -824,7 +826,7 @@ void FastMult(Mat4x4& A, Mat4x4& B, Mat4x4& C){ // C = A*B
}
// friend of Mat4x4
void FastMultT(Mat4x4& A, Mat4x4& B, Mat4x4& C){ // C = A*B^T
void POEMS::FastMultT(Mat4x4& A, Mat4x4& B, Mat4x4& C){ // C = A*B^T
C.elements[0][0] = A.elements[0][0]*B.elements[0][0] + A.elements[0][1]*B.elements[0][1] + A.elements[0][2]*B.elements[0][2] + A.elements[0][3]*B.elements[0][3];
C.elements[0][1] = A.elements[0][0]*B.elements[1][0] + A.elements[0][1]*B.elements[1][1] + A.elements[0][2]*B.elements[1][2] + A.elements[0][3]*B.elements[1][3];
C.elements[0][2] = A.elements[0][0]*B.elements[2][0] + A.elements[0][1]*B.elements[2][1] + A.elements[0][2]*B.elements[2][2] + A.elements[0][3]*B.elements[2][3];
@ -848,7 +850,7 @@ void FastMultT(Mat4x4& A, Mat4x4& B, Mat4x4& C){ // C = A*B^T
}
// friend of Mat6x6
void FastMult(Mat6x6& A, Mat6x6& B, Mat6x6& C){ // C = A*B
void POEMS::FastMult(Mat6x6& A, Mat6x6& B, Mat6x6& C){ // C = A*B
int i,j,k;
for(i=0;i<6;i++)
for(j=0;j<6;j++){
@ -859,7 +861,7 @@ void FastMult(Mat6x6& A, Mat6x6& B, Mat6x6& C){ // C = A*B
}
// friend of Mat6x6
void FastMultT(Mat6x6& A, Mat6x6& B, Mat6x6& C){ // C = A*B
void POEMS::FastMultT(Mat6x6& A, Mat6x6& B, Mat6x6& C){ // C = A*B
int i,j,k;
for(i=0;i<6;i++)
for(j=0;j<6;j++){
@ -870,7 +872,7 @@ void FastMultT(Mat6x6& A, Mat6x6& B, Mat6x6& C){ // C = A*B
}
// friend of Mat6x6
void FastTMult(Mat6x6& A, Mat6x6& B, Mat6x6& C){ // C = A^T*B
void POEMS::FastTMult(Mat6x6& A, Mat6x6& B, Mat6x6& C){ // C = A^T*B
int i,j,k;
for(i=0;i<6;i++)
for(j=0;j<6;j++){
@ -881,13 +883,13 @@ void FastTMult(Mat6x6& A, Mat6x6& B, Mat6x6& C){ // C = A^T*B
}
// friend of Mat6x6 & Vect6
void FastMult(Mat6x6& A, Vect6& B, Vect6& C){ // C = A*B
void POEMS::FastMult(Mat6x6& A, Vect6& B, Vect6& C){ // C = A*B
for(int i=0;i<6;i++)
C.elements[i] = A.elements[i][0]*B.elements[0] + A.elements[i][1]*B.elements[1] + A.elements[i][2]*B.elements[2] + A.elements[i][3]*B.elements[3] + A.elements[i][4]*B.elements[4] + A.elements[i][5]*B.elements[5];
}
// friend of Mat6x6 & Vect6
void FastTMult(Mat6x6& A, Vect6& B, Vect6& C){ // C = A^T*B
void POEMS::FastTMult(Mat6x6& A, Vect6& B, Vect6& C){ // C = A^T*B
for(int i=0;i<6;i++)
C.elements[i] = A.elements[0][i]*B.elements[0] + A.elements[1][i]*B.elements[1] + A.elements[2][i]*B.elements[2] + A.elements[3][i]*B.elements[3] + A.elements[4][i]*B.elements[4] + A.elements[5][i]*B.elements[5];
}
@ -897,21 +899,21 @@ void FastTMult(Mat6x6& A, Vect6& B, Vect6& C){ // C = A^T*B
//
// friend of Vect3
void FastAdd(Vect3& A, Vect3& B, Vect3& C){ // C = A+B
void POEMS::FastAdd(Vect3& A, Vect3& B, Vect3& C){ // C = A+B
C.elements[0] = A.elements[0] + B.elements[0];
C.elements[1] = A.elements[1] + B.elements[1];
C.elements[2] = A.elements[2] + B.elements[2];
}
// friend of Vect4
void FastAdd(Vect4& A, Vect4& B, Vect4& C){ // C = A+B
void POEMS::FastAdd(Vect4& A, Vect4& B, Vect4& C){ // C = A+B
C.elements[0] = A.elements[0] + B.elements[0];
C.elements[1] = A.elements[1] + B.elements[1];
C.elements[2] = A.elements[2] + B.elements[2];
C.elements[3] = A.elements[3] + B.elements[3];
}
void FastAdd(Mat6x6& A, Mat6x6& B, Mat6x6& C){ // C = A+B
void POEMS::FastAdd(Mat6x6& A, Mat6x6& B, Mat6x6& C){ // C = A+B
int i,j;
for(i=0;i<6;i++)
for(j=0;j<6;j++)
@ -919,7 +921,7 @@ void FastAdd(Mat6x6& A, Mat6x6& B, Mat6x6& C){ // C = A+B
}
// friend of Vect6
void FastAdd(Vect6& A, Vect6& B, Vect6& C){ // C = A-B
void POEMS::FastAdd(Vect6& A, Vect6& B, Vect6& C){ // C = A-B
C.elements[0] = A.elements[0] + B.elements[0];
C.elements[1] = A.elements[1] + B.elements[1];
C.elements[2] = A.elements[2] + B.elements[2];
@ -933,21 +935,21 @@ void FastAdd(Vect6& A, Vect6& B, Vect6& C){ // C = A-B
//
// friend of Vect3
void FastSubt(Vect3& A, Vect3& B, Vect3& C){ // C = A-B
void POEMS::FastSubt(Vect3& A, Vect3& B, Vect3& C){ // C = A-B
C.elements[0] = A.elements[0] - B.elements[0];
C.elements[1] = A.elements[1] - B.elements[1];
C.elements[2] = A.elements[2] - B.elements[2];
}
// friend of Vect4
void FastSubt(Vect4& A, Vect4& B, Vect4& C){ // C = A-B
void POEMS::FastSubt(Vect4& A, Vect4& B, Vect4& C){ // C = A-B
C.elements[0] = A.elements[0] - B.elements[0];
C.elements[1] = A.elements[1] - B.elements[1];
C.elements[2] = A.elements[2] - B.elements[2];
C.elements[3] = A.elements[3] - B.elements[3];
}
void FastSubt(Mat6x6& A, Mat6x6& B, Mat6x6& C){ // C = A-B
void POEMS::FastSubt(Mat6x6& A, Mat6x6& B, Mat6x6& C){ // C = A-B
int i,j;
for(i=0;i<6;i++)
for(j=0;j<6;j++)
@ -955,7 +957,7 @@ void FastSubt(Mat6x6& A, Mat6x6& B, Mat6x6& C){ // C = A-B
}
// friend of Vect6
void FastSubt(Vect6& A, Vect6& B, Vect6& C){ // C = A-B
void POEMS::FastSubt(Vect6& A, Vect6& B, Vect6& C){ // C = A-B
C.elements[0] = A.elements[0] - B.elements[0];
C.elements[1] = A.elements[1] - B.elements[1];
C.elements[2] = A.elements[2] - B.elements[2];
@ -965,33 +967,33 @@ void FastSubt(Vect6& A, Vect6& B, Vect6& C){ // C = A-B
}
// friend of ColMatMap
void FastAssign(ColMatMap& A, ColMatMap& C){
void POEMS::FastAssign(ColMatMap& A, ColMatMap& C){
for(int i=0;i<C.numrows;i++)
*(C.elements[i]) = *(A.elements[i]);
}
// friend of ColMatrix
void FastAssign(ColMatrix& A, ColMatrix& C){ //C = A
void POEMS::FastAssign(ColMatrix& A, ColMatrix& C){ //C = A
for(int i=0;i<C.numrows;i++)
C.elements[i] = A.elements[i];
}
// friend of Vect3
void FastAssign(Vect3& A, Vect3& C){ //C = A
void POEMS::FastAssign(Vect3& A, Vect3& C){ //C = A
C.elements[0] = A.elements[0];
C.elements[1] = A.elements[1];
C.elements[2] = A.elements[2];
}
// friend of Vect3 & ColMatrix
void FastAssign(ColMatrix& A, Vect3& C){ //C = A
void POEMS::FastAssign(ColMatrix& A, Vect3& C){ //C = A
C.elements[0] = A.elements[0];
C.elements[1] = A.elements[1];
C.elements[2] = A.elements[2];
}
// friend of Vect4
void FastAssign(Vect4& A, Vect4& C){ //C = A
void POEMS::FastAssign(Vect4& A, Vect4& C){ //C = A
C.elements[0] = A.elements[0];
C.elements[1] = A.elements[1];
C.elements[2] = A.elements[2];
@ -999,7 +1001,7 @@ void FastAssign(Vect4& A, Vect4& C){ //C = A
}
// friend of Mat3x3
void FastAssignT(Mat3x3& A, Mat3x3& C){
void POEMS::FastAssignT(Mat3x3& A, Mat3x3& C){
C.elements[0][0] = A.elements[0][0];
C.elements[1][1] = A.elements[1][1];
C.elements[2][2] = A.elements[2][2];
@ -1015,7 +1017,7 @@ void FastAssignT(Mat3x3& A, Mat3x3& C){
}
// friend of Mat4x4
void FastAssignT(Mat4x4& A, Mat4x4& C){
void POEMS::FastAssignT(Mat4x4& A, Mat4x4& C){
C.elements[0][0] = A.elements[0][0];
C.elements[1][1] = A.elements[1][1];
C.elements[2][2] = A.elements[2][2];

View File

@ -18,6 +18,7 @@
#ifndef FASTMATRIXOPS_H
#define FASTMATRIXOPS_H
namespace POEMS {
class ColMatMap;
class ColMatrix;
class Mat3x3;
@ -102,5 +103,5 @@ void FastAssign(ColMatrix&A, Vect3& C);
void FastAssign(Vect4& A, Vect4& C); // C = A
void FastAssignT(Mat3x3& A, Mat3x3& C); // C = A^T
void FastAssignT(Mat4x4& A, Mat4x4& C); // C = A^T
}
#endif

View File

@ -24,6 +24,8 @@
#include "virtualmatrix.h"
using namespace std;
using namespace POEMS;
FixedPoint::FixedPoint(){
}

View File

@ -24,6 +24,7 @@
#include "point.h"
#include "vect3.h"
namespace POEMS {
class FixedPoint : public Point {
public:
FixedPoint();
@ -35,5 +36,5 @@ public:
bool ReadInPointData(std::istream& in);
void WriteOutPointData(std::ostream& out);
};
}
#endif

View File

@ -29,6 +29,8 @@
#include "vect3.h"
#include "virtualmatrix.h"
using namespace POEMS;
FreeBodyJoint::FreeBodyJoint(){
DimQandU(7,6);
@ -73,7 +75,7 @@ Matrix FreeBodyJoint::GetBackward_sP(){
Mat6x6 sP;
sP.Identity();
sP =-1.0*sP;
cout<<"Did I come here in "<<endl;
std::cout<<"Did I come here in "<<std::endl;
return sP;
}
@ -87,7 +89,7 @@ void FreeBodyJoint::UpdateBackward_sP( Matrix& sP){
}
void FreeBodyJoint::ForwardKinematics(){
//cout<<"Check in freebody "<<q<<" "<<qdot<<endl;
//std::cout<<"Check in freebody "<<q<<" "<<qdot<<std::endl;
EP_Normalize(q);
// COMMENT STEP1: CALCULATE ORIENTATIONS
@ -155,6 +157,6 @@ void FreeBodyJoint::ForwardKinematics(){
}
void FreeBodyJoint::BackwardKinematics(){
cout<<"Did I come here "<<endl;
std::cout<<"Did I come here "<<std::endl;
}

View File

@ -23,7 +23,7 @@
#include "joint.h"
#include "matrix.h"
namespace POEMS {
class FreeBodyJoint : public Joint{
public:
FreeBodyJoint();
@ -40,5 +40,5 @@ public:
void ForwardKinematics();
void BackwardKinematics();
};
}
#endif

View File

@ -21,6 +21,8 @@
#include "virtualmatrix.h"
using namespace std;
using namespace POEMS;
InertialFrame::InertialFrame(){
gravity.Zeros();

View File

@ -24,7 +24,7 @@
#include "body.h"
#include "vect3.h"
namespace POEMS {
class InertialFrame : public Body {
Vect3 gravity;
public:
@ -36,5 +36,5 @@ public:
bool ReadInBodyData(std::istream& in);
void WriteOutBodyData(std::ostream& out);
};
}
#endif

View File

@ -36,6 +36,8 @@
#include "virtualmatrix.h"
using namespace std;
using namespace POEMS;
Joint::Joint(){
body1 = body2 = 0;
@ -245,7 +247,7 @@ void Joint::ComputeBackwardGlobalTransform(){
// global joint functions
//
Joint* NewJoint(int type){
Joint* POEMS::NewJoint(int type){
switch( JointType(type) )
{
case FREEBODYJOINT : return new FreeBodyJoint;

View File

@ -25,6 +25,7 @@
#include "matrix.h"
#include "vect3.h"
namespace POEMS {
class VirtualMatrix;
enum JointType {
@ -124,5 +125,5 @@ public:
// global joint functions
Joint* NewJoint(int type);
}
#endif

View File

@ -21,6 +21,8 @@
#include "mat3x3.h"
using namespace std;
using namespace POEMS;
Mat3x3::Mat3x3(){
numrows = numcols = 3;

View File

@ -21,6 +21,7 @@
#include <iostream>
#include "virtualmatrix.h"
namespace POEMS {
class Vect3;
class Mat6x6;
class ColMatrix;
@ -76,7 +77,6 @@ public:
friend void EP_Transformation(ColMatrix& q, Mat3x3& C);
friend void EP_FromTransformation(ColMatrix& q, Mat3x3& C);
};
}
#endif

View File

@ -21,6 +21,8 @@
#include <iostream>
using namespace std;
using namespace POEMS;
Mat4x4::Mat4x4(){
numrows = numcols = 4;

View File

@ -21,6 +21,7 @@
#include <iostream>
#include "virtualmatrix.h"
namespace POEMS {
class Vect4;
class Matrix;
@ -64,5 +65,5 @@ public:
friend void FastMultT(Mat4x4& A, Mat4x4& B, Mat4x4& C);
friend void FastAssignT(Mat4x4& A, Mat4x4& C);
};
}
#endif

View File

@ -21,6 +21,8 @@
#include <iostream>
using namespace std;
using namespace POEMS;
Mat6x6::Mat6x6(){
numrows = numcols = 6;

View File

@ -21,6 +21,7 @@
#include "virtualmatrix.h"
namespace POEMS {
class Matrix;
class Mat3x3;
class Vect6;
@ -73,5 +74,5 @@ public:
friend void OnPopulateSC(Vect3& gamma, Mat3x3& C, Mat6x6& SC);
friend void OnPopulateSI(Mat3x3& inertia, double mass, Mat6x6& sI);
};
}
#endif

View File

@ -20,23 +20,14 @@
#define MATRICES_H
#include "matrix.h"
#include "colmatrix.h"
#include "rowmatrix.h"
#include "mat3x3.h"
#include "vect3.h"
#include "mat4x4.h"
#include "vect4.h"
#include "mat6x6.h"
#include "vect6.h"
#include "colmatmap.h"
#endif

View File

@ -21,6 +21,8 @@
#include <cstdlib>
using namespace std;
using namespace POEMS;
Matrix::Matrix(){
numrows = numcols = 0;

View File

@ -22,6 +22,7 @@
#include "virtualmatrix.h"
namespace POEMS {
class Mat3x3;
class Mat4x4;
class Mat6x6;
@ -73,7 +74,6 @@ public:
friend void FastMult(Mat6x6& A, Matrix& B, Matrix& C);
friend void FastMult(Matrix& A, ColMatrix& B, Vect6& C);
friend void FastMultT(Matrix& A, Matrix& B, Mat6x6& C);
};
}
#endif

View File

@ -27,12 +27,14 @@
#include "virtualrowmatrix.h"
using namespace std;
using namespace POEMS;
//
// Create a new matrix
//
VirtualMatrix* NewMatrix(int type){
VirtualMatrix* POEMS::NewMatrix(int type){
switch( MatrixType(type) )
{
case MATRIX : return new Matrix;
@ -50,7 +52,7 @@ VirtualMatrix* NewMatrix(int type){
// Transpose
//
Matrix T(const VirtualMatrix& A){
Matrix POEMS::T(const VirtualMatrix& A){
int numrows = A.GetNumRows();
int numcols = A.GetNumCols();
Matrix C(numcols,numrows);
@ -60,7 +62,7 @@ Matrix T(const VirtualMatrix& A){
return C;
}
Mat3x3 T(const Mat3x3& A){
Mat3x3 POEMS::T(const Mat3x3& A){
Mat3x3 C;
C.elements[0][0] = A.elements[0][0];
C.elements[1][1] = A.elements[1][1];
@ -76,7 +78,7 @@ Mat3x3 T(const Mat3x3& A){
return C;
}
Mat6x6 T(const Mat6x6& A){
Mat6x6 POEMS::T(const Mat6x6& A){
Mat6x6 C;
int i,j;
for(i=0;i<6;i++)
@ -86,7 +88,7 @@ Mat6x6 T(const Mat6x6& A){
return C;
}
Matrix T(const Vect3& A){
Matrix POEMS::T(const Vect3& A){
Matrix C(1,3);
C.BasicSet(0,0,A.elements[0]);
C.BasicSet(0,1,A.elements[1]);
@ -95,7 +97,7 @@ Matrix T(const Vect3& A){
return C;
}
Matrix T(const Vect6& A){
Matrix POEMS::T(const Vect6& A){
Matrix C(1,6);
C.BasicSet(0,0,A.elements[0]);
C.BasicSet(0,1,A.elements[1]);
@ -107,7 +109,7 @@ Matrix T(const Vect6& A){
return C;
}
RowMatrix T(const VirtualColMatrix &A){
RowMatrix POEMS::T(const VirtualColMatrix &A){
int numele = A.GetNumRows();
RowMatrix C(numele);
for(int i=0;i<numele;i++)
@ -115,7 +117,7 @@ RowMatrix T(const VirtualColMatrix &A){
return C;
}
ColMatrix T(const VirtualRowMatrix &A){
ColMatrix POEMS::T(const VirtualRowMatrix &A){
int numele = A.GetNumCols();
ColMatrix C(numele);
for(int i=0;i<numele;i++)
@ -127,7 +129,7 @@ ColMatrix T(const VirtualRowMatrix &A){
// Symmetric Inverse
//
Matrix SymInverse(Matrix &A){
Matrix POEMS::SymInverse(Matrix &A){
int r = A.GetNumRows();
Matrix C(r,r);
Matrix LD(r,r);
@ -139,7 +141,7 @@ Matrix SymInverse(Matrix &A){
return C;
}
Mat6x6 SymInverse(Mat6x6 &A){
Mat6x6 POEMS::SymInverse(Mat6x6 &A){
Mat6x6 C;
Mat6x6 LD;
Mat6x6 I;
@ -207,7 +209,7 @@ Mat6x6 Inverse(Mat6x6& A){
// overloaded addition
//
Matrix operator+ (const VirtualMatrix &A, const VirtualMatrix &B){ // addition
Matrix POEMS::operator+ (const VirtualMatrix &A, const VirtualMatrix &B){ // addition
int Arows,Acols,Brows,Bcols;
Arows = A.GetNumRows();
Acols = A.GetNumCols();
@ -232,7 +234,7 @@ Matrix operator+ (const VirtualMatrix &A, const VirtualMatrix &B){ // addit
// overloaded subtraction
//
Matrix operator- (const VirtualMatrix &A, const VirtualMatrix &B){ // subtraction
Matrix POEMS::operator- (const VirtualMatrix &A, const VirtualMatrix &B){ // subtraction
int Arows,Acols,Brows,Bcols;
Arows = A.GetNumRows();
Acols = A.GetNumCols();
@ -257,7 +259,7 @@ Matrix operator- (const VirtualMatrix &A, const VirtualMatrix &B){ // subtr
// overloaded matrix multiplication
//
Matrix operator* (const VirtualMatrix &A, const VirtualMatrix &B){ // multiplication
Matrix POEMS::operator* (const VirtualMatrix &A, const VirtualMatrix &B){ // multiplication
int Arows,Acols,Brows,Bcols;
Arows = A.GetNumRows();
Acols = A.GetNumCols();
@ -284,13 +286,13 @@ Matrix operator* (const VirtualMatrix &A, const VirtualMatrix &B){ // multi
// overloaded scalar multiplication
//
Matrix operator* (const VirtualMatrix &A, double b){ // multiplication
Matrix POEMS::operator* (const VirtualMatrix &A, double b){ // multiplication
Matrix C = A;
C *= b;
return C;
}
Matrix operator* (double b, const VirtualMatrix &A){ // multiplication
Matrix POEMS::operator* (double b, const VirtualMatrix &A){ // multiplication
Matrix C = A;
C *= b;
return C;
@ -300,7 +302,7 @@ Matrix operator* (double b, const VirtualMatrix &A){ // multiplication
// overloaded negative
//
Matrix operator- (const VirtualMatrix& A){ // negative
Matrix POEMS::operator- (const VirtualMatrix& A){ // negative
int r = A.GetNumRows();
int c = A.GetNumCols();
Matrix C(r,c);
@ -316,7 +318,7 @@ Matrix operator- (const VirtualMatrix& A){ // negative
// Cross product (friend of Vect3)
//
Vect3 Cross(Vect3& a, Vect3& b){
Vect3 POEMS::Cross(Vect3& a, Vect3& b){
return CrossMat(a)*b;
}
@ -324,7 +326,7 @@ Vect3 Cross(Vect3& a, Vect3& b){
// Cross Matrix (friend of Vect3 & Mat3x3)
//
Mat3x3 CrossMat(Vect3& a){
Mat3x3 POEMS::CrossMat(Vect3& a){
Mat3x3 C;
C.Zeros();
C.elements[0][1] = -a.elements[2];
@ -341,7 +343,7 @@ Mat3x3 CrossMat(Vect3& a){
// Stack
//
Matrix Stack(VirtualMatrix& A, VirtualMatrix& B){
Matrix POEMS::Stack(VirtualMatrix& A, VirtualMatrix& B){
int m,na,nb;
m = A.GetNumCols();
if( m != B.GetNumCols()){
@ -370,7 +372,7 @@ Matrix Stack(VirtualMatrix& A, VirtualMatrix& B){
//Hstack
Matrix HStack(VirtualMatrix& A, VirtualMatrix& B){
Matrix POEMS::HStack(VirtualMatrix& A, VirtualMatrix& B){
int m,na,nb;
m = A.GetNumRows();
if( m != B.GetNumRows()){
@ -400,13 +402,13 @@ Matrix HStack(VirtualMatrix& A, VirtualMatrix& B){
//
//
void Set6DAngularVector(Vect6& v6, Vect3& v3){
void POEMS::Set6DAngularVector(Vect6& v6, Vect3& v3){
v6.elements[0] = v3.elements[0];
v6.elements[1] = v3.elements[1];
v6.elements[2] = v3.elements[2];
}
void Set6DLinearVector(Vect6& v6, Vect3& v3){
void POEMS::Set6DLinearVector(Vect6& v6, Vect3& v3){
v6.elements[3] = v3.elements[0];
v6.elements[4] = v3.elements[1];
v6.elements[5] = v3.elements[2];

View File

@ -27,6 +27,7 @@
#include "vect3.h"
#include "vect6.h"
namespace POEMS {
class VirtualColMatrix;
class VirtualMatrix;
class VirtualRowMatrix;
@ -80,5 +81,5 @@ Matrix HStack(VirtualMatrix& A, VirtualMatrix& B);
void Set6DAngularVector(Vect6& v6, Vect3& v3);
void Set6DLinearVector(Vect6& v6, Vect3& v3);
}
#endif

View File

@ -29,6 +29,8 @@
#include "vect3.h"
#include "virtualmatrix.h"
using namespace POEMS;
using namespace std;
MixedJoint::MixedJoint(){

View File

@ -24,7 +24,7 @@
#include "matrix.h"
#include "vect6.h"
namespace POEMS {
class MixedJoint : public Joint{
Matrix const_sP;
int numrots;
@ -46,5 +46,5 @@ public:
void ForwardKinematics();
void BackwardKinematics();
};
}
#endif

View File

@ -24,6 +24,8 @@
#include "vect4.h"
#include "vect6.h"
using namespace POEMS;
double Magnitude(ColMatrix& A){
double G;
G = 0;

View File

@ -18,6 +18,7 @@
#ifndef NORM_H
#define NORM_H
namespace POEMS {
class ColMatrix;
class RowMatrix;
class Vect3;
@ -29,5 +30,5 @@ double Magnitude(RowMatrix& A);
double Magnitude(Vect3& A);
double Magnitude(Vect4& A);
double Magnitude(Vect6& A);
}
#endif

View File

@ -30,6 +30,8 @@
#include "colmatrix.h"
using namespace std;
using namespace POEMS;
OnBody::OnBody(){

View File

@ -26,6 +26,7 @@
#include "mat3x3.h"
#include "vect3.h"
namespace POEMS {
class Body;
class ColMatrix;
class InertialFrame;
@ -78,7 +79,6 @@ class OnBody {
// friend classes
friend class OnSolver;
public:
OnBody();
~OnBody();
@ -97,5 +97,5 @@ public:
void LocalTriangularization(Vect3& Torque, Vect3& Force);
void LocalForwardSubstitution();
};
}
#endif

View File

@ -25,9 +25,11 @@
#include "virtualmatrix.h"
using namespace std;
using namespace POEMS;
// friend of Vect3 & Vect6
void OnPopulateSVect(Vect3& angular, Vect3& linear, Vect6& sV){
void POEMS::OnPopulateSVect(Vect3& angular, Vect3& linear, Vect6& sV){
sV.elements[0] = angular.elements[0];
sV.elements[1] = angular.elements[1];
sV.elements[2] = angular.elements[2];
@ -37,7 +39,7 @@ void OnPopulateSVect(Vect3& angular, Vect3& linear, Vect6& sV){
}
// friend of Vect3, Mat3x3, & Mat6x6
void OnPopulateSC(Vect3& gamma, Mat3x3& C, Mat6x6& SC){
void POEMS::OnPopulateSC(Vect3& gamma, Mat3x3& C, Mat6x6& SC){
// the block diagonals
// the gamma cross with transform
@ -65,7 +67,7 @@ void OnPopulateSC(Vect3& gamma, Mat3x3& C, Mat6x6& SC){
}
// friend of Mat3x3 & Mat6x6
void OnPopulateSI(Mat3x3& inertia, double mass, Mat6x6& sI){
void POEMS::OnPopulateSI(Mat3x3& inertia, double mass, Mat6x6& sI){
sI(4,4)=mass; sI(5,5)=mass; sI(6,6)=mass;
sI(1,1)=inertia(1,1); sI(1,2)=inertia(1,2); sI(1,3)=inertia(1,3);

View File

@ -18,6 +18,7 @@
#ifndef ONFUNCTIONS_H
#define ONFUNCTIONS_H
namespace POEMS {
class Mat3x3;
class Mat6x6;
class Vect3;
@ -30,5 +31,5 @@ void OnPopulateSI(Mat3x3& inertia, double mass, Mat6x6& sI);
void Create_Map(int MM);
int ICELL(int IX,int IY,int IZ, int MM);
}
#endif

View File

@ -33,6 +33,8 @@
#include "virtualmatrix.h"
using namespace std;
using namespace POEMS;
OnSolver::OnSolver(){
numbodies = 0;

View File

@ -22,11 +22,10 @@
#include "solver.h"
#include "onbody.h"
namespace POEMS {
class ColMatrix;
class Matrix;
class OnSolver : public Solver {
OnBody inertialframe;
int numbodies;
@ -49,5 +48,5 @@ public:
void CreateModel();
void Solve(double time, Matrix& FF);
};
}
#endif

View File

@ -18,6 +18,8 @@
#include "particle.h"
using namespace POEMS;
Particle::Particle(){
}

View File

@ -23,7 +23,7 @@
#include "body.h"
namespace POEMS {
class Particle : public Body {
public:
Particle();
@ -32,5 +32,5 @@ public:
bool ReadInBodyData(std::istream& in);
void WriteOutBodyData(std::ostream& out);
};
}
#endif

View File

@ -21,8 +21,7 @@
#include <iostream>
#include <cstdlib>
using namespace std;
namespace POEMS {
template<class T> class ListElement{
public:
ListElement<T>* prev;
@ -110,11 +109,11 @@ template<class S> ListElement<S>* List<S>::GetTailElement(){
template<class S> void List<S>::Remove(ListElement<S>* ele){
if(!ele){
cerr << "ERROR: ListElement to be removed not defined" << endl;
std::cerr << "ERROR: ListElement to be removed not defined" << std::endl;
exit(0);
}
if(!numelements){
cerr << "ERROR: List is empty" << endl;
std::cerr << "ERROR: List is empty" << std::endl;
exit(0);
}
@ -135,7 +134,7 @@ template<class S> void List<S>::Remove(ListElement<S>* ele){
template<class S> ListElement<S>* List<S>::Append(S* v){
if(!v){
cerr << "ERROR: cannot add null Body to list" << endl;
std::cerr << "ERROR: cannot add null Body to list" << std::endl;
exit(0);
}
@ -160,7 +159,7 @@ template<class S> ListElement<S>* List<S>::Append(S* v){
template<class S> ListElement<S>* List<S>::Prepend(S* v){
if(!v){
cerr << "ERROR: cannot add null Body to list" << endl;
std::cerr << "ERROR: cannot add null Body to list" << std::endl;
exit(0);
}
@ -190,7 +189,7 @@ template<class S> S** List<S>::CreateArray(){
template<class S> S* List<S>::operator()(int id){
if(id >= numelements){
cerr << "ERROR: subscript out of bounds" << endl;
std::cerr << "ERROR: subscript out of bounds" << std::endl;
exit(0);
}
@ -214,16 +213,15 @@ template<class S> void List<S>::RemoveElementAndDeleteValue(ListElement<S>* ele)
}
template<class S> void List<S>::PrintList(){
cout<<"Printing List "<<endl;
std::cout << "Printing List " << std::endl;
ListElement<S>* ele = head;
cout<<*(ele->value)<<" ";
std::cout << *(ele->value) << " ";
ele = ele->next;
for(int k =2; k<numelements; k++){
cout<<*(ele->value)<<" ";
std::cout << *(ele->value) << " ";
ele = ele->next;
}
cout<<*(ele->value)<<endl;
std::cout << *(ele->value) << std::endl;
}
}
#endif

View File

@ -20,9 +20,7 @@
#include <iostream>
using namespace std;
namespace POEMS {
TreeNode *GetTreeNode(int item,TreeNode *lptr = NULL,TreeNode *rptr =NULL);
void FreeTreeNode(TreeNode *p);
@ -81,7 +79,7 @@ TreeNode *GetTreeNode(int item,TreeNode *lptr,TreeNode *rptr)
// if insufficient memory, terminatewith an error message
if (p == NULL)
{
cerr << "Memory allocation failure!\n";
std::cerr << "Memory allocation failure!\n";
exit(1);
}
@ -140,7 +138,7 @@ void IndentBlanks(int num)
// const int indentblock = 6;
for(int i = 0; i < num; i++)
cout << " ";
std::cout << " ";
}
void PrintTree (TreeNode *t, int level)
@ -153,10 +151,11 @@ void PrintTree (TreeNode *t, int level)
PrintTree(t->Right(),level + 1);
// indent to current level; output node data
IndentBlanks(indentUnit*level);
cout << t->GetData() << endl;
std::cout << t->GetData() << std::endl;
// print left branch of tree t
PrintTree(t->Left(),level + 1);
}
}
}
#endif

View File

@ -19,6 +19,8 @@
#include "poemsobject.h"
#include <cstring>
using namespace POEMS;
POEMSObject::POEMSObject(){
name = 0;
ChangeName((const char*)"unnamed");

View File

@ -19,7 +19,7 @@
#ifndef POEMSOBJECT_H
#define POEMSOBJECT_H
namespace POEMS {
class POEMSObject {
char* name;
int ID;
@ -31,5 +31,5 @@ public:
int GetID();
void SetID(int id);
};
}
#endif

View File

@ -21,7 +21,7 @@
#include "poemstreenode.h"
#include "poemsnodelib.h"
namespace POEMS {
// constants to indicate the balance factor of a node
const int leftheavy = -1;
const int balanced = 0;
@ -609,5 +609,5 @@ void Tree::ClearList(void)
delete current;
size = 0;
}
}
#endif

View File

@ -17,6 +17,8 @@
#include "poemstreenode.h"
using namespace POEMS;
// constructor; initialize the data and pointer fields
// The pointer value NULL assigns a empty subtree
TreeNode::TreeNode (const int & item, TreeNode *lptr,TreeNode *rptr,

View File

@ -18,6 +18,7 @@
#ifndef TREENODE_H
#define TREENODE_H
namespace POEMS {
// declares a tree node object for a binary tree
class TreeNode{
@ -41,6 +42,6 @@ public:
TreeNode(const int &item, TreeNode *lptr, TreeNode *rptr, int balfac = 0);
//friend class DCASolver;
};
}
#endif

View File

@ -20,6 +20,8 @@
#include "point.h"
#include "vect3.h"
using namespace POEMS;
Point::Point(){
position.Zeros();
}
@ -35,7 +37,7 @@ void Point::WriteOut(std::ostream& out){
WriteOutPointData(out);
}
Point* NewPoint(int type){
Point* POEMS::NewPoint(int type){
switch( PointType(type) )
{
case FIXEDPOINT : // A Fixed Point

View File

@ -22,7 +22,7 @@
#include "poemsobject.h"
#include "vect3.h"
namespace POEMS {
// emumerated type
enum PointType {
FIXEDPOINT = 0
@ -45,5 +45,5 @@ public:
// global point functions
Point* NewPoint(int type);
}
#endif

View File

@ -25,6 +25,8 @@
#include "mat3x3.h"
#include "virtualmatrix.h"
using namespace POEMS;
PrismaticJoint::PrismaticJoint(){
q.Dim(1);
qdot.Dim(1);

View File

@ -24,8 +24,7 @@
#include "vect3.h"
#include "matrix.h"
namespace POEMS {
class PrismaticJoint : public Joint {
Vect3 axis_pk; // unit vector in body1 basis
Vect3 axis_k; // unit vector in body2 basis
@ -45,5 +44,5 @@ public:
void ForwardKinematics();
void BackwardKinematics();
};
}
#endif

View File

@ -25,6 +25,8 @@
#include "mat3x3.h"
#include "virtualmatrix.h"
using namespace POEMS;
RevoluteJoint::RevoluteJoint(){
DimQandU(1);
Vect3 axis;

View File

@ -23,6 +23,7 @@
#include "vect3.h"
#include "matrix.h"
namespace POEMS {
class VirtualMatrix;
class RevoluteJoint : public Joint {
@ -44,5 +45,5 @@ public:
void ForwardKinematics();
void BackwardKinematics();
};
}
#endif

View File

@ -20,6 +20,8 @@
#include "virtualmatrix.h"
using namespace std;
using namespace POEMS;
RigidBody::RigidBody(){
}

View File

@ -22,6 +22,7 @@
#include "body.h"
namespace POEMS {
class RigidBody : public Body {
public:
RigidBody();
@ -30,5 +31,5 @@ public:
bool ReadInBodyData(std::istream& in);
void WriteOutBodyData(std::ostream& out);
};
}
#endif

View File

@ -21,6 +21,8 @@
#include <cstdlib>
using namespace std;
using namespace POEMS;
RowMatrix::RowMatrix(){
numcols = 0;

View File

@ -24,6 +24,7 @@
#include "virtualrowmatrix.h"
#include "virtualmatrix.h"
namespace POEMS {
class RowMatrix : public VirtualRowMatrix {
double* elements;
public:
@ -52,5 +53,5 @@ public:
RowMatrix& operator=(const VirtualMatrix& A); // overloaded =
RowMatrix& operator*=(double b);
};
}
#endif

View File

@ -20,6 +20,8 @@
#include "system.h"
#include "onsolver.h"
using namespace POEMS;
Solver::Solver(){
}

View File

@ -21,6 +21,7 @@
#include "colmatmap.h"
#include "defines.h"
namespace POEMS {
class System;
class Matrix;
@ -55,5 +56,5 @@ public:
ColMatMap* GetStateDerivative();
ColMatMap* GetStateDerivativeDerivative();
};
}
#endif

View File

@ -30,6 +30,8 @@
#include "vect3.h"
#include "virtualmatrix.h"
using namespace std;
using namespace POEMS;
SphericalJoint::SphericalJoint(){
DimQandU(4,3);

View File

@ -22,6 +22,7 @@
#include "joint.h"
#include "matrix.h"
namespace POEMS {
class SphericalJoint : public Joint {
Matrix const_sP;
public:
@ -38,5 +39,5 @@ public:
void ForwardKinematics();
void BackwardKinematics();
};
}
#endif

View File

@ -36,8 +36,9 @@
#include "vect3.h"
#include "virtualmatrix.h"
class Point;
namespace POEMS { class Point; }
using namespace std;
using namespace POEMS;
System::System(){
mappings = NULL;

View File

@ -22,6 +22,7 @@
#include <iostream>
#include "poemslist.h"
namespace POEMS {
class Body;
class Joint;
@ -65,5 +66,5 @@
void Create_DegenerateSystem(int& nfree, int*freelist, double *&masstotal, double **&inertia, double **&xcm, double **&vcm, double **&omega, double **&ex_space, double **&ey_space, double **&ez_space);
};
}
#endif

View File

@ -21,6 +21,8 @@
#include <iostream>
using namespace std;
using namespace POEMS;
Vect3::Vect3(){
numrows = 3; numcols = 1;

View File

@ -23,6 +23,7 @@
#include "virtualcolmatrix.h"
#include "virtualmatrix.h"
namespace POEMS {
class Matrix;
class Mat3x3;
class Mat6x6;
@ -82,7 +83,6 @@ public:
friend void FastMult(Mat3x3& A, ColMatrix& B, Vect3& C);
friend void FastAssign(ColMatrix&A, Vect3& C);
friend void FastMult(Mat3x3& A, Vect3& B, ColMatrix& C);
};
}
#endif

View File

@ -21,6 +21,8 @@
#include <iostream>
using namespace std;
using namespace POEMS;
Vect4::Vect4(){
numrows = 4; numcols = 1;

View File

@ -23,6 +23,7 @@
#include "virtualcolmatrix.h"
#include "virtualmatrix.h"
namespace POEMS {
class Matrix;
class Mat4x4;
@ -69,5 +70,5 @@ public:
friend void FastAdd(Vect4& A, Vect4& B, Vect4& C);
friend void FastSubt(Vect4& A, Vect4& B, Vect4& C);
};
}
#endif

View File

@ -21,6 +21,8 @@
#include <iostream>
using namespace std;
using namespace POEMS;
Vect6::Vect6(){
numrows = 6; numcols = 1;

View File

@ -23,6 +23,7 @@
#include "virtualcolmatrix.h"
#include "virtualmatrix.h"
namespace POEMS {
class Matrix;
class Mat6x6;
class ColMatrix;
@ -69,5 +70,5 @@ public:
friend void OnPopulateSVect(Vect3& angular, Vect3& linear, Vect6& sV);
};
}
#endif

View File

@ -20,6 +20,8 @@
#include <cstdlib>
using namespace std;
using namespace POEMS;
VirtualColMatrix::VirtualColMatrix(){
numcols = 1;

View File

@ -21,7 +21,7 @@
#include "virtualmatrix.h"
namespace POEMS {
class VirtualColMatrix : public VirtualMatrix {
public:
VirtualColMatrix();
@ -41,5 +41,5 @@ public:
virtual void BasicIncrement_1int(int i, double value) = 0;
};
}
#endif

View File

@ -21,6 +21,8 @@
#include <cstdlib>
using namespace std;
using namespace POEMS;
VirtualMatrix::VirtualMatrix(){
numrows = numcols = 0;
@ -140,14 +142,14 @@ istream& VirtualMatrix::ReadData(istream& c){
// operators and functions
//
ostream& operator<< (ostream& c, const VirtualMatrix& A){ //output
ostream& POEMS::operator<< (ostream& c, const VirtualMatrix& A){ //output
c << A.GetType() << ' ';
A.WriteData(c);
c << endl;
return c;
}
istream& operator>> (istream& c, VirtualMatrix& A){ //input
istream& POEMS::operator>> (istream& c, VirtualMatrix& A){ //input
VirtualMatrix* vm;
int matrixtype;
c >> matrixtype;

View File

@ -20,6 +20,7 @@
#define VIRTUALMATRIX_H
#include <iostream>
namespace POEMS {
enum MatrixType {
MATRIX = 0,
COLMATRIX = 1,
@ -83,5 +84,5 @@ protected:
// overloaded operators
std::ostream& operator<< (std::ostream& c, const VirtualMatrix& A); // output
std::istream& operator>> (std::istream& c, VirtualMatrix& A); // input
}
#endif

View File

@ -21,6 +21,8 @@
#include <cstdlib>
using namespace std;
using namespace POEMS;
VirtualRowMatrix::VirtualRowMatrix(){
numrows = 1;

View File

@ -21,6 +21,7 @@
#include "virtualmatrix.h"
namespace POEMS {
class VirtualRowMatrix : public VirtualMatrix {
public:
VirtualRowMatrix();
@ -39,5 +40,5 @@ public:
virtual void BasicSet_1int(int i, double value) = 0;
virtual void BasicIncrement_1int(int i, double value) = 0;
};
}
#endif

View File

@ -38,6 +38,8 @@
using namespace std;
using namespace POEMS;
void Workspace::allocateNewSystem() {
currentIndex++;

View File

@ -19,6 +19,7 @@
#ifndef WORKSPACE_H
#define WORKSPACE_H
namespace POEMS {
class System;
class Solver;
@ -75,5 +76,5 @@ public:
private:
void allocateNewSystem(); //helper function to handle vector resizing and such for the array of system pointers
};
}
#endif

View File

@ -20,7 +20,6 @@
#include "fix_poems.h"
#include <mpi.h>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include "workspace.h"
@ -30,7 +29,6 @@
#include "respa.h"
#include "modify.h"
#include "force.h"
#include "output.h"
#include "group.h"
#include "comm.h"
#include "citeme.h"
@ -265,7 +263,7 @@ FixPOEMS::FixPOEMS(LAMMPS *lmp, int narg, char **arg) :
// create POEMS instance
poems = new Workspace;
poems = new POEMS::Workspace;
// compute per body forces and torques inside final_integrate() by default

View File

@ -22,6 +22,7 @@ FixStyle(poems,FixPOEMS)
#include "fix.h"
namespace POEMS { class Workspace; }
namespace LAMMPS_NS {
class FixPOEMS : public Fix {
@ -94,7 +95,7 @@ class FixPOEMS : public Fix {
// POEMS object
class Workspace *poems;
POEMS::Workspace *poems;
// internal class functions