diff --git a/src/libclothBW/clothBW.cpp b/src/libclothBW/clothBW.cpp
index 8284e7741305642c59a128e298c2a24a9a16ffd9..296f4513432d87801f264de58e16690d7f11748d 100644
--- a/src/libclothBW/clothBW.cpp
+++ b/src/libclothBW/clothBW.cpp
@@ -38,6 +38,8 @@ using namespace std;
 #include "minivector.h"
 //#include "performanceCounter.h"
 
+namespace vega
+{
 // constructor without triangleUVs
 ClothBW::ClothBW(int numParticles_, double * masses_, double * restPositions_, int numTriangles_, int * triangles_, int * triangleGroups_, int numMaterialGroups_, double * groupTensileStiffness_, double * groupShearStiffness_, double * groupBendStiffnessU_, double * groupBendStiffnessV_, double * groupDamping_, int addGravity_) : bu(1.0), bv(1.0), addGravity(addGravity_), g(9.81)
 {
@@ -1451,4 +1453,4 @@ void ClothBW::AddBendStiffnessMatrix(double *u, SparseMatrix *K, int startQuad,
           }   
   }
 }
-
+}
diff --git a/src/libclothBW/clothBW.h b/src/libclothBW/clothBW.h
index f719b4121e21713b5a98d39a03d479b9124e8a5a..aba19539a4f7f03a560917471511e6fd7b947f99 100644
--- a/src/libclothBW/clothBW.h
+++ b/src/libclothBW/clothBW.h
@@ -38,6 +38,8 @@
 
 #include "sparseMatrix.h"
 
+namespace vega
+{
 class ClothBW
 {
 public:
@@ -158,6 +160,6 @@ protected:
   bool _computationConditions[4];
   int useRestAnglesForBendingForces;
 };
-
+}
 #endif
 
diff --git a/src/libclothBW/clothBWFromObjMesh.cpp b/src/libclothBW/clothBWFromObjMesh.cpp
index f59873e9b6cc11f98b4f49d5aa9f5d709c49893c..3b0df7ed73c5f2ff3173050db8a8351059eec4f6 100644
--- a/src/libclothBW/clothBWFromObjMesh.cpp
+++ b/src/libclothBW/clothBWFromObjMesh.cpp
@@ -30,6 +30,8 @@
 #include "clothBWFromObjMesh.h"
 using namespace std;
 
+namespace vega
+{
 int ClothBWFromObjMesh::GenerateClothBW(ObjMesh * mesh, ClothBW ** clothBW, double surfaceDensity, double tensileStiffness, double shearStiffness, double bendStiffnessU, double bendStiffnessV, double damping, int bu, int bv, int addGravity)
 {
   int numMaterialGroups = mesh->getNumMaterials();
@@ -117,3 +119,4 @@ int ClothBWFromObjMesh::GenerateClothBW(ObjMesh * mesh, ClothBW ** clothBW, int
   return 0;
 }
 
+}
diff --git a/src/libclothBW/clothBWFromObjMesh.h b/src/libclothBW/clothBWFromObjMesh.h
index 9e480a161bb94f485662dae3d043f1262ed37008..e8e21c46618e3918eedd533286be9c6ca619dd67 100644
--- a/src/libclothBW/clothBWFromObjMesh.h
+++ b/src/libclothBW/clothBWFromObjMesh.h
@@ -36,6 +36,8 @@
 #include "clothBW.h"
 #include "objMesh.h"
 
+namespace vega
+{
 class ClothBWFromObjMesh
 {
 public:
@@ -57,5 +59,5 @@ public:
 protected:
 };
 
+}
 #endif
-
diff --git a/src/libclothBW/clothBWMT.cpp b/src/libclothBW/clothBWMT.cpp
index 56ee56224d4423d4ef3ff694f9a716d00ee4ca6c..7fcf1e73b3ecb170b540745057bec4c98277aae3 100644
--- a/src/libclothBW/clothBWMT.cpp
+++ b/src/libclothBW/clothBWMT.cpp
@@ -33,6 +33,8 @@
 
 #include <pthread.h>
 
+namespace vega
+{
 ClothBWMT::ClothBWMT(int numParticles_, double * masses_, double * restPositions_, int numTriangles_,
                       int * triangles_, int * triangleGroups_, int numMaterialGroups_,
                        double * groupTensileStiffness_, double * groupShearStiffness_,
@@ -388,3 +390,4 @@ void ClothBWMT::ComputeHelper(enum ClothBWMT_computationTargetType computationTa
   }
 }
 
+}
diff --git a/src/libclothBW/clothBWMT.h b/src/libclothBW/clothBWMT.h
index d670146c417c53f05ae0c151905543014ade2a3f..923a5fd40f47b74b9cde2df58049c251d6447b7f 100644
--- a/src/libclothBW/clothBWMT.h
+++ b/src/libclothBW/clothBWMT.h
@@ -36,6 +36,8 @@
 
 #include "clothBW.h"
 
+namespace vega
+{
 enum ClothBWMT_computationTargetType { STRETCH_SHEAR_FORCE, BEND_FORCE, STRETCH_SHEAR_STIFFNESS, BEND_STIFFNESS };
 
 class ClothBWMT : public ClothBW
@@ -101,6 +103,6 @@ protected:
   void ComputeHelper(enum ClothBWMT_computationTargetType computationTarget, double * u, double * uSecondary, void * target, bool addQuantity);
   
 };
-
+}
 #endif
 
diff --git a/src/libconfigFile/configFile.cpp b/src/libconfigFile/configFile.cpp
index 4200400e0929c0597064bd0d896c5c4965491b50..9cda7c5f3ca8598b289354faa470b97b3d668e1a 100644
--- a/src/libconfigFile/configFile.cpp
+++ b/src/libconfigFile/configFile.cpp
@@ -31,6 +31,8 @@
 #include <stdlib.h>
 #include "configFile.h"
 
+namespace vega
+{
 #define OPT_INT 0
 #define OPT_BOOL 1
 #define OPT_FLOAT 2
@@ -418,3 +420,4 @@ template int ConfigFile::addOptionOptional<bool>(const char * optionName, bool *
 template int ConfigFile::addOptionOptional<int>(const char * optionName, int * destLocation, int defaultValue);
 template int ConfigFile::addOptionOptional<float>(const char * optionName, float * destLocation, float defaultValue);
 template int ConfigFile::addOptionOptional<double>(const char * optionName, double * destLocation, double defaultValue);
+}
diff --git a/src/libconfigFile/configFile.h b/src/libconfigFile/configFile.h
index 4599ebae4c81a890b4b2183da19b629d920cdf4d..a1c6aa810563df34fada2c63a56341cdcbbd2136 100644
--- a/src/libconfigFile/configFile.h
+++ b/src/libconfigFile/configFile.h
@@ -62,6 +62,8 @@
 #include <vector>
 #include <string>
 
+namespace vega
+{
 class ConfigFile
 {
 public:
@@ -118,6 +120,6 @@ protected:
 
   int suppressWarnings_;
 };
-
+}
 #endif
 
diff --git a/src/libcorotationalLinearFEM/corotationalLinearFEM.cpp b/src/libcorotationalLinearFEM/corotationalLinearFEM.cpp
index 037c65fd4248798dd7f055fb5b60bdb7f04c9194..e7fc8925de51c92ca9a167bef48796084e975be0 100644
--- a/src/libcorotationalLinearFEM/corotationalLinearFEM.cpp
+++ b/src/libcorotationalLinearFEM/corotationalLinearFEM.cpp
@@ -35,6 +35,8 @@
 #include "mat3d.h"
 #include "volumetricMeshENuMaterial.h"
 
+namespace vega
+{
 CorotationalLinearFEM::CorotationalLinearFEM(TetMesh * tetMesh_) : tetMesh(tetMesh_) 
 {
   numVertices = tetMesh->getNumVertices();
@@ -567,3 +569,4 @@ void CorotationalLinearFEM::inverse4x4(double * A, double * AInv)
     AInv[i] *= invDet;
 }
 
+}
diff --git a/src/libcorotationalLinearFEM/corotationalLinearFEM.h b/src/libcorotationalLinearFEM/corotationalLinearFEM.h
index e4ada93051033e1202b59dc39eafe8ef24a23d3e..61700ca056e7f4e3cc73e9aa4e068f67f03057df 100644
--- a/src/libcorotationalLinearFEM/corotationalLinearFEM.h
+++ b/src/libcorotationalLinearFEM/corotationalLinearFEM.h
@@ -49,6 +49,8 @@
 #include "tetMesh.h"
 #include "sparseMatrix.h"
 
+namespace vega
+{
 class CorotationalLinearFEM
 {
 public:
@@ -95,6 +97,6 @@ protected:
   double * lambdaLame;
   double * muLame;
 };
-
+}
 #endif
 
diff --git a/src/libcorotationalLinearFEM/corotationalLinearFEMMT.cpp b/src/libcorotationalLinearFEM/corotationalLinearFEMMT.cpp
index 41389567e103ca14abc4dd23abc07da13995fc8e..53ea64f43eb0d1b8c09cbcb1bdd034dba84c11c0 100644
--- a/src/libcorotationalLinearFEM/corotationalLinearFEMMT.cpp
+++ b/src/libcorotationalLinearFEM/corotationalLinearFEMMT.cpp
@@ -37,6 +37,8 @@
 #include "corotationalLinearFEMMT.h"
 using namespace std;
 
+namespace vega
+{
 CorotationalLinearFEMMT::CorotationalLinearFEMMT(TetMesh * tetMesh, int numThreads_) : CorotationalLinearFEM(tetMesh), numThreads(numThreads_)
 {
   Initialize();
@@ -183,4 +185,4 @@ int CorotationalLinearFEMMT::GetEndElement(int rank)
 {
   return endElement[rank];
 }
-
+}
diff --git a/src/libcorotationalLinearFEM/corotationalLinearFEMMT.h b/src/libcorotationalLinearFEM/corotationalLinearFEMMT.h
index cd549ed776ca27cf8682566e19f871cea1584662..8b92420bef0b460212d1b6ec0746987b4eabf9c3 100644
--- a/src/libcorotationalLinearFEM/corotationalLinearFEMMT.h
+++ b/src/libcorotationalLinearFEM/corotationalLinearFEMMT.h
@@ -31,6 +31,8 @@
 
 #include "corotationalLinearFEM.h"
 
+namespace vega
+{
 /*
    Multi-threaded version of the CorotationalLinearFEM class. 
    It uses the POSIX threads ("pthreads").
@@ -59,6 +61,6 @@ protected:
   void ComputeHelper(double * u, double * uSecondary, void * target, bool addQuantity);
 
 };
-
+}
 #endif
 
diff --git a/src/libelasticForceModel/StVKForceModel.cpp b/src/libelasticForceModel/StVKForceModel.cpp
index b5a7d6de6300a727d0659f10dc5e7dda6a06740d..e4d12361ea1325cdbff9e94c4396a92821ae470a 100644
--- a/src/libelasticForceModel/StVKForceModel.cpp
+++ b/src/libelasticForceModel/StVKForceModel.cpp
@@ -28,6 +28,8 @@
 
 #include "StVKForceModel.h"
 
+namespace vega
+{
 StVKForceModel::StVKForceModel(StVKInternalForces * stVKInternalForces_, StVKStiffnessMatrix * stVKStiffnessMatrix_): stVKInternalForces(stVKInternalForces_), stVKStiffnessMatrix(stVKStiffnessMatrix_)
 {
   r = 3 * stVKInternalForces->GetVolumetricMesh()->getNumVertices();
@@ -60,3 +62,4 @@ void StVKForceModel::GetTangentStiffnessMatrix(double * u, SparseMatrix * tangen
   stVKStiffnessMatrix->ComputeStiffnessMatrix(u, tangentStiffnessMatrix);
 } 
 
+}
diff --git a/src/libelasticForceModel/StVKForceModel.h b/src/libelasticForceModel/StVKForceModel.h
index 1586d82c2fb2f266e4e081bd0948a522f5b60f7d..b8d9aac307798aadb0d8aa98677feb4e681afe19 100644
--- a/src/libelasticForceModel/StVKForceModel.h
+++ b/src/libelasticForceModel/StVKForceModel.h
@@ -37,6 +37,8 @@
 #include "StVKStiffnessMatrix.h"
 #include "forceModel.h"
 
+namespace vega
+{
 class StVKForceModel : virtual public ForceModel
 {
 public:
@@ -52,6 +54,6 @@ protected:
   StVKStiffnessMatrix * stVKStiffnessMatrix;
   bool ownStiffnessMatrix;
 };
-
+}
 #endif
 
diff --git a/src/libelasticForceModel/corotationalLinearFEMForceModel.cpp b/src/libelasticForceModel/corotationalLinearFEMForceModel.cpp
index cd19e1d2258b3a5eadab7132979658a8c06ff526..462a7d323a8b9823474cda601b0533edeb2050e8 100644
--- a/src/libelasticForceModel/corotationalLinearFEMForceModel.cpp
+++ b/src/libelasticForceModel/corotationalLinearFEMForceModel.cpp
@@ -28,6 +28,8 @@
 
 #include "corotationalLinearFEMForceModel.h"
 
+namespace vega
+{
 CorotationalLinearFEMForceModel::CorotationalLinearFEMForceModel(CorotationalLinearFEM * corotationalLinearFEM_, int warp_): corotationalLinearFEM(corotationalLinearFEM_), warp(warp_)
 {
   r = 3 * corotationalLinearFEM->GetTetMesh()->getNumVertices();
@@ -55,3 +57,4 @@ void CorotationalLinearFEMForceModel::GetForceAndMatrix(double * u, double * int
   corotationalLinearFEM->ComputeForceAndStiffnessMatrix(u, internalForces, tangentStiffnessMatrix, warp);
 }
 
+}
diff --git a/src/libelasticForceModel/corotationalLinearFEMForceModel.h b/src/libelasticForceModel/corotationalLinearFEMForceModel.h
index 8e8a0d8e827c56ed4bc542b86f0f6f871da8f905..706f65e7864065c68fa8b12e76dea611bff58817 100644
--- a/src/libelasticForceModel/corotationalLinearFEMForceModel.h
+++ b/src/libelasticForceModel/corotationalLinearFEMForceModel.h
@@ -36,6 +36,8 @@
 #include "corotationalLinearFEM.h"
 #include "forceModel.h"
 
+namespace vega
+{
 class CorotationalLinearFEMForceModel : virtual public ForceModel
 {
 public:
@@ -54,6 +56,6 @@ protected:
   CorotationalLinearFEM * corotationalLinearFEM;
   int warp;
 };
-
+}
 #endif
 
diff --git a/src/libelasticForceModel/isotropicHyperelasticFEMForceModel.cpp b/src/libelasticForceModel/isotropicHyperelasticFEMForceModel.cpp
index c5f6cbf51566b516389e87e4f47810678377203a..257ff2f2581e37f46a7e59280fd876d48e211f6b 100644
--- a/src/libelasticForceModel/isotropicHyperelasticFEMForceModel.cpp
+++ b/src/libelasticForceModel/isotropicHyperelasticFEMForceModel.cpp
@@ -28,6 +28,8 @@
 
 #include "isotropicHyperelasticFEMForceModel.h"
 
+namespace vega
+{
 IsotropicHyperelasticFEMForceModel::IsotropicHyperelasticFEMForceModel(IsotropicHyperelasticFEM * isotropicHyperelasticFEM_): isotropicHyperelasticFEM(isotropicHyperelasticFEM_)
 {
   r = 3 * isotropicHyperelasticFEM->GetTetMesh()->getNumVertices();
@@ -55,3 +57,4 @@ void IsotropicHyperelasticFEMForceModel::GetForceAndMatrix(double * u, double *
   isotropicHyperelasticFEM->GetForceAndTangentStiffnessMatrix(u, internalForces, tangentStiffnessMatrix);
 }
 
+}
diff --git a/src/libelasticForceModel/isotropicHyperelasticFEMForceModel.h b/src/libelasticForceModel/isotropicHyperelasticFEMForceModel.h
index 4bc1a6a2433091a2fa19004da5362540d6e5e8df..3bccc0b1a85fd66425535fbf755cf978af7e3ecd 100644
--- a/src/libelasticForceModel/isotropicHyperelasticFEMForceModel.h
+++ b/src/libelasticForceModel/isotropicHyperelasticFEMForceModel.h
@@ -36,6 +36,8 @@
 #include "isotropicHyperelasticFEM.h"
 #include "forceModel.h"
 
+namespace vega
+{
 class IsotropicHyperelasticFEMForceModel : virtual public ForceModel
 {
 public:
@@ -51,6 +53,6 @@ public:
 protected:
   IsotropicHyperelasticFEM * isotropicHyperelasticFEM;
 };
-
+}
 #endif
 
diff --git a/src/libelasticForceModel/linearFEMForceModel.cpp b/src/libelasticForceModel/linearFEMForceModel.cpp
index fce8c3f3b66077067f14908905f51a4d3cb39ff7..de42591a5929cddea03c69656b81e77a7ca5f750 100644
--- a/src/libelasticForceModel/linearFEMForceModel.cpp
+++ b/src/libelasticForceModel/linearFEMForceModel.cpp
@@ -29,6 +29,8 @@
 #include "linearFEMForceModel.h"
 #include "StVKStiffnessMatrix.h"
 
+namespace vega
+{
 LinearFEMForceModel::LinearFEMForceModel(StVKInternalForces * stVKInternalForces) 
 {
   StVKStiffnessMatrix * stVKStiffnessMatrix = new StVKStiffnessMatrix(stVKInternalForces);
@@ -57,5 +59,6 @@ void LinearFEMForceModel::GetTangentStiffnessMatrixTopology(SparseMatrix ** tang
 void LinearFEMForceModel::GetTangentStiffnessMatrix(double * u, SparseMatrix * tangentStiffnessMatrix)
 {
   *tangentStiffnessMatrix = *K;
-} 
+}
 
+}
diff --git a/src/libelasticForceModel/linearFEMForceModel.h b/src/libelasticForceModel/linearFEMForceModel.h
index 4f1bf996c4c37605cd9287a5b20da514bd706dd1..84a52c5564d3273be715e744fb2256db0d673357 100644
--- a/src/libelasticForceModel/linearFEMForceModel.h
+++ b/src/libelasticForceModel/linearFEMForceModel.h
@@ -38,6 +38,8 @@
 #include "StVKInternalForces.h"
 #include "forceModel.h"
 
+namespace vega
+{
 class LinearFEMForceModel : public ForceModel
 {
 public:
@@ -51,6 +53,6 @@ public:
 protected:
   SparseMatrix * K;
 };
-
+}
 #endif
 
diff --git a/src/libelasticForceModel/massSpringSystemForceModel.cpp b/src/libelasticForceModel/massSpringSystemForceModel.cpp
index fbcd9695679247984db0ff5987160f4f5a50d2c7..8d73deaec6234d5e0e43b25ec888fee7c76c0a20 100644
--- a/src/libelasticForceModel/massSpringSystemForceModel.cpp
+++ b/src/libelasticForceModel/massSpringSystemForceModel.cpp
@@ -28,6 +28,8 @@
 
 #include "massSpringSystemForceModel.h"
 
+namespace vega
+{
 MassSpringSystemForceModel::MassSpringSystemForceModel(MassSpringSystem * massSpringSystem_): massSpringSystem(massSpringSystem_)
 { 
   r = 3 * massSpringSystem->GetNumParticles(); 
@@ -48,3 +50,4 @@ void MassSpringSystemForceModel::GetTangentStiffnessMatrix(double * u, SparseMat
   massSpringSystem->ComputeStiffnessMatrix(u, tangentStiffnessMatrix);
 } 
 
+}
diff --git a/src/libelasticForceModel/massSpringSystemForceModel.h b/src/libelasticForceModel/massSpringSystemForceModel.h
index c2881907096b58823f3ce2be178093f2d5c4bfdc..f8450c6939c24ac9120dca6eace13cd461dbd2f3 100644
--- a/src/libelasticForceModel/massSpringSystemForceModel.h
+++ b/src/libelasticForceModel/massSpringSystemForceModel.h
@@ -36,6 +36,8 @@
 #include "massSpringSystem.h"
 #include "forceModel.h"
 
+namespace vega
+{
 class MassSpringSystemForceModel : public virtual ForceModel
 {
 public:
@@ -48,6 +50,6 @@ public:
 protected:
   MassSpringSystem * massSpringSystem;
 };
-
+}
 #endif
 
diff --git a/src/libforceModel/forceModel.cpp b/src/libforceModel/forceModel.cpp
index ec5d4b7aabc3fc50d6b9cc55ece7d3eb1e166f15..5930d722a864ed9ae165a957d77837fa0b83eb81 100644
--- a/src/libforceModel/forceModel.cpp
+++ b/src/libforceModel/forceModel.cpp
@@ -32,6 +32,8 @@
 #include <math.h>
 #include "forceModel.h"
 
+namespace vega
+{
 ForceModel::~ForceModel()
 {
 }
@@ -105,3 +107,4 @@ void ForceModel::TestStiffnessMatrix(double * q, double * dq)
   free(dqeps);
   free(q1);
 }
+}
diff --git a/src/libforceModel/forceModel.h b/src/libforceModel/forceModel.h
index 7b976860614c3101692231a9c23085470a6f602f..662f02d2a3a5d4a61a5426e32cf917db95ea11f6 100644
--- a/src/libforceModel/forceModel.h
+++ b/src/libforceModel/forceModel.h
@@ -37,6 +37,8 @@
 #include <stdlib.h>
 #include "sparseMatrix.h"
 
+namespace vega
+{
 class ForceModel
 {
 public:
@@ -63,6 +65,6 @@ public:
 protected:
   int r;
 };
-
+}
 #endif
 
diff --git a/src/libgraph/graph.cpp b/src/libgraph/graph.cpp
index c228711b35147f91e5128d0ec88e404b2a01ffd9..daa5f6e5d95ed3331421c9ee04dbf791e9c9e43b 100644
--- a/src/libgraph/graph.cpp
+++ b/src/libgraph/graph.cpp
@@ -34,6 +34,8 @@ using namespace std;
 #include "matrixIO.h"
 #include "graph.h"
 
+namespace vega
+{
 Graph::Graph() 
 { 
   numVertices = 0; 
@@ -415,3 +417,4 @@ void Graph::ShortestPath(std::set<int> & seedVertices, std::vector<int> & distan
   }
 }
 
+}
diff --git a/src/libgraph/graph.h b/src/libgraph/graph.h
index daf458c1903dc84c80022e628476bd5015cc7df3..75f93705fbbfe5510214a3f35b42ef5eadcc7615 100755
--- a/src/libgraph/graph.h
+++ b/src/libgraph/graph.h
@@ -34,6 +34,8 @@
 #include <map>
 #include "sparseMatrix.h"
 
+namespace vega
+{
 /*
   A class to store a graph (nodes connected with edges).
 */
@@ -114,6 +116,6 @@ inline int Graph::GetNeighbor(int vertex, int i)
 {
   return vertexNeighborsVector[vertex][i];
 }
-
+}
 #endif
 
diff --git a/src/libhashTable/hashTable.cpp b/src/libhashTable/hashTable.cpp
index 0133c51188f94cb34524d370b526b62e2de89b9e..7116dd33f8c52bd9a9617a52cd01d950bcaf291e 100644
--- a/src/libhashTable/hashTable.cpp
+++ b/src/libhashTable/hashTable.cpp
@@ -32,6 +32,8 @@
 #include <set>
 using namespace std;
 
+namespace vega
+{
 template<class Data>
 HashTable<Data>::HashTable(unsigned int suggestedSize)
 {
@@ -197,3 +199,4 @@ template bool HashTable<int>::contains(unsigned int key, int & data);
 template void HashTable<int>::erase(unsigned int key);
 template int * HashTable<int>::find(unsigned int key);
 template void HashTable<int>::printInfo();
+}
diff --git a/src/libhashTable/hashTable.h b/src/libhashTable/hashTable.h
index 4d194a96545d5e9593fd7b8c7dad5bd0e44ffa42..b9b861db15830d5f1de33f00b19bfa12b6c22f86 100644
--- a/src/libhashTable/hashTable.h
+++ b/src/libhashTable/hashTable.h
@@ -41,6 +41,8 @@
 #include <vector>
 #include <list>
 
+namespace vega
+{
 template<class Data>
 class HashTable
 {
@@ -78,6 +80,6 @@ inline unsigned int HashTable<Data>::hashFunction(unsigned int key)
 {
   return (key*(key+3) % p);
 }
-
+}
 #endif
 
diff --git a/src/libimageIO/imageIO.cpp b/src/libimageIO/imageIO.cpp
index 609d02e68b3a3ccec8562ff872874fb2752f0171..de08a1440afcb9b5f86b172f0b06e562404de5cb 100644
--- a/src/libimageIO/imageIO.cpp
+++ b/src/libimageIO/imageIO.cpp
@@ -65,6 +65,8 @@ extern "C"
 
 #include "imageIO.h"
 
+namespace vega
+{
 #define BITS_PER_CHANNEL_8 8
 #define BITS_PER_CHANNEL_16 16
 #define IMAGE_IO_RGB 3
@@ -1028,3 +1030,4 @@ void ImageIO::flipVertically()
   free(rowBuffer);
 }
 
+}
diff --git a/src/libimageIO/imageIO.h b/src/libimageIO/imageIO.h
index 4ed304f8033cb15e31db8ed7476a3c5e49886867..81c119e44777e895ab6ffac8359973ac02ff1616 100644
--- a/src/libimageIO/imageIO.h
+++ b/src/libimageIO/imageIO.h
@@ -38,6 +38,8 @@
 #ifndef _IMAGEIO_H_
 #define _IMAGEIO_H_
 
+namespace vega
+{
 class ImageIO
 {
 public:
@@ -101,6 +103,6 @@ protected:
   errorType loadNONE(const char * filename);
   errorType saveNONE(const char * filename);
 };
-
+}
 #endif
 
diff --git a/src/libinsertRows/insertRows.cpp b/src/libinsertRows/insertRows.cpp
index 58b46e08d00c5c970ac219e01cb396c32c9f28b0..35700e429758f568683ebde11ecd43f0f56e246e 100644
--- a/src/libinsertRows/insertRows.cpp
+++ b/src/libinsertRows/insertRows.cpp
@@ -25,6 +25,8 @@
 #include "stdio.h"
 #include "stdlib.h"
 
+namespace vega
+{
 void InsertRows(int mFull, double * xConstrained, double * x, int numFixedRows, int * fixedRows, int oneIndexed)
 {
   int destRow = 0; // current row in the dest matrix
@@ -150,3 +152,4 @@ void FullDOFsToConstrainedDOFs(int mFull, int numDOFs, int * DOFsConstrained, in
   }
 }
 
+}
diff --git a/src/libinsertRows/insertRows.h b/src/libinsertRows/insertRows.h
index e0d04e901ae7d7d937960dfd779fe270827cf52a..210c3d8c7af0b7edaec5a9833a22949fe1332c12 100755
--- a/src/libinsertRows/insertRows.h
+++ b/src/libinsertRows/insertRows.h
@@ -24,6 +24,8 @@
 #ifndef _INSERT_ROWS_H_
 #define _INSERT_ROWS_H_
 
+namespace vega
+{
 /*
   Insert or remove given components from a linear array.
   The dynamic solver uses these routines to fix the specified vertices and remove
@@ -49,6 +51,6 @@ void RemoveRows(int mFull, double * xConstrained, double * x, int numFixedRows,
 // output: DOFsConstrained (0-indexed)
 // oneIndexed applies only to fixedRows array, NOT to DOFsConstrained or DOFs
 void FullDOFsToConstrainedDOFs(int mFull, int numDOFs, int * DOFsConstrained, int * DOFs, int numFixedRows, int * fixedRows, int oneIndexed=0); 
-
+}
 #endif
 
diff --git a/src/libintegrator/getIntegratorSolver.cpp b/src/libintegrator/getIntegratorSolver.cpp
index a6fdcea8c0fc61ee9f3361a3378a4a3a19e5162e..49f1fffb145b72f5ad7469329ba72d44e8d5a582 100644
--- a/src/libintegrator/getIntegratorSolver.cpp
+++ b/src/libintegrator/getIntegratorSolver.cpp
@@ -1,6 +1,8 @@
 #include <string.h>
 #include "integratorSolverSelection.h"
 
+namespace vega
+{
 // returns the string corresponding to the selected integrator solver
 void GetIntegratorSolver(char * solver)
 {
@@ -19,3 +21,4 @@ void GetIntegratorSolver(char * solver)
   #endif
 }
 
+}
diff --git a/src/libintegrator/getIntegratorSolver.h b/src/libintegrator/getIntegratorSolver.h
index 8ea45aafefe9fa40114163172ea767157265d9e1..24f7ffc6afba9980f1d2f556b824e15caad7d85d 100644
--- a/src/libintegrator/getIntegratorSolver.h
+++ b/src/libintegrator/getIntegratorSolver.h
@@ -1,10 +1,12 @@
 #ifndef _GETINTEGRATORSOLVER_H_
 #define _GETINTEGRATORSOLVER_H_
 
+namespace vega
+{
 // returns the string corresponding to the selected integrator solver
 // "solver" must be pre-allocated
 // result: PARDISO, SPOOLES or PCG
 void GetIntegratorSolver(char * solver);
- 
+}
 #endif
 
diff --git a/src/libintegrator/integratorBase.cpp b/src/libintegrator/integratorBase.cpp
index edfa239ab7b964731a900204cc0521179a8b512f..4c1396070906bca5a357359a85379c9314cf8df0 100644
--- a/src/libintegrator/integratorBase.cpp
+++ b/src/libintegrator/integratorBase.cpp
@@ -33,6 +33,8 @@
 #include <string.h>
 #include <float.h>
 
+namespace vega
+{
 IntegratorBase::IntegratorBase(int r, double timestep, double dampingMassCoef, double dampingStiffnessCoef)
 {
   this->r = r;
@@ -129,3 +131,4 @@ void IntegratorBase::ResetToRest()
   memset(qaccel_1,0,sizeof(double)*r);
 }
 
+}
diff --git a/src/libintegrator/integratorBase.h b/src/libintegrator/integratorBase.h
index 22b43cd63c76f5e4e0800fdeaa5bddce027d76d6..a5f5f6347d0260fc6478351fc350c966ac6f271c 100755
--- a/src/libintegrator/integratorBase.h
+++ b/src/libintegrator/integratorBase.h
@@ -100,6 +100,8 @@ Both publications are available online at www.jernejbarbic.com .
 
 #include <stdlib.h>
 
+namespace vega
+{
 // This abstract class is derived into: IntegratorBaseDense (dense systems)
 // and ImplicitNewmarkSparse ((large) sparse systems).
 class IntegratorBase
@@ -203,6 +205,6 @@ protected:
 
   double timestep;
 };
-
+}
 #endif
 
diff --git a/src/libintegratorSparse/centralDifferencesSparse.cpp b/src/libintegratorSparse/centralDifferencesSparse.cpp
index 150c4e6ce58f706a9cf275614552a76d778dea2e..fb60fff01f3383ebde0d138a6339c0c6d1ffdec7 100644
--- a/src/libintegratorSparse/centralDifferencesSparse.cpp
+++ b/src/libintegratorSparse/centralDifferencesSparse.cpp
@@ -36,6 +36,8 @@
 #include "insertRows.h"
 #include "centralDifferencesSparse.h"
 
+namespace vega
+{
 CentralDifferencesSparse::CentralDifferencesSparse(int numDOFs, double timestep, SparseMatrix * massMatrix_, ForceModel * forceModel_, int numConstrainedDOFs, int * constrainedDOFs, double dampingMassCoef, double dampingStiffnessCoef, int tangentialDampingMode_, int numSolverThreads_): IntegratorBaseSparse(numDOFs, timestep, massMatrix_, forceModel_, numConstrainedDOFs, constrainedDOFs, dampingMassCoef, dampingStiffnessCoef), tangentialDampingMode(tangentialDampingMode_), numSolverThreads(numSolverThreads_), timestepIndex(0)
 {
   rhs = (double*) malloc (sizeof(double) * r);
@@ -204,3 +206,4 @@ SparseMatrix* CentralDifferencesSparse::GetSystemMatrix() const
   return this->systemMatrix;
 }
 
+}
diff --git a/src/libintegratorSparse/centralDifferencesSparse.h b/src/libintegratorSparse/centralDifferencesSparse.h
index b2552403e9be07c999b0dcaf1198de639b197b83..d4da4c46a0976093d2542d965e3955f012955d3b 100644
--- a/src/libintegratorSparse/centralDifferencesSparse.h
+++ b/src/libintegratorSparse/centralDifferencesSparse.h
@@ -76,6 +76,8 @@ See also integratorBase.h .
   #include "CGSolver.h"
 #endif
 
+namespace vega
+{
 class CentralDifferencesSparse : public IntegratorBaseSparse
 {
 public:
@@ -131,3 +133,4 @@ protected:
 
 #endif
 
+}
diff --git a/src/libintegratorSparse/eulerSparse.cpp b/src/libintegratorSparse/eulerSparse.cpp
index bf3ec585aa0ae25c83d503d7ee5b400d6e34a424..1c83d0013ef65bd45965eecabcccd401e94893d6 100644
--- a/src/libintegratorSparse/eulerSparse.cpp
+++ b/src/libintegratorSparse/eulerSparse.cpp
@@ -35,6 +35,8 @@
 #include "insertRows.h"
 #include "eulerSparse.h"
 
+namespace vega
+{
 EulerSparse::EulerSparse(int r, double timestep, SparseMatrix * massMatrix_, ForceModel * forceModel_, int symplectic_, int numConstrainedDOFs_, int * constrainedDOFs_, double dampingMassCoef): IntegratorBaseSparse(r, timestep, massMatrix_, forceModel_, numConstrainedDOFs_, constrainedDOFs_, dampingMassCoef, 0.0), symplectic(symplectic_)
 {
 
@@ -147,3 +149,4 @@ int EulerSparse::DoTimestep()
   return 0;
 }
 
+}
diff --git a/src/libintegratorSparse/eulerSparse.h b/src/libintegratorSparse/eulerSparse.h
index 7c2855151a95ee8623aea03cf1d3dce1506d8f1c..d1ca7516ff6bb79abe2fe76f6e253efdd17924fd 100644
--- a/src/libintegratorSparse/eulerSparse.h
+++ b/src/libintegratorSparse/eulerSparse.h
@@ -55,6 +55,8 @@
 #endif
 
 
+namespace vega
+{
 class EulerSparse : public IntegratorBaseSparse
 {
 public:
@@ -76,6 +78,6 @@ protected:
   int symplectic;
 
 };
-
+}
 #endif
 
diff --git a/src/libintegratorSparse/implicitBackwardEulerSparse.cpp b/src/libintegratorSparse/implicitBackwardEulerSparse.cpp
index d3fae3fbd2b0fa782200b0595ac6c5aa02b282a5..a23985f3cd217f81e1097524f19318ca1c50ffce 100644
--- a/src/libintegratorSparse/implicitBackwardEulerSparse.cpp
+++ b/src/libintegratorSparse/implicitBackwardEulerSparse.cpp
@@ -41,6 +41,8 @@
 #include "implicitBackwardEulerSparse.h"
 #include "linearSolver.h"
 
+namespace vega
+{
 ImplicitBackwardEulerSparse::ImplicitBackwardEulerSparse(int r, double timestep, SparseMatrix * massMatrix_, ForceModel * forceModel_, int positiveDefiniteSolver_, int numConstrainedDOFs_, int * constrainedDOFs_, double dampingMassCoef, double dampingStiffnessCoef, int maxIterations, double epsilon, int numSolverThreads_): ImplicitNewmarkSparse(r, timestep, massMatrix_, forceModel_, positiveDefiniteSolver_, numConstrainedDOFs_, constrainedDOFs_, dampingMassCoef, dampingStiffnessCoef, maxIterations, epsilon, 0.25, 0.5, numSolverThreads_)
 {
 }
@@ -287,3 +289,4 @@ int ImplicitBackwardEulerSparse::DoTimestep()
   return 0;
 }
 
+}
diff --git a/src/libintegratorSparse/implicitBackwardEulerSparse.h b/src/libintegratorSparse/implicitBackwardEulerSparse.h
index 3c21088ebd101e2d66d6e26bfe2380863e92a2ce..37bdae01994a0c751fd946b43fac830727274e41 100644
--- a/src/libintegratorSparse/implicitBackwardEulerSparse.h
+++ b/src/libintegratorSparse/implicitBackwardEulerSparse.h
@@ -35,6 +35,8 @@
 
 #include "implicitNewmarkSparse.h"
 
+namespace vega
+{
 class ImplicitBackwardEulerSparse : public ImplicitNewmarkSparse
 {
 public:
@@ -53,6 +55,6 @@ public:
 
 protected:
 };
-
+}
 #endif
 
diff --git a/src/libintegratorSparse/implicitNewmarkSparse.cpp b/src/libintegratorSparse/implicitNewmarkSparse.cpp
index fd5382c0d8e786e3f3a9956156e04e2fa88a6fe7..93ba3df932245099361591977dd27467caa8b05a 100644
--- a/src/libintegratorSparse/implicitNewmarkSparse.cpp
+++ b/src/libintegratorSparse/implicitNewmarkSparse.cpp
@@ -36,6 +36,8 @@
 #include "implicitNewmarkSparse.h"
 #include "linearSolver.h"
 
+namespace vega
+{
 ImplicitNewmarkSparse::ImplicitNewmarkSparse(int r, double timestep, SparseMatrix * massMatrix_, ForceModel * forceModel_, int positiveDefiniteSolver_, int numConstrainedDOFs_, int * constrainedDOFs_, double dampingMassCoef, double dampingStiffnessCoef, int maxIterations, double epsilon, double NewmarkBeta, double NewmarkGamma, int numSolverThreads_): IntegratorBaseSparse(r, timestep, massMatrix_, forceModel_, numConstrainedDOFs_, constrainedDOFs_, dampingMassCoef, dampingStiffnessCoef), positiveDefiniteSolver(positiveDefiniteSolver_), numSolverThreads(numSolverThreads_)
 {
   this->maxIterations = maxIterations; // maxIterations = 1 for semi-implicit
@@ -365,3 +367,4 @@ SparseMatrix* ImplicitNewmarkSparse::GetSystemMatrix() const
   return this->systemMatrix;
 }
 
+}
diff --git a/src/libintegratorSparse/implicitNewmarkSparse.h b/src/libintegratorSparse/implicitNewmarkSparse.h
index fbbd828a635b91f1b24df93e5db86a63ba1d444c..a746b213c0778884ba459e183e63798f2dfb97c9 100644
--- a/src/libintegratorSparse/implicitNewmarkSparse.h
+++ b/src/libintegratorSparse/implicitNewmarkSparse.h
@@ -69,6 +69,8 @@
 //   #include "CGSolver.h"
 // #endif
 
+namespace vega
+{
 class ImplicitNewmarkSparse : public IntegratorBaseSparse
 {
 public:
@@ -122,6 +124,6 @@ protected:
   int numSolverThreads;
 
 };
-
+}
 #endif
 
diff --git a/src/libintegratorSparse/integratorBaseSparse.cpp b/src/libintegratorSparse/integratorBaseSparse.cpp
index 59d7c2c7d6254bfb1598e1b5fdc427ae70bd331e..cc14b57e0f242cc75cbda3bee15523eecb3796e5 100644
--- a/src/libintegratorSparse/integratorBaseSparse.cpp
+++ b/src/libintegratorSparse/integratorBaseSparse.cpp
@@ -32,6 +32,8 @@
 #include "integratorBaseSparse.h"
 #include "linearSolver.h"
 
+namespace vega
+{
 IntegratorBaseSparse::IntegratorBaseSparse(int r, double timestep, SparseMatrix * massMatrix_, ForceModel * forceModel_, int numConstrainedDOFs_, int * constrainedDOFs_, double dampingMassCoef, double dampingStiffnessCoef): IntegratorBase(r, timestep, dampingMassCoef, dampingStiffnessCoef), massMatrix(massMatrix_), forceModel(forceModel_), numConstrainedDOFs(numConstrainedDOFs_)
 {
   systemSolveTime = 0.0;
@@ -84,3 +86,4 @@ SparseMatrix* IntegratorBaseSparse::GetSystemMatrix() const
   return this->massMatrix;
 }
 
+}
diff --git a/src/libintegratorSparse/integratorBaseSparse.h b/src/libintegratorSparse/integratorBaseSparse.h
index b9184bc39f5a1d1f52954a9b056cacc16fba9081..df4af5ae4b7df5975673b1b932536224c4f2d403 100644
--- a/src/libintegratorSparse/integratorBaseSparse.h
+++ b/src/libintegratorSparse/integratorBaseSparse.h
@@ -40,6 +40,8 @@
 #include "forceModel.h"
 #include "integratorBase.h"
 
+namespace vega
+{
 class LinearSolver;
 
 class IntegratorBaseSparse : public IntegratorBase
@@ -88,6 +90,6 @@ protected:
 
   LinearSolver *linearSolver;
 };
-
+}
 #endif
 
diff --git a/src/libisotropicHyperelasticFEM/MooneyRivlinIsotropicMaterial.cpp b/src/libisotropicHyperelasticFEM/MooneyRivlinIsotropicMaterial.cpp
index 0e18ddfbc8b0e15f2b27ce65a6f7222cd7a41b1d..610a60076971ff61c1d7d30d3f5c4bdd8e9daeca 100644
--- a/src/libisotropicHyperelasticFEM/MooneyRivlinIsotropicMaterial.cpp
+++ b/src/libisotropicHyperelasticFEM/MooneyRivlinIsotropicMaterial.cpp
@@ -30,6 +30,8 @@
 #include "MooneyRivlinIsotropicMaterial.h"
 #include "volumetricMeshMooneyRivlinMaterial.h"
 
+namespace vega
+{
 MooneyRivlinIsotropicMaterial::MooneyRivlinIsotropicMaterial(TetMesh * tetMesh, int enableCompressionResistance_, double compressionResistance_) : IsotropicMaterialWithCompressionResistance(enableCompressionResistance_), compressionResistance(compressionResistance_)
 {
   int numElements = tetMesh->getNumElements();
@@ -162,3 +164,4 @@ double MooneyRivlinIsotropicMaterial::GetCompressionResistanceFactor(int element
   return EdivNuFactor[elementIndex];
 }
 
+}
diff --git a/src/libisotropicHyperelasticFEM/MooneyRivlinIsotropicMaterial.h b/src/libisotropicHyperelasticFEM/MooneyRivlinIsotropicMaterial.h
index feb4df0cd5c34b192f1fad160a878a3bd716c3e4..eb8edef7f2a12d6299e67a2e952b7c0e6dfb2388 100755
--- a/src/libisotropicHyperelasticFEM/MooneyRivlinIsotropicMaterial.h
+++ b/src/libisotropicHyperelasticFEM/MooneyRivlinIsotropicMaterial.h
@@ -32,6 +32,8 @@
 #include "isotropicMaterialWithCompressionResistance.h"
 #include "tetMesh.h"
 
+namespace vega
+{
 /*
   The implemented compressible Mooney-Rivlin material has the following energy function:
 
@@ -70,6 +72,6 @@ protected:
   double * EdivNuFactor;
   virtual double GetCompressionResistanceFactor(int elementIndex);
 };
-
+}
 #endif
 
diff --git a/src/libisotropicHyperelasticFEM/StVKIsotropicMaterial.cpp b/src/libisotropicHyperelasticFEM/StVKIsotropicMaterial.cpp
index 4824b074f50af2534e9b8e2f9ac8376ce4ed2cbc..33a6e3b4434074229203cfc0300257f0d9edc0e8 100644
--- a/src/libisotropicHyperelasticFEM/StVKIsotropicMaterial.cpp
+++ b/src/libisotropicHyperelasticFEM/StVKIsotropicMaterial.cpp
@@ -30,6 +30,8 @@
 #include "StVKIsotropicMaterial.h"
 #include "volumetricMeshENuMaterial.h"
 
+namespace vega
+{
 StVKIsotropicMaterial::StVKIsotropicMaterial(TetMesh * tetMesh, int enableCompressionResistance_, double compressionResistance_) : IsotropicMaterialWithCompressionResistance(enableCompressionResistance_), compressionResistance(compressionResistance_)
 {
   //printf("Entering StVKIsotropicMaterial::StVKIsotropicMaterial\n");
@@ -158,3 +160,4 @@ double StVKIsotropicMaterial::GetCompressionResistanceFactor(int elementIndex)
   return EdivNuFactor[elementIndex];
 }
 
+}
diff --git a/src/libisotropicHyperelasticFEM/StVKIsotropicMaterial.h b/src/libisotropicHyperelasticFEM/StVKIsotropicMaterial.h
index ae9294c6fa56c86b301fa0f9e222157af9458c77..e5d9d71d597eac94a4603939ff12aafb0a5c0569 100755
--- a/src/libisotropicHyperelasticFEM/StVKIsotropicMaterial.h
+++ b/src/libisotropicHyperelasticFEM/StVKIsotropicMaterial.h
@@ -32,6 +32,8 @@
 #include "isotropicMaterialWithCompressionResistance.h"
 #include "tetMesh.h"
 
+namespace vega
+{
 /*
    StVK material. Material properties are read from the tet mesh, and can be heterogeneous.
 
@@ -60,6 +62,6 @@ protected:
   double * EdivNuFactor;
   virtual double GetCompressionResistanceFactor(int elementIndex);
 };
-
+}
 #endif
 
diff --git a/src/libisotropicHyperelasticFEM/homogeneousMooneyRivlinIsotropicMaterial.cpp b/src/libisotropicHyperelasticFEM/homogeneousMooneyRivlinIsotropicMaterial.cpp
index 7ea01fc083627487d6b64baf02bb68cbd2e24d5e..5c474683e143d4bdc638a84015913ff830f561fa 100644
--- a/src/libisotropicHyperelasticFEM/homogeneousMooneyRivlinIsotropicMaterial.cpp
+++ b/src/libisotropicHyperelasticFEM/homogeneousMooneyRivlinIsotropicMaterial.cpp
@@ -29,6 +29,8 @@
 #include <math.h>
 #include "homogeneousMooneyRivlinIsotropicMaterial.h"
 
+namespace vega
+{
 HomogeneousMooneyRivlinIsotropicMaterial::HomogeneousMooneyRivlinIsotropicMaterial(double mu01_, double mu10_, double v1_, int enableCompressionResistance_, double compressionResistance_) : IsotropicMaterialWithCompressionResistance(enableCompressionResistance_), mu01(mu01_), mu10(mu10_), v1(v1_), compressionResistance(compressionResistance_) 
 {
   // invert the following formulas to compute "pseudo" E and nu that correspond to this material
@@ -112,3 +114,4 @@ double HomogeneousMooneyRivlinIsotropicMaterial::GetCompressionResistanceFactor(
   return EdivNuFactor;
 }
 
+}
diff --git a/src/libisotropicHyperelasticFEM/homogeneousMooneyRivlinIsotropicMaterial.h b/src/libisotropicHyperelasticFEM/homogeneousMooneyRivlinIsotropicMaterial.h
index b1bc6ee4bdf1e561d2d795dd3560e62012248621..4a591f0c13335c891dfb514ec5ce663d793ff463 100755
--- a/src/libisotropicHyperelasticFEM/homogeneousMooneyRivlinIsotropicMaterial.h
+++ b/src/libisotropicHyperelasticFEM/homogeneousMooneyRivlinIsotropicMaterial.h
@@ -31,6 +31,8 @@
 
 #include "isotropicMaterialWithCompressionResistance.h"
 
+namespace vega
+{
 /*
   The implemented compressible Mooney-Rivlin material has the following energy function:
 
@@ -68,6 +70,6 @@ protected:
   double EdivNuFactor;
   virtual double GetCompressionResistanceFactor(int elementIndex);
 };
-
+}
 #endif
 
diff --git a/src/libisotropicHyperelasticFEM/homogeneousNeoHookeanIsotropicMaterial.cpp b/src/libisotropicHyperelasticFEM/homogeneousNeoHookeanIsotropicMaterial.cpp
index 850165a5e3c9e2bc34c8a69980f46822427eedbb..e2a00cd83ab441a10097d18a8976021f1f034854 100644
--- a/src/libisotropicHyperelasticFEM/homogeneousNeoHookeanIsotropicMaterial.cpp
+++ b/src/libisotropicHyperelasticFEM/homogeneousNeoHookeanIsotropicMaterial.cpp
@@ -29,6 +29,8 @@
 #include <math.h>
 #include "homogeneousNeoHookeanIsotropicMaterial.h"
 
+namespace vega
+{
 HomogeneousNeoHookeanIsotropicMaterial::HomogeneousNeoHookeanIsotropicMaterial(double E_, double nu_, int enableCompressionResistance_, double compressionResistance_) : IsotropicMaterialWithCompressionResistance(enableCompressionResistance_), compressionResistance(compressionResistance_)
 {
   SetYoungModulusAndPoissonRatio(E_, nu_);
@@ -103,3 +105,4 @@ double HomogeneousNeoHookeanIsotropicMaterial::GetCompressionResistanceFactor(in
   return EdivNuFactor;
 }
 
+}
diff --git a/src/libisotropicHyperelasticFEM/homogeneousNeoHookeanIsotropicMaterial.h b/src/libisotropicHyperelasticFEM/homogeneousNeoHookeanIsotropicMaterial.h
index 56510f5c54e9742b92be23a2b89f12eda92081e3..6d2eb9654647d2b3e19b22e92c3916942e9953c9 100755
--- a/src/libisotropicHyperelasticFEM/homogeneousNeoHookeanIsotropicMaterial.h
+++ b/src/libisotropicHyperelasticFEM/homogeneousNeoHookeanIsotropicMaterial.h
@@ -31,6 +31,8 @@
 
 #include "isotropicMaterialWithCompressionResistance.h"
 
+namespace vega
+{
 /*
    Homogeneous neo-Hookean material. Material properties are constant throughout the mesh.
 
@@ -61,6 +63,6 @@ protected:
   double EdivNuFactor;
   virtual double GetCompressionResistanceFactor(int elementIndex);
 };
-
+}
 #endif
 
diff --git a/src/libisotropicHyperelasticFEM/homogeneousStVKIsotropicMaterial.cpp b/src/libisotropicHyperelasticFEM/homogeneousStVKIsotropicMaterial.cpp
index 56acd4ac568f7bcec618bec98c4cd42cfc28f631..b6a804ebe5f6bc7df46eacab153da4b530dc9436 100644
--- a/src/libisotropicHyperelasticFEM/homogeneousStVKIsotropicMaterial.cpp
+++ b/src/libisotropicHyperelasticFEM/homogeneousStVKIsotropicMaterial.cpp
@@ -29,6 +29,8 @@
 #include <math.h>
 #include "homogeneousStVKIsotropicMaterial.h"
 
+namespace vega
+{
 HomogeneousStVKIsotropicMaterial::HomogeneousStVKIsotropicMaterial(double E_, double nu_, int enableCompressionResistance_, double compressionResistance_) : IsotropicMaterialWithCompressionResistance(enableCompressionResistance_), compressionResistance(compressionResistance_)
 {
   SetYoungModulusAndPoissonRatio(E_, nu_);
@@ -97,3 +99,4 @@ double HomogeneousStVKIsotropicMaterial::GetCompressionResistanceFactor(int elem
   return EdivNuFactor;
 }
 
+}
diff --git a/src/libisotropicHyperelasticFEM/homogeneousStVKIsotropicMaterial.h b/src/libisotropicHyperelasticFEM/homogeneousStVKIsotropicMaterial.h
index 90d6530f2291ac9d7cda41ff53c33d99bf231c86..ef7dc63bd9da3c10cfd457c0e131fe543b41d843 100755
--- a/src/libisotropicHyperelasticFEM/homogeneousStVKIsotropicMaterial.h
+++ b/src/libisotropicHyperelasticFEM/homogeneousStVKIsotropicMaterial.h
@@ -32,6 +32,8 @@
 #include "isotropicMaterialWithCompressionResistance.h"
 #include "tetMesh.h"
 
+namespace vega
+{
 /*
    Homogeneous StVK material. Material properties are constant throughout the mesh.
  
@@ -62,6 +64,6 @@ protected:
   double EdivNuFactor;
   virtual double GetCompressionResistanceFactor(int elementIndex);
 };
-
+}
 #endif
 
diff --git a/src/libisotropicHyperelasticFEM/isotropicHyperelasticFEM.cpp b/src/libisotropicHyperelasticFEM/isotropicHyperelasticFEM.cpp
index bb33d92806bb6d48f619791d34a52c57530529da..96ae503ad1d420f338102c85c16cc3b111d09ebe 100644
--- a/src/libisotropicHyperelasticFEM/isotropicHyperelasticFEM.cpp
+++ b/src/libisotropicHyperelasticFEM/isotropicHyperelasticFEM.cpp
@@ -29,6 +29,8 @@
 #include "isotropicHyperelasticFEM.h"
 #include "matrixIO.h"
 
+namespace vega
+{
 IsotropicHyperelasticFEM::IsotropicHyperelasticFEM(TetMesh * tetMesh_, IsotropicMaterial * isotropicMaterial_, double inversionThreshold_, bool addGravity_, double g_) :
   tetMesh(tetMesh_),
   isotropicMaterial(isotropicMaterial_),
@@ -1376,3 +1378,4 @@ void IsotropicHyperelasticFEM::FindOrthonormalVector(Vec3d & v, Vec3d & result)
   result = norm(cross(v, axis));
 }
 
+}
diff --git a/src/libisotropicHyperelasticFEM/isotropicHyperelasticFEM.h b/src/libisotropicHyperelasticFEM/isotropicHyperelasticFEM.h
index 22429301727af7bced5dd4a166b8c2dcbc32e212..b7d5ef465786e9f816e2113d1f47c3a4863ace98 100755
--- a/src/libisotropicHyperelasticFEM/isotropicHyperelasticFEM.h
+++ b/src/libisotropicHyperelasticFEM/isotropicHyperelasticFEM.h
@@ -34,6 +34,8 @@
 #include "sparseMatrix.h"
 #include "isotropicMaterial.h"
 
+namespace vega
+{
 /*
   Implementation of hyperelastic isotropic nonlinear FEM elasticity, using
   linear tetrahedral elements. 
@@ -45,6 +47,8 @@ es (derivative of internal forces). It can also handle and restore from element
 
   Citations:
 
+namespace vega
+{
   IRVING G., TERAN J., FEDKIW R.: Invertible Finite
   Elements for Robust Simulation of Large Deformation. In Proc.  of the Symp. on Comp. Animation 2004 (2004), pp. 131–140.
 
@@ -225,6 +229,6 @@ protected:
   // Note: you can overload this function (in your own derived class) if you want to provide your own, custom/faster SVD.
   virtual int ModifiedSVD(Mat3d & F, Mat3d & U, Vec3d & Fhat, Mat3d & V);
 };
-
+}
 #endif
 
diff --git a/src/libisotropicHyperelasticFEM/isotropicHyperelasticFEMMT.cpp b/src/libisotropicHyperelasticFEM/isotropicHyperelasticFEMMT.cpp
index 2d01a1a76f18500b97dc702371c7de0b3db278e4..ea83be846f295d6f7a667bdb8d071fb46fe94637 100644
--- a/src/libisotropicHyperelasticFEM/isotropicHyperelasticFEMMT.cpp
+++ b/src/libisotropicHyperelasticFEM/isotropicHyperelasticFEMMT.cpp
@@ -33,6 +33,8 @@
 #include <pthread.h>
 #include "isotropicHyperelasticFEMMT.h"
 
+namespace vega
+{
 IsotropicHyperelasticFEMMT::IsotropicHyperelasticFEMMT(TetMesh * tetMesh_, IsotropicMaterial * isotropicMaterial_, double principalStretchThreshold_, bool addGravity_, double g_, int numThreads_) :
   IsotropicHyperelasticFEM(tetMesh_, isotropicMaterial_, principalStretchThreshold_, addGravity_, g_),
   numThreads(numThreads_)
@@ -207,3 +209,4 @@ int IsotropicHyperelasticFEMMT::GetEndElement(int rank)
   return endElement[rank];
 }
 
+}
diff --git a/src/libisotropicHyperelasticFEM/isotropicHyperelasticFEMMT.h b/src/libisotropicHyperelasticFEM/isotropicHyperelasticFEMMT.h
index 23bcfedd9c46b691c7c6a11d3e0ef321431f3bc2..41dcc61a66e94465b7d08a0915acae5db5529282 100644
--- a/src/libisotropicHyperelasticFEM/isotropicHyperelasticFEMMT.h
+++ b/src/libisotropicHyperelasticFEM/isotropicHyperelasticFEMMT.h
@@ -31,6 +31,8 @@
 
 #include "isotropicHyperelasticFEM.h"
 
+namespace vega
+{
 /*
   This class is a multi-threaded version of the class "IsotropicHyperelasticFEM".
   It uses POSIX threads ("pthreads") as the threading API.
@@ -64,6 +66,6 @@ protected:
 
   void Initialize();
 };
-
+}
 #endif
 
diff --git a/src/libisotropicHyperelasticFEM/isotropicMaterial.cpp b/src/libisotropicHyperelasticFEM/isotropicMaterial.cpp
index 9ddb4d252ed6e1ba31a95b2e8cf933c8a1d51f80..580986fa4bce9ef799f66c015f61457098d56e3a 100644
--- a/src/libisotropicHyperelasticFEM/isotropicMaterial.cpp
+++ b/src/libisotropicHyperelasticFEM/isotropicMaterial.cpp
@@ -28,7 +28,10 @@
 
 #include "isotropicMaterial.h"
 
+namespace vega
+{
 IsotropicMaterial::IsotropicMaterial() {}
 
 IsotropicMaterial::~IsotropicMaterial() {}
 
+}
diff --git a/src/libisotropicHyperelasticFEM/isotropicMaterial.h b/src/libisotropicHyperelasticFEM/isotropicMaterial.h
index 0945138540cf4d6f3a6fe536fb9f81007d5bbdd4..da92cc4922da2799a4cbe9166e160e333a4fac9b 100755
--- a/src/libisotropicHyperelasticFEM/isotropicMaterial.h
+++ b/src/libisotropicHyperelasticFEM/isotropicMaterial.h
@@ -29,6 +29,8 @@
 #ifndef _ISOTROPICMATERIAL_H_
 #define _ISOTROPICMATERIAL_H_
 
+namespace vega
+{
 class IsotropicMaterial
 {
 public:
@@ -41,6 +43,6 @@ public:
 
 protected:
 };
-
+}
 #endif
 
diff --git a/src/libisotropicHyperelasticFEM/isotropicMaterialWithCompressionResistance.cpp b/src/libisotropicHyperelasticFEM/isotropicMaterialWithCompressionResistance.cpp
index ed571013c896261d42c2140985524e0bb0ad0a5c..74c8b7614c0fb3d54453174a0002994141883a1f 100644
--- a/src/libisotropicHyperelasticFEM/isotropicMaterialWithCompressionResistance.cpp
+++ b/src/libisotropicHyperelasticFEM/isotropicMaterialWithCompressionResistance.cpp
@@ -29,6 +29,8 @@
 #include <math.h>
 #include "isotropicMaterialWithCompressionResistance.h"
 
+namespace vega
+{
 IsotropicMaterialWithCompressionResistance::IsotropicMaterialWithCompressionResistance(int enableCompressionResistance_) : IsotropicMaterial(), enableCompressionResistance(enableCompressionResistance_)
 {
 }
@@ -87,3 +89,4 @@ double IsotropicMaterialWithCompressionResistance::GetCompressionResistanceFacto
   return 1.0;
 }
 
+}
diff --git a/src/libisotropicHyperelasticFEM/isotropicMaterialWithCompressionResistance.h b/src/libisotropicHyperelasticFEM/isotropicMaterialWithCompressionResistance.h
index 34dbf35a1e10213cfa6512c10c22a2e13535a8ab..c4cc4cb3ce935834955de033b951e523883922d5 100755
--- a/src/libisotropicHyperelasticFEM/isotropicMaterialWithCompressionResistance.h
+++ b/src/libisotropicHyperelasticFEM/isotropicMaterialWithCompressionResistance.h
@@ -31,6 +31,8 @@
 
 #include "isotropicMaterial.h"
 
+namespace vega
+{
 class IsotropicMaterialWithCompressionResistance : public IsotropicMaterial
 {
 public:
@@ -49,6 +51,6 @@ protected:
   void AddCompressionResistanceGradient(int elementIndex, double * invariants, double * gradient);
   void AddCompressionResistanceHessian(int elementIndex, double * invariants, double * hessian); 
 };
-
+}
 #endif
 
diff --git a/src/libisotropicHyperelasticFEM/neoHookeanIsotropicMaterial.cpp b/src/libisotropicHyperelasticFEM/neoHookeanIsotropicMaterial.cpp
index 2afd33839af4e3826506571e103a8c629e7989d9..bb80620274476d0459600a7077440a0a3014aabd 100644
--- a/src/libisotropicHyperelasticFEM/neoHookeanIsotropicMaterial.cpp
+++ b/src/libisotropicHyperelasticFEM/neoHookeanIsotropicMaterial.cpp
@@ -30,6 +30,8 @@
 #include "neoHookeanIsotropicMaterial.h"
 #include "volumetricMeshENuMaterial.h"
 
+namespace vega
+{
 NeoHookeanIsotropicMaterial::NeoHookeanIsotropicMaterial(TetMesh * tetMesh, int enableCompressionResistance_, double compressionResistance_) : IsotropicMaterialWithCompressionResistance(enableCompressionResistance_), compressionResistance(compressionResistance_)
 {
   int numElements = tetMesh->getNumElements();
@@ -122,3 +124,4 @@ double NeoHookeanIsotropicMaterial::GetCompressionResistanceFactor(int elementIn
   return EdivNuFactor[elementIndex];
 }
 
+}
diff --git a/src/libisotropicHyperelasticFEM/neoHookeanIsotropicMaterial.h b/src/libisotropicHyperelasticFEM/neoHookeanIsotropicMaterial.h
index 3f241f26a236d615c5b1d4d4fc320de876451f5c..7265e0c1f27ac186ec37e2a32950419f3b7180e5 100755
--- a/src/libisotropicHyperelasticFEM/neoHookeanIsotropicMaterial.h
+++ b/src/libisotropicHyperelasticFEM/neoHookeanIsotropicMaterial.h
@@ -32,6 +32,8 @@
 #include "tetMesh.h"
 #include "isotropicMaterialWithCompressionResistance.h"
 
+namespace vega
+{
 /*
    Neo-Hookean material. Material properties are read from the tet mesh, and can be heterogeneous.
 
@@ -59,6 +61,6 @@ protected:
   double * EdivNuFactor;
   virtual double GetCompressionResistanceFactor(int elementIndex);
 };
-
+}
 #endif
 
diff --git a/src/libloadList/loadList.cpp b/src/libloadList/loadList.cpp
index 9c5b6f5f680cc4e8ff6ac2ba00bae82cf91805f7..5b1f6a3f39a37fc8240608a53d4188f8f58e0fc6 100644
--- a/src/libloadList/loadList.cpp
+++ b/src/libloadList/loadList.cpp
@@ -27,6 +27,8 @@
 #include <string.h>
 #include <ctype.h>
 
+namespace vega
+{
 // removes all whitespace characters from string s
 void LoadList::stripBlanks(char * s)
 {
@@ -156,3 +158,4 @@ void LoadList::print(int numListEntries, int * listEntries)
   printf("\n"); fflush(NULL);
 }
 
+}
diff --git a/src/libloadList/loadList.h b/src/libloadList/loadList.h
index 1f4374f8f2effb0447d66331b284c7b395bc644e..4915935d497ddeee052ea1ff183504b559da5bd4 100755
--- a/src/libloadList/loadList.h
+++ b/src/libloadList/loadList.h
@@ -24,6 +24,8 @@
 #ifndef _LOADLIST_H_
 #define _LOADLIST_H_
 
+namespace vega
+{
 /*
   A class to load an integer list from a text file into memory. 
 */
@@ -43,6 +45,6 @@ public:
 
 protected:
 };
-
+}
 #endif
 
diff --git a/src/libmassSpringSystem/massSpringSystem.cpp b/src/libmassSpringSystem/massSpringSystem.cpp
index 9ebf2c24958d836510c88389f4546f94757732cd..93ff8d74a6d0c19052fd87a882b5e35589f06ea1 100644
--- a/src/libmassSpringSystem/massSpringSystem.cpp
+++ b/src/libmassSpringSystem/massSpringSystem.cpp
@@ -37,6 +37,8 @@
 #include "massSpringSystem.h"
 using namespace std;
 
+namespace vega
+{
 MassSpringSystem::MassSpringSystem(int numParticles_, double * masses_, double * restPositions_, int numEdges_, int * edges_, int * edgeGroups_, int numMaterialGroups_, double * groupStiffness_, double * groupDamping_, int addGravity_) : addGravity(addGravity_), g(9.81)
 {
   GenerateMassSpringSystem(numParticles_, masses_, restPositions_, numEdges_, edges_, edgeGroups_, numMaterialGroups_, groupStiffness_, groupDamping_);
@@ -795,3 +797,4 @@ void MassSpringSystem::CreateObjMesh(char * filename, double * u)
   fclose(fout);
 }
 
+}
diff --git a/src/libmassSpringSystem/massSpringSystem.h b/src/libmassSpringSystem/massSpringSystem.h
index 604f497e2807ac34ffbcc2952c72e36038866f9f..d37868a6aa97cb804f86aa71a021b5a7c686c38e 100644
--- a/src/libmassSpringSystem/massSpringSystem.h
+++ b/src/libmassSpringSystem/massSpringSystem.h
@@ -45,6 +45,8 @@
 
 #include "sparseMatrix.h"
 
+namespace vega
+{
 enum MassSpringSystemElementType {TET, CUBE};
 
 class MassSpringSystem
@@ -147,6 +149,6 @@ protected:
   int addGravity;
   double g;
 };
-
+}
 #endif
 
diff --git a/src/libmassSpringSystem/massSpringSystemFromCubicMesh.cpp b/src/libmassSpringSystem/massSpringSystemFromCubicMesh.cpp
index 9760e979906f775a9b7ee0c144063424addf558b..53bb21b42cbd72b3f2da21aae54d03d86bb428be 100644
--- a/src/libmassSpringSystem/massSpringSystemFromCubicMesh.cpp
+++ b/src/libmassSpringSystem/massSpringSystemFromCubicMesh.cpp
@@ -30,6 +30,8 @@
 #include "cubicMesh.h"
 #include "massSpringSystemFromCubicMesh.h"
 
+namespace vega
+{
 int MassSpringSystemFromCubicMesh::GenerateMassSpringSystem(CubicMesh * cubicMesh, MassSpringSystem ** massSpringSystem, double density, double tensileStiffness, double damping, int addGravity)
 {
   int numParticles;
@@ -53,4 +55,5 @@ int MassSpringSystemFromCubicMesh::GenerateMassSpringSystem(CubicMesh * cubicMes
 
   return 0;
 }
+}
 
diff --git a/src/libmassSpringSystem/massSpringSystemFromCubicMesh.h b/src/libmassSpringSystem/massSpringSystemFromCubicMesh.h
index 6ff28ca0a61ed65da4084b4e5b51fb77bc949ad2..a5c1dc04e289bc954c72014324998d3b925248a9 100644
--- a/src/libmassSpringSystem/massSpringSystemFromCubicMesh.h
+++ b/src/libmassSpringSystem/massSpringSystemFromCubicMesh.h
@@ -32,6 +32,8 @@
 
 #include "massSpringSystem.h"
 
+namespace vega
+{
 /*
   This class can generate a mass-spring system from the given cube mesh: 
   each cube mesh vertex becomes a mass point, and each pair of vertices
@@ -47,6 +49,6 @@ public:
 
   static int GenerateMassSpringSystem(CubicMesh * CubicMesh, MassSpringSystem ** massSpringSystem, double density, double tensileStiffness, double damping, int addGravity=0);
 };
-
+}
 #endif
 
diff --git a/src/libmassSpringSystem/massSpringSystemFromCubicMeshConfigFile.cpp b/src/libmassSpringSystem/massSpringSystemFromCubicMeshConfigFile.cpp
index 00ff3c233d7d54cfe911972899a50c102d88637a..d70da717e14cb6e67454fe02907c7e97960ab8e5 100644
--- a/src/libmassSpringSystem/massSpringSystemFromCubicMeshConfigFile.cpp
+++ b/src/libmassSpringSystem/massSpringSystemFromCubicMeshConfigFile.cpp
@@ -32,6 +32,8 @@
 #include "massSpringSystemFromCubicMesh.h"
 #include "massSpringSystemFromCubicMeshConfigFile.h"
 
+namespace vega
+{
 char * MassSpringSystemFromCubicMeshConfigFile::DuplicateString(char * s)
 {
   // strdup sometimes didn't work well, so we used this
@@ -98,3 +100,4 @@ int MassSpringSystemFromCubicMeshConfigFile::GenerateMassSpringSystem(char * con
   return code;
 }
 
+}
diff --git a/src/libmassSpringSystem/massSpringSystemFromCubicMeshConfigFile.h b/src/libmassSpringSystem/massSpringSystemFromCubicMeshConfigFile.h
index 8db36be6cfb599f37d63bda00aa4ef2d8e73451c..628a5fa6e738fe6a1064d5cbb10f44b7a21f160a 100644
--- a/src/libmassSpringSystem/massSpringSystemFromCubicMeshConfigFile.h
+++ b/src/libmassSpringSystem/massSpringSystemFromCubicMeshConfigFile.h
@@ -32,6 +32,8 @@
 
 #include "massSpringSystem.h"
 
+namespace vega
+{
 class MassSpringSystemCubicMeshConfiguration
 {
 public:
@@ -57,6 +59,6 @@ public:
 protected:
   char * DuplicateString(char*);
 };
-
+}
 #endif
 
diff --git a/src/libmassSpringSystem/massSpringSystemFromObjMesh.cpp b/src/libmassSpringSystem/massSpringSystemFromObjMesh.cpp
index 1e79ee0f3af69554a77a4b8e4249e49dac10b8d0..2280b0f2fa9c24b7dbcaeaac2ac1a0a710daa3b7 100644
--- a/src/libmassSpringSystem/massSpringSystemFromObjMesh.cpp
+++ b/src/libmassSpringSystem/massSpringSystemFromObjMesh.cpp
@@ -30,6 +30,8 @@
 #include "objMesh.h"
 #include "massSpringSystemFromObjMesh.h"
 
+namespace vega
+{
 int MassSpringSystemFromObjMesh::GenerateMassSpringSystem(ObjMesh * quadMesh, MassSpringSystem ** massSpringSystem, double surfaceDensity, double tensileStiffness, double shearStiffness, double bendStiffness, double damping, int addGravity)
 {
   if (!quadMesh->isQuadrilateralMesh())
@@ -54,3 +56,4 @@ int MassSpringSystemFromObjMesh::GenerateMassSpringSystem(ObjMesh * quadMesh, Ma
 
   return 0;
 }
+}
diff --git a/src/libmassSpringSystem/massSpringSystemFromObjMesh.h b/src/libmassSpringSystem/massSpringSystemFromObjMesh.h
index 659b36d6ef5242e2619220d3c4d1123db5f2346a..2bd02f0337bfe708a5645d1f9d754901b34564b1 100644
--- a/src/libmassSpringSystem/massSpringSystemFromObjMesh.h
+++ b/src/libmassSpringSystem/massSpringSystemFromObjMesh.h
@@ -31,6 +31,9 @@
 #define _MASSSPRINGSYSTEMFROMOBJMESH_H_
 
 #include "massSpringSystem.h"
+
+namespace vega
+{
 class ObjMesh;
 
 class MassSpringSystemFromObjMesh
@@ -40,6 +43,6 @@ public:
   // generates a mass-spring system from the given quad mesh (builds tensile, shear, and bending springs)
   int GenerateMassSpringSystem(ObjMesh * quadMesh, MassSpringSystem ** massSpringSystem, double surfaceDensity, double tensileStiffness, double shearStiffness, double bendStiffness, double damping, int addGravity=0);
 };
-
+}
 #endif
 
diff --git a/src/libmassSpringSystem/massSpringSystemFromObjMeshConfigFile.cpp b/src/libmassSpringSystem/massSpringSystemFromObjMeshConfigFile.cpp
index ae58c500f2d72ab219b247cf65af63e041cc0089..4ed8faa1dde41ac31a264f2453cee4c6727b84b7 100644
--- a/src/libmassSpringSystem/massSpringSystemFromObjMeshConfigFile.cpp
+++ b/src/libmassSpringSystem/massSpringSystemFromObjMeshConfigFile.cpp
@@ -33,6 +33,8 @@
 #include "massSpringSystemFromObjMeshConfigFile.h"
 #include <string.h>
 
+namespace vega
+{
 char * MassSpringSystemFromObjMeshConfigFile::DuplicateString(char * s)
 {
   // strdup sometimes causes problems, so we use this
@@ -98,3 +100,4 @@ int MassSpringSystemFromObjMeshConfigFile::GenerateMassSpringSystem(char * confi
   return code;
 }
 
+}
diff --git a/src/libmassSpringSystem/massSpringSystemFromObjMeshConfigFile.h b/src/libmassSpringSystem/massSpringSystemFromObjMeshConfigFile.h
index f356b0489e76995cf17a7398de6bdb8fd26c9322..cbf6efb765fcaa4d4b40f2ac7287dd5dda67c6e1 100644
--- a/src/libmassSpringSystem/massSpringSystemFromObjMeshConfigFile.h
+++ b/src/libmassSpringSystem/massSpringSystemFromObjMeshConfigFile.h
@@ -32,6 +32,8 @@
 
 #include "massSpringSystem.h"
 
+namespace vega
+{
 class MassSpringSystemObjMeshConfiguration
 {
 public:
@@ -56,6 +58,6 @@ public:
 protected:
   char * DuplicateString(char *);
 };
-
+}
 #endif
 
diff --git a/src/libmassSpringSystem/massSpringSystemFromTetMesh.cpp b/src/libmassSpringSystem/massSpringSystemFromTetMesh.cpp
index ce64a1d0f011e5d706ae6012e3ef9a6132b7a5e7..bb49c18b900262daa8a78cee23f0ed7b5940e06f 100644
--- a/src/libmassSpringSystem/massSpringSystemFromTetMesh.cpp
+++ b/src/libmassSpringSystem/massSpringSystemFromTetMesh.cpp
@@ -30,6 +30,8 @@
 #include "tetMesh.h"
 #include "massSpringSystemFromTetMesh.h"
 
+namespace vega
+{
 int MassSpringSystemFromTetMesh::GenerateMassSpringSystem(TetMesh * tetMesh, MassSpringSystem ** massSpringSystem, double density, double tensileStiffness, double damping, int addGravity)
 {
   int numParticles;
@@ -54,4 +56,5 @@ int MassSpringSystemFromTetMesh::GenerateMassSpringSystem(TetMesh * tetMesh, Mas
 
   return 0;
 }
+}
 
diff --git a/src/libmassSpringSystem/massSpringSystemFromTetMesh.h b/src/libmassSpringSystem/massSpringSystemFromTetMesh.h
index a72f0e25d931b365a32175e8020c15a4d2b84db9..b1f227191050bf084cf9b24eac5a9a19deedfc3d 100644
--- a/src/libmassSpringSystem/massSpringSystemFromTetMesh.h
+++ b/src/libmassSpringSystem/massSpringSystemFromTetMesh.h
@@ -38,6 +38,8 @@
   See also massSpringSystem.h
 */
 
+namespace vega
+{
 class TetMesh;
 
 class MassSpringSystemFromTetMesh
@@ -46,6 +48,6 @@ public:
 
   static int GenerateMassSpringSystem(TetMesh * tetMesh, MassSpringSystem ** massSpringSystem, double density, double tensileStiffness, double damping, int addGravity=0);
 };
-
+}
 #endif
 
diff --git a/src/libmassSpringSystem/massSpringSystemFromTetMeshConfigFile.cpp b/src/libmassSpringSystem/massSpringSystemFromTetMeshConfigFile.cpp
index 9626885cc9a54bb0f217e5ed37e6fed06b47efbc..1a6a8c56f3e8d33327000cc4984dda6d5c99ea9a 100644
--- a/src/libmassSpringSystem/massSpringSystemFromTetMeshConfigFile.cpp
+++ b/src/libmassSpringSystem/massSpringSystemFromTetMeshConfigFile.cpp
@@ -32,6 +32,8 @@
 #include "massSpringSystemFromTetMesh.h"
 #include "massSpringSystemFromTetMeshConfigFile.h"
 
+namespace vega
+{
 char * MassSpringSystemFromTetMeshConfigFile::DuplicateString(char * s)
 {
   // strdup sometimes didn't work well, so we used this
@@ -98,3 +100,4 @@ int MassSpringSystemFromTetMeshConfigFile::GenerateMassSpringSystem(char * confi
   return code;
 }
 
+}
diff --git a/src/libmassSpringSystem/massSpringSystemFromTetMeshConfigFile.h b/src/libmassSpringSystem/massSpringSystemFromTetMeshConfigFile.h
index 289afdbe6cbf783ea9380dfac992ef7e8208577e..b1349d0e74064da677dc6c4b168a1eb3c9735d2f 100644
--- a/src/libmassSpringSystem/massSpringSystemFromTetMeshConfigFile.h
+++ b/src/libmassSpringSystem/massSpringSystemFromTetMeshConfigFile.h
@@ -32,6 +32,8 @@
 
 #include "massSpringSystem.h"
 
+namespace vega
+{
 class MassSpringSystemTetMeshConfiguration
 {
 public:
@@ -57,6 +59,6 @@ public:
 protected:
   char * DuplicateString(char*);
 };
-
+}
 #endif
 
diff --git a/src/libmassSpringSystem/massSpringSystemMT.cpp b/src/libmassSpringSystem/massSpringSystemMT.cpp
index cd33f03aca42a7940e9a5fe1c5a9843b306390b3..0d50f3a3b283073503c975687b85bd116b99d92f 100644
--- a/src/libmassSpringSystem/massSpringSystemMT.cpp
+++ b/src/libmassSpringSystem/massSpringSystemMT.cpp
@@ -40,6 +40,8 @@ using namespace std;
 
 //#include "performanceCounter.h"
 
+namespace vega
+{
 MassSpringSystemMT::MassSpringSystemMT(int numParticles_, double * masses_, double * restPositions_, int numEdges_, int * edges_, int * edgeGroups_, int numMaterialGroups_, double * groupStiffness_, double * groupDamping_, int addGravity_, int numThreads_) : MassSpringSystem(numParticles_, masses_, restPositions_, numEdges_, edges_, edgeGroups_, numMaterialGroups_, groupStiffness_, groupDamping_, addGravity_), numThreads(numThreads_)
 {
   Initialize();
@@ -318,3 +320,4 @@ int MassSpringSystemMT::GetEndEdge(int rank)
   return endEdge[rank];
 }
 
+}
diff --git a/src/libmassSpringSystem/massSpringSystemMT.h b/src/libmassSpringSystem/massSpringSystemMT.h
index cb6a188c6f265c1271811ad339d0d3a2a64c2851..fa8720058814eea789a46637fdf498cddc3fd69c 100644
--- a/src/libmassSpringSystem/massSpringSystemMT.h
+++ b/src/libmassSpringSystem/massSpringSystemMT.h
@@ -32,6 +32,8 @@
 
 #include "massSpringSystem.h"
 
+namespace vega
+{
 /*
    Multi-threaded version of the MassSpringSystem class. 
    It uses the POSIX threads ("pthreads").
@@ -75,6 +77,6 @@ protected:
   void ComputeHelper(enum MassSpringSystemMT_computationTargetType computationTarget, double * u, double * uSecondary, void * target, bool addQuantity);
 
 };
-
+}
 #endif
 
diff --git a/src/libmatrixIO/matrixIO.cpp b/src/libmatrixIO/matrixIO.cpp
index b5498d12cdb6fcc189341cfeee8ad5ee52e9b807..919d147fb6c6528088782b3b4dc876e054c8a0b7 100644
--- a/src/libmatrixIO/matrixIO.cpp
+++ b/src/libmatrixIO/matrixIO.cpp
@@ -29,6 +29,8 @@
 #include "matrixIO.h"
 
 
+namespace vega
+{
 // writes out the m x n matrix onto the stream, in binary format
 // LAPACK column-major order
 template <class real>
@@ -838,3 +840,4 @@ template void ReadBinaryBuffer_(FILE * fin, int size, int * data);
 template void ReadBinaryBuffer_(FILE * fin, int size, float * data);
 template void ReadBinaryBuffer_(FILE * fin, int size, double * data);
 
+}
diff --git a/src/libmatrixIO/matrixIO.h b/src/libmatrixIO/matrixIO.h
index 61cd23c93ed471f06aab32b8156ea58178bfb4a9..a6dd0b0323afcb909383747e6041917f3c5e17f8 100644
--- a/src/libmatrixIO/matrixIO.h
+++ b/src/libmatrixIO/matrixIO.h
@@ -51,6 +51,8 @@
 #include <stdlib.h>
 #include "matrixMacros.h"
 
+namespace vega
+{
 // === matrix input/output routines ===
 
 template <class real>
@@ -131,6 +133,6 @@ int ReadModeInfoFromDisk(const char * filename, int * n, int * r);
 
 template <class real>
 int WriteModesToDisk(const char * filename, int n, int r, real * frequencies, real * modes);
-
+}
 #endif
 
diff --git a/src/libminivector/eig3.cpp b/src/libminivector/eig3.cpp
index 53ec4b194b3e1a134100cdc1b8dbd84f6d4ebd9f..7cbb3a51856e6737eec2bd75e9f56eca86c16655 100644
--- a/src/libminivector/eig3.cpp
+++ b/src/libminivector/eig3.cpp
@@ -3,6 +3,8 @@
 
 #include <math.h>
 
+namespace vega
+{
 #ifdef MAX
 #undef MAX
 #endif
@@ -262,3 +264,4 @@ void eigen_decomposition(double A[n][n], double V[n][n], double d[n]) {
   tred2(V, d, e);
   tql2(V, d, e);
 }
+}
diff --git a/src/libminivector/eig3.h b/src/libminivector/eig3.h
index 0b36472adf59a252347728c31f5c7d61a8cde8de..aedad6aa65481aa8b7e3c2617de6299eecbe3f23 100644
--- a/src/libminivector/eig3.h
+++ b/src/libminivector/eig3.h
@@ -3,8 +3,10 @@
 
 #ifndef _eig_h
 
+namespace vega
+{
 /* Symmetric matrix A => eigenvectors in columns of V, corresponding
    eigenvalues in d. */
 void eigen_decomposition(double A[3][3], double V[3][3], double d[3]);
-
+}
 #endif
diff --git a/src/libminivector/mat3d.cpp b/src/libminivector/mat3d.cpp
index 841e4c4f0d9b5601bd2b2802ee41031b53126ebe..7daa106031531fb1981cbf1edce06760df4f1cb3 100644
--- a/src/libminivector/mat3d.cpp
+++ b/src/libminivector/mat3d.cpp
@@ -35,6 +35,8 @@
 #include "mat3d.h"
 #include "eig3.h"
 
+namespace vega
+{
 // This routine calls a public domain routine (eigen_decomposition), which was 
 // downloaded from:
 // http://barnesc.blogspot.com/2007/02/eigenvectors-of-3x3-symmetric-matrix.html
@@ -59,4 +61,4 @@ void eigen_sym(Mat3d & a, Vec3d & eig_val, Vec3d eig_vec[3])
   eig_vec[1] = Vec3d(V[0][1], V[1][1], V[2][1]);
   eig_vec[2] = Vec3d(V[0][0], V[1][0], V[2][0]);
 }
-
+}
diff --git a/src/libminivector/mat3d.h b/src/libminivector/mat3d.h
index 7238166bcf97b7bd63a9a63ba7d24f1b428a50cc..a621896753621de6308af6ed3f450b5943cd4c3f 100644
--- a/src/libminivector/mat3d.h
+++ b/src/libminivector/mat3d.h
@@ -46,6 +46,8 @@
 
 #include "vec3d.h"
 
+namespace vega
+{
 class Mat3d {
 public:
 
@@ -417,6 +419,6 @@ inline void Mat3d::print()
   printf(" %G %G %G;\n", a10, a11, a12);
   printf(" %G %G %G]\n", a20, a21, a22);
 }
-
+}
 #endif
 
diff --git a/src/libminivector/vec2d.cpp b/src/libminivector/vec2d.cpp
index 6710a14608829002fc5e3a9682566fc01ab25504..b21cecbc82be5e59f521abaca3cdb34fe0f78912 100644
--- a/src/libminivector/vec2d.cpp
+++ b/src/libminivector/vec2d.cpp
@@ -33,3 +33,5 @@
 
 
 #include "vec2d.h"
+
+namespace vega {}
diff --git a/src/libminivector/vec2d.h b/src/libminivector/vec2d.h
index ceaa67f417d847802d5eb03e4c1781ab0694e379..467e388b1b68e307638675abbab1265f454a2be3 100644
--- a/src/libminivector/vec2d.h
+++ b/src/libminivector/vec2d.h
@@ -47,6 +47,8 @@
 #include <math.h>
 #include <ostream>
 
+namespace vega
+{
 class Vec2d {
 public:
 
@@ -220,6 +222,6 @@ inline std::ostream &operator << (std::ostream &s, const Vec2d &v)
   
   return(s << '[' << a << ' ' << b << ']');
 }
-
+}
 #endif
 
diff --git a/src/libminivector/vec3d.cpp b/src/libminivector/vec3d.cpp
index d52daba9d8fcfda9e6686a5d7dbbdea3c9fcada7..3a792037fa82cbe9777199362e64f04ba2cce502 100644
--- a/src/libminivector/vec3d.cpp
+++ b/src/libminivector/vec3d.cpp
@@ -33,3 +33,4 @@
 
 #include "vec3d.h"
 
+namespace vega {}
diff --git a/src/libminivector/vec3d.h b/src/libminivector/vec3d.h
index e6bbfbb9d07e71904a7aa4f3b176cb17e5912d7e..3d7de01df9645837995ff6a0bd4329923d17ee70 100644
--- a/src/libminivector/vec3d.h
+++ b/src/libminivector/vec3d.h
@@ -47,6 +47,8 @@
 #include <math.h>
 #include <ostream>
 
+namespace vega
+{
 class Vec3d {
 
 public:
@@ -294,6 +296,6 @@ inline void Vec3d::print()
   
   printf("[%G %G %G]\n", a, b, c);
 }
-
+}
 #endif
 
diff --git a/src/libobjMesh/boundingBox.cpp b/src/libobjMesh/boundingBox.cpp
index de1688ebd5f04cf1f10e2a89cfbc2071ecbd816c..90b7f8f7b4a366ea61cf8d7e139ef94b8feac219 100644
--- a/src/libobjMesh/boundingBox.cpp
+++ b/src/libobjMesh/boundingBox.cpp
@@ -42,6 +42,8 @@ using namespace std;
 #include "boundingBox.h"
 #include "triangle.h"
 
+namespace vega
+{
 template<class Triangle> 
 BoundingBox::BoundingBox(vector<Triangle> & tripool)
 {
@@ -303,3 +305,4 @@ void BoundingBox::print()
 template BoundingBox::BoundingBox(vector<TriangleBasic> & tripool);
 template BoundingBox::BoundingBox(vector<TriangleWithCollisionInfo> & tripool);
 template BoundingBox::BoundingBox(vector<TriangleWithCollisionInfoAndPseudoNormals> & tripool);
+}
diff --git a/src/libobjMesh/boundingBox.h b/src/libobjMesh/boundingBox.h
index a0eb4e5756e301b0b89951813fd7294fbc60eb1d..61aec780641e5e5df6c34ab309799f3c05beac1a 100644
--- a/src/libobjMesh/boundingBox.h
+++ b/src/libobjMesh/boundingBox.h
@@ -39,6 +39,8 @@
 #include <vector>
 #include "minivector.h"
 
+namespace vega
+{
 class BoundingBox
 {
 public:
@@ -83,5 +85,5 @@ protected:
   Vec3d center_, halfSides_;
   Vec3d bmin_,bmax_;
 };
-
+}
 #endif
diff --git a/src/libobjMesh/objMesh-disjointSet.cpp b/src/libobjMesh/objMesh-disjointSet.cpp
index 6d37081ef80fe1222c68a288ece12e72a5511a1d..198ca0ed28f28bba1aba064d0801fa20e60dbb7a 100644
--- a/src/libobjMesh/objMesh-disjointSet.cpp
+++ b/src/libobjMesh/objMesh-disjointSet.cpp
@@ -30,6 +30,8 @@
 #include <stdlib.h>
 #include "objMesh-disjointSet.h"
 
+namespace vega
+{
 DisjointSet::DisjointSet(int num):disjointSetParent(NULL),size(0)
 {
   Resize(num);
@@ -120,3 +122,4 @@ void DisjointSet::UnionSet(int x, int y)
   }
 }
 
+}
diff --git a/src/libobjMesh/objMesh-disjointSet.h b/src/libobjMesh/objMesh-disjointSet.h
index 6f86061cd4caf0e9e3bbdcc21f9307673d9d7ba3..0e9105bcb9b8d826d5dbf598b20d5f5247127822 100644
--- a/src/libobjMesh/objMesh-disjointSet.h
+++ b/src/libobjMesh/objMesh-disjointSet.h
@@ -41,6 +41,8 @@
 #ifndef _DISJOINT_SET_H_
 #define _DISJOINT_SET_H_
 
+namespace vega
+{
 class DisjointSet
 {
 public:
@@ -73,6 +75,6 @@ protected:
   // destroys the data structure
   void Destroy();
 };
-
+}
 #endif
 
diff --git a/src/libobjMesh/objMesh.cpp b/src/libobjMesh/objMesh.cpp
index 7edc9e194111def2336687e56b0376aae4282b29..4f95dacc6d2d44d466b93a7ebc49d0fb9d8be2fa 100644
--- a/src/libobjMesh/objMesh.cpp
+++ b/src/libobjMesh/objMesh.cpp
@@ -47,6 +47,8 @@
 #include "objMesh.h"
 using namespace std;
 
+namespace vega
+{
 ObjMesh::ObjMesh(const std::string & filename_, int verbose)
 {
   filename = filename_;
@@ -3542,3 +3544,4 @@ int ObjMesh::usesTextureMapping()
   return result;
 }
 
+}
diff --git a/src/libobjMesh/objMesh.h b/src/libobjMesh/objMesh.h
index 3bb5e3223c97ed795f0e464a2067c3fc7a68820d..d350b53b1d03b68b8a3a37fff3df7a6c4600c541 100644
--- a/src/libobjMesh/objMesh.h
+++ b/src/libobjMesh/objMesh.h
@@ -43,6 +43,8 @@
 #include <assert.h>
 #include "minivector.h"
 
+namespace vega
+{
 /*
    This class stores a 3D surface mesh, loaded from an .obj file.  
    It makes it possible to access the mesh geometric primitives and perform
@@ -501,6 +503,6 @@ protected:
 
   static void fgets_(char * s, int n, FILE * stream);
 };
-
+}
 #endif
 
diff --git a/src/libobjMesh/objMeshBinaryLoader.cpp b/src/libobjMesh/objMeshBinaryLoader.cpp
index 1d140e3054f59dd80907d69a38bd695fa392ed1d..8677e7c5d36c67964f054aca2eeba91aff77eeb3 100644
--- a/src/libobjMesh/objMeshBinaryLoader.cpp
+++ b/src/libobjMesh/objMeshBinaryLoader.cpp
@@ -45,6 +45,8 @@ using namespace std;
 
 //#define VERBOSE
 
+namespace vega
+{
 int ObjMeshBinaryLoader::readStringFromBinary(std::string & name, std::ifstream * fin)
 {
   #ifdef VERBOSE
@@ -364,3 +366,4 @@ int ObjMeshBinaryLoader::writeToBinary(ObjMesh::Material * material, std::ofstre
   return 0;
 }
 
+}
diff --git a/src/libobjMesh/objMeshBinaryLoader.h b/src/libobjMesh/objMeshBinaryLoader.h
index b5edab57c27c3c3f6195e81b59982834de9ca053..13f8f8ef9f0eb4288d07bcdb1b92bc74e5b6ec8c 100644
--- a/src/libobjMesh/objMeshBinaryLoader.h
+++ b/src/libobjMesh/objMeshBinaryLoader.h
@@ -37,6 +37,8 @@
 #include "objMesh.h"
 #include <string>
 
+namespace vega
+{
 class ObjMeshBinaryLoader
 {
 public:
@@ -58,6 +60,6 @@ protected:
   static int writeStringToBinary(const std::string name, std::ofstream * fout);
   static int writeVec3dToBinary(Vec3d & vec, std::ofstream * fout);
 };
-
+}
 #endif
 
diff --git a/src/libobjMesh/objMeshEncode.cpp b/src/libobjMesh/objMeshEncode.cpp
index 0824cc7c0dbce6bd8cbd1c642a40be450120ab2f..1a626f79765e35211449f8cba59a528548589ad4 100644
--- a/src/libobjMesh/objMeshEncode.cpp
+++ b/src/libobjMesh/objMeshEncode.cpp
@@ -28,6 +28,8 @@
 
 #include "objMeshEncode.h"
 
+namespace vega
+{
 void objMeshEncode(ObjMesh * mesh)
 {
 }
@@ -35,4 +37,4 @@ void objMeshEncode(ObjMesh * mesh)
 void objMeshDecode(ObjMesh * mesh)
 {
 }
-
+}
diff --git a/src/libobjMesh/objMeshEncode.h b/src/libobjMesh/objMeshEncode.h
index b7e7a92430d1a98fafe4b01bcdd76bff59301989..8fb4a43b7897d922e0dc3ab052676265383f7fa1 100644
--- a/src/libobjMesh/objMeshEncode.h
+++ b/src/libobjMesh/objMeshEncode.h
@@ -28,6 +28,8 @@
 
 #include "objMesh.h"
 
+namespace vega
+{
 void objMeshEncode(ObjMesh * mesh);
 void objMeshDecode(ObjMesh * mesh);
-
+}
diff --git a/src/libobjMesh/objMeshGraph.cpp b/src/libobjMesh/objMeshGraph.cpp
index af6ad67492f5b9d12e25b858ce546214e4d0308a..0c400cc86140c311f1c229576320c8e0cf288399 100644
--- a/src/libobjMesh/objMeshGraph.cpp
+++ b/src/libobjMesh/objMeshGraph.cpp
@@ -2,6 +2,8 @@
 #include "objMeshGraph.h"
 using namespace std;
 
+namespace vega
+{
 ObjMeshGraph::ObjMeshGraph(ObjMesh * objMesh_): objMesh(objMesh_)
 {
   if (!(objMesh->isTriangularMesh()))
@@ -281,3 +283,4 @@ Graph * ObjMeshGraph::GenerateVertexGraph(ObjMesh * objMesh, int faceClique)
   #undef SORTED
 }
 
+}
diff --git a/src/libobjMesh/objMeshGraph.h b/src/libobjMesh/objMeshGraph.h
index 5e20c3805bcb0eb8105d76b523af0700a5dff5d2..abdc0fbfbefe85e98bf13efd1e55d310cf6af7a4 100644
--- a/src/libobjMesh/objMeshGraph.h
+++ b/src/libobjMesh/objMeshGraph.h
@@ -15,6 +15,8 @@
 #include "graph.h"
 #include "objMesh.h"
 
+namespace vega
+{
 class ObjMeshGraph : public Graph
 {
 public:
@@ -67,6 +69,6 @@ inline int ObjMeshGraph::GetFaceID(int face)
 {
   return nObj + eObj + face;
 }
-
+}
 #endif
 
diff --git a/src/libobjMesh/objMeshOrientable.cpp b/src/libobjMesh/objMeshOrientable.cpp
index b876611d178e07ff71fb29efa19ecd6506a65109..7c41c07c352665412a428ce66cb97f9376ff4b95 100644
--- a/src/libobjMesh/objMeshOrientable.cpp
+++ b/src/libobjMesh/objMeshOrientable.cpp
@@ -44,6 +44,8 @@
 using namespace std;
 #include "objMeshOrientable.h"
 
+namespace vega
+{
 /*
   Generates a half edge datastructure, assuming tha the given obj mesh is orientable.
   Author: Jernej Barbic, 2004
@@ -653,3 +655,4 @@ ObjMesh * ObjMeshOrientable::GenerateOrientedMesh()
 
   return outputObjMesh;
 }
+}
diff --git a/src/libobjMesh/objMeshOrientable.h b/src/libobjMesh/objMeshOrientable.h
index 9a0e5f6a58fe17385513f247f908b20fe5edfe11..abcbb65691860fdc09a11440e951a41f890e95aa 100644
--- a/src/libobjMesh/objMeshOrientable.h
+++ b/src/libobjMesh/objMeshOrientable.h
@@ -31,6 +31,8 @@
 
 #include "objMesh.h"
 
+namespace vega
+{
 /*
   Generates a half edge datastructure, assuming tha the given obj mesh is orientable.
   Author: Jernej Barbic, 2004
@@ -190,6 +192,6 @@ public:
 
   int internalAllocation;
 };
-
+}
 #endif
 
diff --git a/src/libobjMesh/simpleSphere.cpp b/src/libobjMesh/simpleSphere.cpp
index 04540ba15a7fc3c645e421e06aa856fc39b6c431..a79c72d897c2aa865d1f67b2538d2b27a04a5bdd 100644
--- a/src/libobjMesh/simpleSphere.cpp
+++ b/src/libobjMesh/simpleSphere.cpp
@@ -28,6 +28,8 @@
 
 #include "simpleSphere.h"
 
+namespace vega
+{
 /*
   A sphere
   Author: Jernej Barbic, CMU
@@ -60,4 +62,4 @@ bool SimpleSphere::doesBoundingBoxIntersect(BoundingBox & box) const
   return (dmin <= radius * radius);
 }
     
-
+}
diff --git a/src/libobjMesh/simpleSphere.h b/src/libobjMesh/simpleSphere.h
index dd28a854b71af5f98b1890b567b83ad3d5d5b5ee..ab317d434e68b60a1dd889ed071fad8d246b97be 100644
--- a/src/libobjMesh/simpleSphere.h
+++ b/src/libobjMesh/simpleSphere.h
@@ -41,6 +41,8 @@
 #include "minivector.h"
 #include "boundingBox.h"
 
+namespace vega
+{
 class SimpleSphere
 {
 public:
@@ -55,6 +57,6 @@ private:
   Vec3d center;
   double radius;
 };
-
+}
 #endif
 
diff --git a/src/libobjMesh/tribox3.cpp b/src/libobjMesh/tribox3.cpp
index b0860e91ed8cac0c355c71d3999194bf722a6e76..eb5b51410c2ab593225ff9f0fa320ca85d2c57b4 100644
--- a/src/libobjMesh/tribox3.cpp
+++ b/src/libobjMesh/tribox3.cpp
@@ -33,6 +33,8 @@
 #include "matrixMultiplyMacros.h"
 using namespace std;
 
+namespace vega
+{
 /*
   Tests if a 3D triangle overlaps with a 3D box.
 
@@ -204,3 +206,4 @@ bool triBoxOverlap(double boxcenter[3], double boxhalfsize[3], double triverts[3
   return overlap;
 }
 
+}
diff --git a/src/libobjMesh/tribox3.h b/src/libobjMesh/tribox3.h
index 817ffb6d5f815e9bf1c1c4a6d21dfec74345ef60..738a2996a8f578e34634d7bcb5c118e9de008b97 100644
--- a/src/libobjMesh/tribox3.h
+++ b/src/libobjMesh/tribox3.h
@@ -39,7 +39,9 @@ e.
 #ifndef _TRIBOX3_H_
 #define _TRIBOX3_H_
 
+namespace vega
+{
 bool triBoxOverlap(double boxcenter[3],double boxhalfsize[3],double triverts[3][3]);
-
+}
 #endif
 
diff --git a/src/libperformanceCounter/performanceCounter.cpp b/src/libperformanceCounter/performanceCounter.cpp
index 21f6c16ff773bd2f5e56bd54c15243261ccf849d..4276cf6768b6b5076ab64092f5ddc6c95da49a3a 100644
--- a/src/libperformanceCounter/performanceCounter.cpp
+++ b/src/libperformanceCounter/performanceCounter.cpp
@@ -1 +1,3 @@
 #include "performanceCounter.h"
+
+namespace vega {}
diff --git a/src/libperformanceCounter/performanceCounter.h b/src/libperformanceCounter/performanceCounter.h
index 185ad7cd0565b57d2bd8784b37376b3647cd435e..c3ee321f126b5826f5fb230aa65cfcb80b8e6786 100644
--- a/src/libperformanceCounter/performanceCounter.h
+++ b/src/libperformanceCounter/performanceCounter.h
@@ -62,6 +62,8 @@ Version: 1.0
 #include "stdlib.h"
 #include "sys/time.h"
 
+namespace vega
+{
 class PerformanceCounter
 {
 public:
@@ -104,7 +106,7 @@ inline double PerformanceCounter::GetElapsedTime()
   float elapsedTime = 1.0 * (stopCountSec-startCountSec) + 1E-6 * (stopCountMicroSec - startCountMicroSec);
   return elapsedTime;
 }
-
+}
 #endif
 
 #ifdef WIN32
@@ -113,6 +115,8 @@ inline double PerformanceCounter::GetElapsedTime()
 
 #include <windows.h>
 
+namespace vega
+{
 class PerformanceCounter
 {
 public:
@@ -151,7 +155,7 @@ inline double PerformanceCounter::GetElapsedTime()
   return ((double)(stopCount.QuadPart - startCount.QuadPart))
     / ((double)timerFrequency.QuadPart);
 }
-
+}
 #endif
 #endif
 
diff --git a/src/libpolarDecomposition/polarDecomposition.cpp b/src/libpolarDecomposition/polarDecomposition.cpp
index 6769412f151ff1810c72974bb69f6b96576239eb..1a3a791ef76fb06469ebb73f713e601ce5973de3 100644
--- a/src/libpolarDecomposition/polarDecomposition.cpp
+++ b/src/libpolarDecomposition/polarDecomposition.cpp
@@ -2,6 +2,8 @@
 #include <math.h>
 #include "polarDecomposition.h"
 
+namespace vega
+{
 /*
   See polarDecomposition.h for license information.
 */
@@ -107,3 +109,4 @@ double PolarDecomposition::Compute(const double * M, double * Q, double * S, dou
   return (det);
 }
 
+}
diff --git a/src/libpolarDecomposition/polarDecomposition.h b/src/libpolarDecomposition/polarDecomposition.h
index bfb1bd213e4414e46a8ea15a681e12c68f23544e..f0c96c5d552ab6f1e11a7a21785d85cfb3fb6338 100644
--- a/src/libpolarDecomposition/polarDecomposition.h
+++ b/src/libpolarDecomposition/polarDecomposition.h
@@ -1,6 +1,8 @@
 #ifndef _POLARDECOMPOSITION_H_
 #define _POLARDECOMPOSITION_H_
 
+namespace vega
+{
 /*
   Polar decomposition of a general 3x3 matrix
 
@@ -52,6 +54,6 @@ inline void PolarDecomposition::crossProduct(const double * a, const double * b,
   c[1] = a[2] * b[0] - a[0] * b[2];
   c[2] = a[0] * b[1] - a[1] * b[0];
 }
-
+}
 #endif
 
diff --git a/src/libpolarDecomposition/polarDecompositionGradient.cpp b/src/libpolarDecomposition/polarDecompositionGradient.cpp
index 7930042af29830d16239d81810f88c9799879325..1e1367b1881362463ae97d4efd6ed05f7a052bb4 100644
--- a/src/libpolarDecomposition/polarDecompositionGradient.cpp
+++ b/src/libpolarDecomposition/polarDecompositionGradient.cpp
@@ -53,6 +53,8 @@
 #include "matrixMultiplyMacros.h"
 #include "mat3d.h"
 
+namespace vega
+{
 void PolarDecompositionGradient::Compute(const double * M, const double * Q, const double * S, const double * MDot, double * omega, double * QDot, double * SDot, const double * MDotDot, double * omegaDot, double * QDotDot)
 {
   // compute omega = G^{-1} (2 * skew(Q^T * MDot)), where G = (tr(S)I - S) * Q^T
@@ -146,3 +148,4 @@ void PolarDecompositionGradient::Compute(const double * M, const double * Q, con
   }
 }
 
+}
diff --git a/src/libpolarDecomposition/polarDecompositionGradient.h b/src/libpolarDecomposition/polarDecompositionGradient.h
index f61a569c9e707df8fd0a849973f6e709158c7895..ca84b4264241f63f2a2b55deff2fd32f092cc3f3 100644
--- a/src/libpolarDecomposition/polarDecompositionGradient.h
+++ b/src/libpolarDecomposition/polarDecompositionGradient.h
@@ -54,6 +54,8 @@
 
 #include <stdlib.h>
 
+namespace vega
+{
 class PolarDecompositionGradient
 {
 public:
@@ -85,6 +87,6 @@ public:
 protected:
 
 };
-
+}
 #endif
 
diff --git a/src/libquaternion/quaternion.cpp b/src/libquaternion/quaternion.cpp
index 70bf3d37da3dbceff12625b20b94f44f13fc77bd..c59c9de3bd34a5675b64a682b17bcf5cb57f5bab 100644
--- a/src/libquaternion/quaternion.cpp
+++ b/src/libquaternion/quaternion.cpp
@@ -28,6 +28,8 @@
 
 #include "quaternion.h"
 
+namespace vega
+{
 /*
   See David Baraff's SIGGRAPH course notes for the description of the method below:
   "An Introduction to Physically Based Modeling:
@@ -108,3 +110,4 @@ Quaternion<real> Quaternion<real>::Matrix2Quaternion(real * R)
 template Quaternion<double> Quaternion<double>::Matrix2Quaternion(double * R);
 template Quaternion<float> Quaternion<float>::Matrix2Quaternion(float * R);
 
+}
diff --git a/src/libquaternion/quaternion.h b/src/libquaternion/quaternion.h
index 2408d3bf940783e2251743abd1b21d48b5a44c49..b6392d2bdf3a46b74fa4d50aa98c3ac44032375a 100644
--- a/src/libquaternion/quaternion.h
+++ b/src/libquaternion/quaternion.h
@@ -50,6 +50,8 @@
 #include <stdio.h>
 #include <math.h>
 
+namespace vega
+{
 // forward declarations for the friend template
 template <typename real> class Quaternion;
 template <typename real> Quaternion<real> operator* (real alpha, Quaternion<real> q2);
@@ -369,6 +371,6 @@ inline void Quaternion<real>::Print() const
 {
   printf("%f + %fi + %fj + %fk\n",s,x,y,z);
 }
-
+}
 #endif
 
diff --git a/src/librigidBodyDynamics/rigidBody.cpp b/src/librigidBodyDynamics/rigidBody.cpp
index 45f508017e244fbea37409278f603ea100c88453..00f0eb890219ab8f45d51def6c993c062a1f1553 100644
--- a/src/librigidBodyDynamics/rigidBody.cpp
+++ b/src/librigidBodyDynamics/rigidBody.cpp
@@ -28,6 +28,8 @@
 
 #include "rigidBody.h"
 
+namespace vega
+{
 RigidBody::RigidBody(double mass, double inertiaTensorAtRestX, double inertiaTensorAtRestY, double inertiaTensorAtRestZ)
 {
   this->mass=mass;
@@ -228,3 +230,4 @@ void RigidBody::SetRotationalDamping(double rotationalDampingCoef)
   this->rotationalDampingCoef = rotationalDampingCoef;
 }
 
+}
diff --git a/src/librigidBodyDynamics/rigidBody.h b/src/librigidBodyDynamics/rigidBody.h
index f43cd790dc30e3dee134bb5bd6891bde87399d91..0be34d4327fe346a35fe1b17fb8591c740c9d73f 100644
--- a/src/librigidBodyDynamics/rigidBody.h
+++ b/src/librigidBodyDynamics/rigidBody.h
@@ -151,6 +151,8 @@ or 4th order. Add support for impulses.
 #include <string.h>
 #include "quaternion.h"
 
+namespace vega
+{
 class RigidBody
 {
 public:
@@ -481,6 +483,6 @@ inline void RigidBody::ResetBodyToRest()
   angularVelocityX = angularVelocityY = angularVelocityZ = 0;
   angularMomentumX = angularMomentumY = angularMomentumZ = 0;
 }
-
+}
 #endif
 
diff --git a/src/librigidBodyDynamics/rigidBody_generalTensor.cpp b/src/librigidBodyDynamics/rigidBody_generalTensor.cpp
index a6552248bc00f95eb27da082f78d6a53ca6b9e6b..cfc8a2d117757db23f2cbc82b6bc36a8c6c1853c 100644
--- a/src/librigidBodyDynamics/rigidBody_generalTensor.cpp
+++ b/src/librigidBodyDynamics/rigidBody_generalTensor.cpp
@@ -29,6 +29,8 @@
 #include "rigidBody_generalTensor.h"
 #include "matrixMultiplyMacros.h"
 
+namespace vega
+{
 RigidBody_GeneralTensor::RigidBody_GeneralTensor(double mass, double inertiaTensorAtRest[9]):
   RigidBody(mass,inertiaTensorAtRest[0],inertiaTensorAtRest[4],inertiaTensorAtRest[8])
 { 
@@ -166,3 +168,4 @@ void RigidBody_GeneralTensor::GetInverseInertiaTensorAtRest(double * inverseIner
   MATRIX_SET3X3(inverseInertiaTensorAtRest_, inverseInertiaTensorAtRest);
 }
 
+}
diff --git a/src/librigidBodyDynamics/rigidBody_generalTensor.h b/src/librigidBodyDynamics/rigidBody_generalTensor.h
index b4c4d04cd011ba31bafb421eb5baa99067b9e43e..676f1b4b5e0edf5dd5e609623abcc50a36c7dc70 100644
--- a/src/librigidBodyDynamics/rigidBody_generalTensor.h
+++ b/src/librigidBodyDynamics/rigidBody_generalTensor.h
@@ -44,6 +44,8 @@
 
 #include "rigidBody.h"
 
+namespace vega
+{
 class RigidBody_GeneralTensor : public RigidBody
 {
 public:
@@ -74,6 +76,6 @@ protected:
   double inverseInertiaTensorAtRest[9]; 
 
 };
-
+}
 #endif
 
diff --git a/src/libsparseMatrix/sparseMatrix.cpp b/src/libsparseMatrix/sparseMatrix.cpp
index cd232939e25f84a7bb0930d7bfba09e70ad24e10..f5eb4c1686950a837c26d108c1d6b93892dd5e9d 100644
--- a/src/libsparseMatrix/sparseMatrix.cpp
+++ b/src/libsparseMatrix/sparseMatrix.cpp
@@ -33,6 +33,8 @@
 #include "sparseMatrix.h"
 using namespace std;
 
+namespace vega
+{
 SparseMatrixOutline::SparseMatrixOutline(int numRows_): numRows(numRows_)
 {
   Allocate();
@@ -1929,3 +1931,4 @@ SparseMatrix * SparseMatrix::CreateIdentityMatrix(int numRows)
   return mat;
 }
 
+}
diff --git a/src/libsparseMatrix/sparseMatrix.h b/src/libsparseMatrix/sparseMatrix.h
index 37e8f43fd976c08276d8015c66a2696e9d6f2f7e..6a632e80b0f01ec0964c43ea5a5ab21af79258ec 100644
--- a/src/libsparseMatrix/sparseMatrix.h
+++ b/src/libsparseMatrix/sparseMatrix.h
@@ -101,6 +101,8 @@
 #include <vector>
 #include <map>
 
+namespace vega
+{
 class SparseMatrix;
 
 class SparseMatrixOutline
@@ -383,6 +385,6 @@ protected:
   void Allocate();
   void BuildRenumberingVector(int nConstrained, int nSuper, int numFixedDOFs, int * fixedDOFs, int ** superDOFs, int oneIndexed=0);
 };
-
+}
 #endif
 
diff --git a/src/libsparseMatrix/sparseMatrixMT.cpp b/src/libsparseMatrix/sparseMatrixMT.cpp
index 2622502325ce23d9d98f689b830c54d547356a5d..387557bc9b39369bd354cc42d421b40c8971f751 100644
--- a/src/libsparseMatrix/sparseMatrixMT.cpp
+++ b/src/libsparseMatrix/sparseMatrixMT.cpp
@@ -42,6 +42,8 @@ using namespace std;
   #include <omp.h>
 #endif
 
+namespace vega
+{
 void SparseMatrixMT::MultiplyVector(const SparseMatrix * A, const double * input, double * result, int numThreads)
 {
   int ** indices = A->GetColumnIndices();
@@ -68,4 +70,4 @@ void SparseMatrixMT::MultiplyVector(const SparseMatrix * A, const double * input
   }
 }
 
-
+}
diff --git a/src/libsparseMatrix/sparseMatrixMT.h b/src/libsparseMatrix/sparseMatrixMT.h
index b1071a7db74a6e0204c49795e142b8feeb18dd42..464170fd1dfdc6c755ba55c6b8baa362a8b53384 100644
--- a/src/libsparseMatrix/sparseMatrixMT.h
+++ b/src/libsparseMatrix/sparseMatrixMT.h
@@ -36,6 +36,8 @@
 
 #include "sparseMatrix.h"
 
+namespace vega
+{
 class SparseMatrixMT
 {
 public:
@@ -43,6 +45,6 @@ public:
   // multiplies the sparse matrix with the given vector
   static void MultiplyVector(const SparseMatrix * A, const double * input, double * result, int numThreads=-1); // result = A * input
 };
-
+}
 #endif
 
diff --git a/src/libsparseSolver/CGSolver.cpp b/src/libsparseSolver/CGSolver.cpp
index 62ccb8963c7aee1c3d37efb8e7f1edfca9914d11..fff8078daa9f2a29a899b104c566282c36299f30 100644
--- a/src/libsparseSolver/CGSolver.cpp
+++ b/src/libsparseSolver/CGSolver.cpp
@@ -31,6 +31,8 @@
 #include <stdio.h>
 #include "CGSolver.h"
 
+namespace vega
+{
 CGSolver::CGSolver(SparseMatrix * A_): A(A_), numIterations(10000), epsilon(1e-6)
 {
   numRows = A->GetNumRows();
@@ -252,3 +254,4 @@ double CGSolver::getEpsilon() const
   return this->epsilon;
 }
 
+}
diff --git a/src/libsparseSolver/CGSolver.h b/src/libsparseSolver/CGSolver.h
index 20f9ff6daefed6ea6cdf90408aae34233508f61c..dacc117d5c48b2659ac2a0ed7558cbc8aef8e28d 100755
--- a/src/libsparseSolver/CGSolver.h
+++ b/src/libsparseSolver/CGSolver.h
@@ -49,6 +49,8 @@
 #include "linearSolver.h"
 #include "sparseMatrix.h"
 
+namespace vega
+{
 class CGSolver : public LinearSolver
 {
 public:
@@ -109,6 +111,6 @@ protected:
   static void DefaultMultiplicator(const void * data, const double * x, double * Ax);
   void InitBuffers();
 };
-
+}
 #endif
 
diff --git a/src/libsparseSolver/PardisoSolver.cpp b/src/libsparseSolver/PardisoSolver.cpp
index 33b937f557b71587676754f11bef1ad2bb2c40b2..a27991a31dee3b9e6ceb8d3f4a97be4f56abd40f 100644
--- a/src/libsparseSolver/PardisoSolver.cpp
+++ b/src/libsparseSolver/PardisoSolver.cpp
@@ -43,6 +43,8 @@
 #include "PardisoSolver.h"
 #include "sparseSolverAvailability.h"
 
+namespace vega
+{
 #ifdef PARDISO_SOLVER_IS_AVAILABLE
 
 // Pardiso solver is available
@@ -409,6 +411,6 @@ MKL_INT PardisoSolver::SolveLinearSystemDirectIterative(const SparseMatrix * A,
   DisabledSolverError();
   return 1;
 }
-
+}
 #endif
 
diff --git a/src/libsparseSolver/PardisoSolver.h b/src/libsparseSolver/PardisoSolver.h
index bc702c9ad2896929d819956a52a62c62d11f1d04..851aca762b7143102ab99dd61ef0557fef94c87d 100644
--- a/src/libsparseSolver/PardisoSolver.h
+++ b/src/libsparseSolver/PardisoSolver.h
@@ -43,6 +43,8 @@
 #include "linearSolver.h"
 #include "sparseMatrix.h"
 
+namespace vega
+{
 #define MKL_INT int
 
 class PardisoSolver : public LinearSolver
@@ -94,6 +96,6 @@ protected:
 
   static void DisabledSolverError();
 };
-
+}
 #endif
 
diff --git a/src/libsparseSolver/SPOOLESSolver.cpp b/src/libsparseSolver/SPOOLESSolver.cpp
index 1eefe4d50e9114fdb96027ea483c941d7d420716..876973aea66403d3e5a722fc088e5a10b20fad30 100644
--- a/src/libsparseSolver/SPOOLESSolver.cpp
+++ b/src/libsparseSolver/SPOOLESSolver.cpp
@@ -46,6 +46,8 @@
 #include "SPOOLESSolver.h"
 #include "sparseSolverAvailability.h"
 
+namespace vega
+{
 #ifdef SPOOLES_SOLVER_IS_AVAILABLE
 
 // SPOOLES solver is available
@@ -209,6 +211,6 @@ int SPOOLESSolver::SolveLinearSystem(double * x, const double * rhs)
   DisabledSolverError();
   return 1;
 }
-
+}
 #endif
 
diff --git a/src/libsparseSolver/SPOOLESSolver.h b/src/libsparseSolver/SPOOLESSolver.h
index 124f279b5f7d5cd204cfe16989eb90d8dfeadd37..81ab30e7a516c4932be980d44d4c8d68bc174207 100644
--- a/src/libsparseSolver/SPOOLESSolver.h
+++ b/src/libsparseSolver/SPOOLESSolver.h
@@ -51,6 +51,8 @@
 #include "linearSolver.h"
 #include "sparseMatrix.h"
 
+namespace vega
+{
 class SPOOLESSolver : public LinearSolver
 {
 public:
@@ -76,6 +78,6 @@ protected:
 
   static void DisabledSolverError();
 };
-
+}
 #endif
 
diff --git a/src/libsparseSolver/SPOOLESSolverMT.cpp b/src/libsparseSolver/SPOOLESSolverMT.cpp
index 692515fd06133abae7b26060cd9245e22d188016..e9e5611767d4c60e107c1dbda7c4116617c34170 100644
--- a/src/libsparseSolver/SPOOLESSolverMT.cpp
+++ b/src/libsparseSolver/SPOOLESSolverMT.cpp
@@ -30,6 +30,8 @@
 #include "SPOOLESSolver.h"
 #include "sparseSolverAvailability.h"
 
+namespace vega
+{
 #ifdef SPOOLES_SOLVER_IS_AVAILABLE
 
 // SPOOLES solver is available
@@ -276,6 +278,6 @@ int SPOOLESSolverMT::SolveLinearSystem(double * x, const double * rhs)
   DisabledSolverError();
   return 1;
 }
-
+}
 #endif
 
diff --git a/src/libsparseSolver/SPOOLESSolverMT.h b/src/libsparseSolver/SPOOLESSolverMT.h
index d88befb3f2a1d6ebde60ee2ed694381eb19e9fcc..3bb61cdb1907302125343c006a09c7826bde9f6f 100644
--- a/src/libsparseSolver/SPOOLESSolverMT.h
+++ b/src/libsparseSolver/SPOOLESSolverMT.h
@@ -50,6 +50,8 @@ However, for very large systems (e.g. 200,000 x 200,000 matrices on a
 #include "sparseMatrix.h"
 #include "linearSolver.h"
 
+namespace vega
+{
 class SPOOLESSolverMT : public LinearSolver
 {
 public:
@@ -76,6 +78,6 @@ protected:
 
   static void DisabledSolverError();
 };
-
+}
 #endif
 
diff --git a/src/libsparseSolver/invMKSolver.cpp b/src/libsparseSolver/invMKSolver.cpp
index 5d4ead7bc5cf9ac65f3677b6cedb1ec6ad09e86f..91dcea94f4c9ec7b6c6c6301d0c15838d94c071a 100644
--- a/src/libsparseSolver/invMKSolver.cpp
+++ b/src/libsparseSolver/invMKSolver.cpp
@@ -36,6 +36,8 @@
 #include <string.h>
 #include "invMKSolver.h"
 
+namespace vega
+{
 InvMKSolver::InvMKSolver(LinearSolver * invMSolver, SparseMatrix * K)
 {
   this->invMSolver = invMSolver;
@@ -55,3 +57,4 @@ void InvMKSolver::ComputeInvMK(double * x, double * output)
   memcpy(x, buffer, sizeof(double) * K->Getn());
   invMSolver->SolveLinearSystem(output, buffer);
 }
+}
diff --git a/src/libsparseSolver/invMKSolver.h b/src/libsparseSolver/invMKSolver.h
index 8162f5be4e7f132e13607914596eaf334aa22d83..108ff2ca257feea172d941b6ae063f8c15826d2a 100644
--- a/src/libsparseSolver/invMKSolver.h
+++ b/src/libsparseSolver/invMKSolver.h
@@ -37,6 +37,8 @@
 #include "linearSolver.h"
 #include "sparseMatrix.h"
 
+namespace vega
+{
 // computes x |--> M^{-1} K x
 class InvMKSolver
 {
@@ -50,5 +52,5 @@ protected:
   LinearSolver * invMSolver;
   SparseMatrix * K;
 };
-
+}
 #endif
diff --git a/src/libsparseSolver/linearSolver.cpp b/src/libsparseSolver/linearSolver.cpp
index 43800926d339e06d791b6cd001b1bd0373d37bc5..c046fe44797092629785cc14d712ecc9fda4b78f 100644
--- a/src/libsparseSolver/linearSolver.cpp
+++ b/src/libsparseSolver/linearSolver.cpp
@@ -28,6 +28,8 @@
 
 #include "linearSolver.h"
 
+namespace vega
+{
 LinearSolver::~LinearSolver() {}
 const std::string& LinearSolver::getSolverType() const
 {
@@ -38,3 +40,4 @@ void LinearSolver::setSolverType ( std::string& type )
     this->solverType = type;
 }
 
+}
diff --git a/src/libsparseSolver/linearSolver.h b/src/libsparseSolver/linearSolver.h
index 9d2a81cc89a94b84b08b419842cd8fccbbdfde3e..a3bed330a6350bdf1d3488b70c0b97c667bb84fc 100644
--- a/src/libsparseSolver/linearSolver.h
+++ b/src/libsparseSolver/linearSolver.h
@@ -40,6 +40,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+namespace vega
+{
 class LinearSolver
 {
 public:
@@ -55,6 +57,6 @@ public:
 protected:
   std::string solverType;
 };
-
+}
 #endif
 
diff --git a/src/libstvk/StVKCubeABCD.cpp b/src/libstvk/StVKCubeABCD.cpp
index afc505a0d36f620878958fac5e89bf9fa59f78a5..8a76611cefccfcd4f7f2a26815b58d3becc0bdab 100644
--- a/src/libstvk/StVKCubeABCD.cpp
+++ b/src/libstvk/StVKCubeABCD.cpp
@@ -29,6 +29,8 @@
 #include "StVKCubeABCD.h"
 #include "cubicMeshIntegrals.cpp"
 
+namespace vega
+{
 StVKCubeABCD::StVKCubeABCD(double cubeSize)
 {
   double * rawIntegrals = cubicMeshIntegrals;
@@ -74,3 +76,4 @@ StVKCubeABCD::StVKCubeABCD(double cubeSize)
         }
 }
 
+}
diff --git a/src/libstvk/StVKCubeABCD.h b/src/libstvk/StVKCubeABCD.h
index 8919a74d1a9cf535e97e849eba06c21fdc639a79..bb93d5b69d89c66e18db340b9e6683044e440e10 100644
--- a/src/libstvk/StVKCubeABCD.h
+++ b/src/libstvk/StVKCubeABCD.h
@@ -31,6 +31,8 @@
 
 #include "StVKElementABCD.h"
 
+namespace vega
+{
 /*
   This classes stores the St.Venant-Kirchhoff A,B,C,D coefficients for a cube element.
   See also StVKInternalForces.h .
@@ -56,6 +58,6 @@ protected:
   Vec3d C_[8][8][8];
   double D_[8][8][8][8];
 };
-
+}
 #endif
 
diff --git a/src/libstvk/StVKElementABCD.cpp b/src/libstvk/StVKElementABCD.cpp
index 5324f46f3d9f100a0a6bb579bbf0ed9a37da8df7..a4b3249789b8e7defa7c43d34fcba3689604ca01 100644
--- a/src/libstvk/StVKElementABCD.cpp
+++ b/src/libstvk/StVKElementABCD.cpp
@@ -29,6 +29,8 @@
 #include <stdlib.h>
 #include "StVKElementABCD.h"
 
+namespace vega
+{
 void StVKElementABCD::AllocateElementIterator(void ** elementIterator)
 {
   *elementIterator = (void*)(int*) malloc (sizeof(int));
@@ -44,3 +46,4 @@ void StVKElementABCD::PrepareElement(int el, void * elementIterator) // must cal
   *(int*) elementIterator = el;
 }
 
+}
diff --git a/src/libstvk/StVKElementABCD.h b/src/libstvk/StVKElementABCD.h
index 5b491895380de1916db93d6e6fa3fa96a7d24d41..628520d643bd4b1cc04884408b2eefdd1d5a70e9 100644
--- a/src/libstvk/StVKElementABCD.h
+++ b/src/libstvk/StVKElementABCD.h
@@ -31,6 +31,8 @@
 
 #include "minivector.h"
 
+namespace vega
+{
 /*
   This abstract class serves as storage space for the St.Venant-Kirchhoff A,B,C,D coefficients for a mesh element. 
   See also StVKInternalForces.h .
@@ -54,6 +56,6 @@ public:
 
 protected:
 };
-
+}
 #endif
 
diff --git a/src/libstvk/StVKElementABCDLoader.cpp b/src/libstvk/StVKElementABCDLoader.cpp
index 4782fe8bcd9b3dbce6d02cc012fb60d7c7d9b871..32b328b4c91a08cb0f5afaa854a9b8b46e7fb7bb 100644
--- a/src/libstvk/StVKElementABCDLoader.cpp
+++ b/src/libstvk/StVKElementABCDLoader.cpp
@@ -33,6 +33,8 @@
 #include "cubicMesh.h"
 #include "tetMesh.h"
 
+namespace vega
+{
 StVKElementABCD * StVKElementABCDLoader::load(VolumetricMesh * volumetricMesh, unsigned int loadingFlag)
 {
   if (volumetricMesh == NULL)
@@ -75,4 +77,4 @@ StVKElementABCD * StVKElementABCDLoader::load(VolumetricMesh * volumetricMesh, u
 
   return stVKElementABCD;
 }
-
+}
diff --git a/src/libstvk/StVKElementABCDLoader.h b/src/libstvk/StVKElementABCDLoader.h
index 1214590dfe4f201c80431627b5949aa007e0b11f..f0cb90984b3bcf48980149c6ee194e1ffc929da0 100644
--- a/src/libstvk/StVKElementABCDLoader.h
+++ b/src/libstvk/StVKElementABCDLoader.h
@@ -37,6 +37,8 @@
 #include "volumetricMesh.h"
 #include "StVKElementABCD.h"
 
+namespace vega
+{
 class StVKElementABCDLoader
 {
 public:
@@ -46,6 +48,6 @@ public:
   //   1 : use the high-memory version (only applies with tet meshes); with this setting, computation speeds will be higher, at the expense of more memory (however, difference is typically not large and speeds might even decrease with large meshes when running out of memory)
   static StVKElementABCD * load(VolumetricMesh * volumetricMesh, unsigned int loadingFlag=0); 
 };
-
+}
 #endif
 
diff --git a/src/libstvk/StVKHessianTensor.cpp b/src/libstvk/StVKHessianTensor.cpp
index a9bb6356c190f61334cf2f1c3de384f8eba0a093..be87f3fb289db0e4b8b48bb13a9120e2ce8ae627 100644
--- a/src/libstvk/StVKHessianTensor.cpp
+++ b/src/libstvk/StVKHessianTensor.cpp
@@ -29,6 +29,8 @@
 #include "StVKHessianTensor.h"
 #include "volumetricMeshENuMaterial.h"
 
+namespace vega
+{
 #define QUADRATICFORM(m,x,y)\
   m[0] * x[0] * y[0] + \
   m[1] * x[1] * y[0] + \
@@ -676,3 +678,4 @@ void StVKHessianTensor::AddCubicTermsContribution(double * u, double * du, Spars
 }
 
 
+}
diff --git a/src/libstvk/StVKHessianTensor.h b/src/libstvk/StVKHessianTensor.h
index e585e7c4b24a3275817679ff2fe0ef6542cc8676..8b2a6f51adb1e51883711fbf1b3c17f33e2e0ed4 100644
--- a/src/libstvk/StVKHessianTensor.h
+++ b/src/libstvk/StVKHessianTensor.h
@@ -40,6 +40,8 @@
 #include "StVKElementABCD.h"
 #include "StVKStiffnessMatrix.h"
 
+namespace vega
+{
 class StVKHessianTensor
 {
 public:
@@ -92,6 +94,6 @@ protected:
   double * lambdaLame;
   double * muLame;
 };
-
+}
 #endif
 
diff --git a/src/libstvk/StVKInternalForces.cpp b/src/libstvk/StVKInternalForces.cpp
index 8d774d0406c7c152017f4222923acb26fefc6057..2eb29a31df85af9d10879fb0c122d6d01335ebed 100644
--- a/src/libstvk/StVKInternalForces.cpp
+++ b/src/libstvk/StVKInternalForces.cpp
@@ -29,6 +29,8 @@
 #include "StVKInternalForces.h"
 #include "volumetricMeshENuMaterial.h"
 
+namespace vega
+{
 StVKInternalForces::StVKInternalForces(VolumetricMesh * volumetricMesh_, StVKElementABCD * precomputedABCDIntegrals_, bool addGravity_, double g_): volumetricMesh(volumetricMesh_), precomputedIntegrals(precomputedABCDIntegrals_), gravityForce(NULL), addGravity(addGravity_), g(g_) 
 {
   int numElements = volumetricMesh->getNumElements();
@@ -338,3 +340,4 @@ void StVKInternalForces::ResetVector(double * vec)
   memset(vec, 0, sizeof(double) * 3 * volumetricMesh->getNumVertices());
 }
 
+}
diff --git a/src/libstvk/StVKInternalForces.h b/src/libstvk/StVKInternalForces.h
index da63ba0aadfce7334d8d02586be83a4147871f79..2807b01b79b09056e8d6a84b8073836f21e20eb3 100644
--- a/src/libstvk/StVKInternalForces.h
+++ b/src/libstvk/StVKInternalForces.h
@@ -77,6 +77,8 @@ Note: all matrices are stored in the column-major order (same format as in LAPAC
 #include "volumetricMesh.h"
 #include "StVKElementABCD.h"
 
+namespace vega
+{
 class StVKInternalForces
 {
 public:
@@ -123,6 +125,6 @@ protected:
   double * lambdaLame;
   double * muLame;
 };
-
+}
 #endif
 
diff --git a/src/libstvk/StVKInternalForcesMT.cpp b/src/libstvk/StVKInternalForcesMT.cpp
index f1c45440281166fd68f1f694362c11def2d3de57..b7e2201f8dce886228759743855d5237ec98ae98 100644
--- a/src/libstvk/StVKInternalForcesMT.cpp
+++ b/src/libstvk/StVKInternalForcesMT.cpp
@@ -29,6 +29,8 @@
 #include <pthread.h>
 #include "StVKInternalForcesMT.h"
 
+namespace vega
+{
 StVKInternalForcesMT::StVKInternalForcesMT(VolumetricMesh * volumetricMesh, StVKElementABCD * precomputedABCDIntegrals, bool addGravity_, double g_, int numThreads_): StVKInternalForces(volumetricMesh, precomputedABCDIntegrals, addGravity_, g_), numThreads(numThreads_) 
 {
   internalForceBuffer = (double*) malloc (sizeof(double) * numThreads * 3 * volumetricMesh->getNumVertices());
@@ -210,4 +212,4 @@ void StVKInternalForcesMT::Compute(int computationTarget, double * vertexDisplac
       *target += energyBuffer[i];
   }
 }
-
+}
diff --git a/src/libstvk/StVKInternalForcesMT.h b/src/libstvk/StVKInternalForcesMT.h
index 0250626609dc81728ca6ab068c52bbd82ecd0a6e..afc1f3db1a005bd7ec8c61eff7962fa2ebe29960 100644
--- a/src/libstvk/StVKInternalForcesMT.h
+++ b/src/libstvk/StVKInternalForcesMT.h
@@ -31,6 +31,8 @@
 
 #include "StVKInternalForces.h"
 
+namespace vega
+{
 /*
   This class is a multi-threaded version of the class "StVKInternalForces".
   It uses POSIX threads ("pthreads") as the threading API.
@@ -64,6 +66,6 @@ protected:
 
   void Compute(int computationTarget, double * vertexDisplacements, double * internalForces);
 };
-
+}
 #endif
 
diff --git a/src/libstvk/StVKStiffnessMatrix.cpp b/src/libstvk/StVKStiffnessMatrix.cpp
index 0025efa296b1a10798f492355d520dc3b3964a84..0b7305c53c899955b83ffe28445a596965b56c0f 100644
--- a/src/libstvk/StVKStiffnessMatrix.cpp
+++ b/src/libstvk/StVKStiffnessMatrix.cpp
@@ -29,6 +29,8 @@
 #include "StVKStiffnessMatrix.h"
 #include "volumetricMeshENuMaterial.h"
 
+namespace vega
+{
 StVKStiffnessMatrix::StVKStiffnessMatrix(StVKInternalForces *  stVKInternalForces)
 {
   precomputedIntegrals = stVKInternalForces->GetPrecomputedIntegrals();
@@ -342,4 +344,4 @@ void StVKStiffnessMatrix::AddCubicTermsContribution(double * vertexDisplacements
 
   precomputedIntegrals->ReleaseElementIterator(elIter);
 }
-
+}
diff --git a/src/libstvk/StVKStiffnessMatrix.h b/src/libstvk/StVKStiffnessMatrix.h
index 9f8eeacf3fbabd8d4a933a7f930e74893806845a..f7f279b8821dba9991c389503a3a1ed150a94ddc 100644
--- a/src/libstvk/StVKStiffnessMatrix.h
+++ b/src/libstvk/StVKStiffnessMatrix.h
@@ -39,6 +39,8 @@
 #include "sparseMatrix.h"
 #include "StVKInternalForces.h"
 
+namespace vega
+{
 class StVKStiffnessMatrix
 {
 public:
@@ -99,6 +101,6 @@ inline void StVKStiffnessMatrix::AddMatrix3x3Block(int c, int a, int element, Ma
     for(int l=0; l<3; l++)
       sparseMatrix->AddEntry(3*row[c]+k, 3*column[numElementVertices*c+a]+l, matrix[k][l]);
 }
-
+}
 #endif
 
diff --git a/src/libstvk/StVKStiffnessMatrixMT.cpp b/src/libstvk/StVKStiffnessMatrixMT.cpp
index bc894ee095f6d825309a8f16675c68e37ce89f3f..285a73723c4029cf25d33a3c3a7ef9c226fa40a2 100644
--- a/src/libstvk/StVKStiffnessMatrixMT.cpp
+++ b/src/libstvk/StVKStiffnessMatrixMT.cpp
@@ -29,6 +29,8 @@
 #include <pthread.h>
 #include "StVKStiffnessMatrixMT.h"
 
+namespace vega
+{
 StVKStiffnessMatrixMT::StVKStiffnessMatrixMT(StVKInternalForces *  stVKInternalForces, int numThreads_): StVKStiffnessMatrix(stVKInternalForces), numThreads(numThreads_) 
 {
   SparseMatrix * stiffnessMatrixSkeleton;
@@ -161,3 +163,4 @@ void StVKStiffnessMatrixMT::ComputeStiffnessMatrix(double * vertexDisplacements,
   //printf("Stiffness matrix: %G\n", stiffnessCounter.GetElapsedTime());
 }
 
+}
diff --git a/src/libstvk/StVKStiffnessMatrixMT.h b/src/libstvk/StVKStiffnessMatrixMT.h
index 01698b353fc55c5425491a2efdc06849e8912eb5..26613b7e0a4d38181769df76938fc20d152ba3a8 100644
--- a/src/libstvk/StVKStiffnessMatrixMT.h
+++ b/src/libstvk/StVKStiffnessMatrixMT.h
@@ -40,6 +40,8 @@
 
 #include "StVKStiffnessMatrix.h"
 
+namespace vega
+{
 class StVKStiffnessMatrixMT : public StVKStiffnessMatrix
 {
 public:
@@ -58,6 +60,6 @@ protected:
   int * startElement, * endElement;
   SparseMatrix ** sparseMatrixBuffer;
 };
-
+}
 #endif
 
diff --git a/src/libstvk/StVKTetABCD.cpp b/src/libstvk/StVKTetABCD.cpp
index f596b26577c22bd0f5e840fbfe70cd391e8767e7..176f4a22165e51858993539341a9c0236c01789e 100644
--- a/src/libstvk/StVKTetABCD.cpp
+++ b/src/libstvk/StVKTetABCD.cpp
@@ -28,6 +28,8 @@
 
 #include "StVKTetABCD.h"
 
+namespace vega
+{
 StVKTetABCD::StVKTetABCD(TetMesh * tetMesh)
 {
   int numElements = tetMesh->getNumElements();
@@ -127,3 +129,4 @@ double StVKTetABCD::D(void * elementIterator, int i, int j, int k, int l)
   return cache->elementPointer->volume * cache->dots[i][j] * cache->dots[k][l]; 
 }
 
+}
diff --git a/src/libstvk/StVKTetABCD.h b/src/libstvk/StVKTetABCD.h
index 6741b99a1e708256bcfbbcb5fea3542904738520..5c416c292596cb5d18f894018be2ccc40bf34fd0 100644
--- a/src/libstvk/StVKTetABCD.h
+++ b/src/libstvk/StVKTetABCD.h
@@ -32,6 +32,8 @@
 #include "StVKElementABCD.h"
 #include "tetMesh.h"
 
+namespace vega
+{
 /*
   This class stores the St.Venant-Kirchhoff A,B,C,D coefficients for a tetrahedral element.
   This is the low-memory version (the version that we use most often).
@@ -75,6 +77,6 @@ protected:
   // creates the elementData structure for a tet
   void StVKSingleTetABCD(Vec3d vertices[4], elementData * target);
 };
-
+}
 #endif
 
diff --git a/src/libstvk/StVKTetHighMemoryABCD.cpp b/src/libstvk/StVKTetHighMemoryABCD.cpp
index dee8b877327888d5e22709295cd351f3ee0beb4b..9955d4ae11f35aea829f67d8386d74c7bb7c1a42 100644
--- a/src/libstvk/StVKTetHighMemoryABCD.cpp
+++ b/src/libstvk/StVKTetHighMemoryABCD.cpp
@@ -30,6 +30,8 @@
 
 //#define CONTIGUOUSBLOCK
 
+namespace vega
+{
 StVKTetHighMemoryABCD::StVKTetHighMemoryABCD(TetMesh * tetMesh)
 {
   int numElements = tetMesh->getNumElements();
@@ -131,3 +133,4 @@ void StVKTetHighMemoryABCD::StVKSingleTetABCD(Vec3d vtx[4], Mat3d A[4][4], doubl
           D[i][j][k][l] = volume * dot(Phig[i],Phig[j]) * dot(Phig[k],Phig[l]);
 }
 
+}
diff --git a/src/libstvk/StVKTetHighMemoryABCD.h b/src/libstvk/StVKTetHighMemoryABCD.h
index 56195a0f0dad388eb0d464b760533f7a06900610..746d7ffd82f803ea2a1cf9720fb00c09a2d8ca2b 100644
--- a/src/libstvk/StVKTetHighMemoryABCD.h
+++ b/src/libstvk/StVKTetHighMemoryABCD.h
@@ -32,6 +32,8 @@
 #include "StVKElementABCD.h"
 #include "tetMesh.h"
 
+namespace vega
+{
 /*
   Class "StVKTetHighMemoryABCD" stores (explicitly) the St.Venant-Kirchhoff 
   A,B,C,D coefficients for a tetrahedron (high-memory version).
@@ -63,6 +65,6 @@ protected:
 
   void StVKSingleTetABCD(Vec3d vertices[4], Mat3d A[4][4], double B[4][4], Vec3d C[4][4][4], double D[4][4][4][4]);
 };
-
+}
 #endif
 
diff --git a/src/libvega-getopts/getopts.cpp b/src/libvega-getopts/getopts.cpp
index 078ac2c9e5f7e16f907bf91f8ab2ee25a1b243cc..7987e7b82520078c702d75a1b0958fb05f5194d6 100644
--- a/src/libvega-getopts/getopts.cpp
+++ b/src/libvega-getopts/getopts.cpp
@@ -79,6 +79,8 @@
 #include <errno.h>
 #include <stdio.h>
 
+namespace vega
+{
 int getopts(int argc, char **argv, opt_t opttable[])
 {
     int i,j,l;
@@ -174,3 +176,4 @@ int getopts(int argc, char **argv, opt_t opttable[])
     return (i);
 }
 
+}
diff --git a/src/libvega-getopts/getopts.h b/src/libvega-getopts/getopts.h
index 5f702dab60ef23b116f54001ee7eab828f63d75c..8bf08478628b62fc5214457bdb48ce61eeaf402d 100644
--- a/src/libvega-getopts/getopts.h
+++ b/src/libvega-getopts/getopts.h
@@ -2,6 +2,8 @@
 #ifndef GETOPTS_H
 #define GETOPTS_H
 
+namespace vega
+{
 #define GETOPTS
 #define OPTINT 1
 #define OPTSTR 2
@@ -12,6 +14,6 @@ typedef struct {char *sw;
                int opttyp;
                void *var;} opt_t;
 int getopts(int argc, char **argv, opt_t opttable[]);
-
+}
 #endif
 
diff --git a/src/libvolumetricMesh/computeStiffnessMatrixNullspace.cpp b/src/libvolumetricMesh/computeStiffnessMatrixNullspace.cpp
index ecc449f407ca4c50e07bb77ddf99a1e70759c3c5..930b305b158932d57266471a5dcb007821fa03b7 100644
--- a/src/libvolumetricMesh/computeStiffnessMatrixNullspace.cpp
+++ b/src/libvolumetricMesh/computeStiffnessMatrixNullspace.cpp
@@ -36,6 +36,8 @@
 #include "minivector.h"
 #include "computeStiffnessMatrixNullspace.h"
 
+namespace vega
+{
 void ComputeStiffnessMatrixNullspace::ComputeNullspace(int n, const double * vertexPos, double * basis, int includeRotationalNullspace, int generateOrthogonalBasis)
 {
   int basisSize = (includeRotationalNullspace ? 6 : 3);
@@ -117,4 +119,4 @@ void ComputeStiffnessMatrixNullspace::RemoveNullspaceComponent(int n, int nullsp
       x[j] -= dotp * nullspaceOrthonormalBasis[ELT(3*n, j, i)];
   }
 }
-
+}
diff --git a/src/libvolumetricMesh/computeStiffnessMatrixNullspace.h b/src/libvolumetricMesh/computeStiffnessMatrixNullspace.h
index 1bf2997afb94527618c6e6ca0241a790e5fbb6da..5dbabc34081437f47f4ffbfb7cc3dabd6e603df0 100644
--- a/src/libvolumetricMesh/computeStiffnessMatrixNullspace.h
+++ b/src/libvolumetricMesh/computeStiffnessMatrixNullspace.h
@@ -44,6 +44,8 @@
   Use "includeRotationalNullspace" to set the desired nullspace size (3 when deformed, or 6 when undeformed).
 */
 
+namespace vega
+{
 class ComputeStiffnessMatrixNullspace
 {
 public:
@@ -55,6 +57,6 @@ public:
   static void RemoveNullspaceComponent(int n, int nullspaceDimension, const double * nullspaceOrthonormalBasis, double *x);
 
 };
-
+}
 #endif
 
diff --git a/src/libvolumetricMesh/cubicMesh.cpp b/src/libvolumetricMesh/cubicMesh.cpp
index 6fbe949c82b7609e897c272d1894fd026feb80ee..83129ff2f3f5048fa4350aac27d21c6d0ad7c1d6 100644
--- a/src/libvolumetricMesh/cubicMesh.cpp
+++ b/src/libvolumetricMesh/cubicMesh.cpp
@@ -38,6 +38,8 @@
 #include "triple.h"
 using namespace std;
 
+namespace vega
+{
 const VolumetricMesh::elementType CubicMesh::elementType_ = CUBIC;
 
 CubicMesh::CubicMesh(char * filename, int verbose) : VolumetricMesh(filename, 8, verbose, &temp)
@@ -662,4 +664,4 @@ void CubicMesh::subdivide()
 
   PropagateRegionsToElements();
 }
-
+}
diff --git a/src/libvolumetricMesh/cubicMesh.h b/src/libvolumetricMesh/cubicMesh.h
index 054fd8c8c584b08d4865d6c8f15a0745ca314745..924666d424f423aeefcfa14706fa96f8027bae8a 100644
--- a/src/libvolumetricMesh/cubicMesh.h
+++ b/src/libvolumetricMesh/cubicMesh.h
@@ -47,6 +47,8 @@
 #include "volumetricMesh.h"
 // see also volumetricMesh.h for a description of the routines
 
+namespace vega
+{
 class CubicMesh : public VolumetricMesh
 {
 public:
@@ -131,6 +133,6 @@ protected:
 
   friend class VolumetricMeshExtensions;
 };
-
+}
 #endif
 
diff --git a/src/libvolumetricMesh/generateInterpolationMatrix.cpp b/src/libvolumetricMesh/generateInterpolationMatrix.cpp
index a32b74729116d7b5d946b91a18b331c07783a0b2..6d6aaa67c02c209f45f75b6a7c8d646be259ab4f 100644
--- a/src/libvolumetricMesh/generateInterpolationMatrix.cpp
+++ b/src/libvolumetricMesh/generateInterpolationMatrix.cpp
@@ -28,6 +28,8 @@
 
 #include "generateInterpolationMatrix.h"
 
+namespace vega
+{
 void GenerateInterpolationMatrix::generate(int numTargetLocations, int numElementVertices, int * vertices, double * weights, SparseMatrix ** A, int numSourceVertices)
 {
   SparseMatrixOutline outline(3*numTargetLocations);
@@ -48,3 +50,4 @@ void GenerateInterpolationMatrix::generate(int numTargetLocations, int numElemen
   *A = new SparseMatrix(&outline);
 }
 
+}
diff --git a/src/libvolumetricMesh/generateInterpolationMatrix.h b/src/libvolumetricMesh/generateInterpolationMatrix.h
index 2be340223c7785a4d60bb92a7a2f636976ada65b..4e60862fd103e328f9ccdfe1c977ce1e55a813ad 100644
--- a/src/libvolumetricMesh/generateInterpolationMatrix.h
+++ b/src/libvolumetricMesh/generateInterpolationMatrix.h
@@ -37,6 +37,8 @@
 // y ... triangle mesh quantity
 // x ... volumetric mesh quantity
 
+namespace vega
+{
 class GenerateInterpolationMatrix
 {
 public:
@@ -47,6 +49,6 @@ public:
   // generated using the interpolation capabilities of the VolumetricMesh class
   static void generate(int numTargetLocations, int numElementVertices, int * vertices, double * weights, SparseMatrix ** A, int numSourceLocations=-1); 
 };
-
+}
 #endif
 
diff --git a/src/libvolumetricMesh/generateMassMatrix.cpp b/src/libvolumetricMesh/generateMassMatrix.cpp
index 45eb245648b685723cd6af39285261eb4178f34a..db66e9db734fd6eec579109bd1027a1923abd344 100644
--- a/src/libvolumetricMesh/generateMassMatrix.cpp
+++ b/src/libvolumetricMesh/generateMassMatrix.cpp
@@ -28,6 +28,8 @@
 
 #include "generateMassMatrix.h"
 
+namespace vega
+{
 void GenerateMassMatrix::computeMassMatrix(
   VolumetricMesh * volumetricMesh, SparseMatrix ** massMatrix, bool inflate3Dim)
 {
@@ -83,3 +85,4 @@ void GenerateMassMatrix::computeVertexMasses(VolumetricMesh * volumetricMesh, do
   delete(massMatrix);
 }
 
+}
diff --git a/src/libvolumetricMesh/generateMassMatrix.h b/src/libvolumetricMesh/generateMassMatrix.h
index 405b6280befc0538c6668a395086b96655cc3b06..1854274e9f55301d3c2439eef6803baf761a161f 100644
--- a/src/libvolumetricMesh/generateMassMatrix.h
+++ b/src/libvolumetricMesh/generateMassMatrix.h
@@ -37,6 +37,8 @@
 #include "volumetricMesh.h"
 #include "sparseMatrix.h"
 
+namespace vega
+{
 class GenerateMassMatrix
 {
 public:
@@ -54,5 +56,6 @@ public:
 protected:
 };
 
+}
 #endif
 
diff --git a/src/libvolumetricMesh/generateMeshGraph.cpp b/src/libvolumetricMesh/generateMeshGraph.cpp
index 027c6e99d915a0d8fdfb027023ab9542701c9dba..03891a8efb44b9f2e01b102043208072a30d526b 100644
--- a/src/libvolumetricMesh/generateMeshGraph.cpp
+++ b/src/libvolumetricMesh/generateMeshGraph.cpp
@@ -30,6 +30,8 @@
 using namespace std;
 #include "generateMeshGraph.h"
 
+namespace vega
+{
 Graph * GenerateMeshGraph::Generate(VolumetricMesh * volumetricMesh)
 {
   // Generate springs:
@@ -72,3 +74,4 @@ Graph * GenerateMeshGraph::Generate(VolumetricMesh * volumetricMesh)
   return graph;
 }
 
+}
diff --git a/src/libvolumetricMesh/generateMeshGraph.h b/src/libvolumetricMesh/generateMeshGraph.h
index dca88189b045806bca8eb26f2d101219a6629dd3..4ee034479e3923b9c15c671f69ca15010fa4b378 100755
--- a/src/libvolumetricMesh/generateMeshGraph.h
+++ b/src/libvolumetricMesh/generateMeshGraph.h
@@ -38,11 +38,13 @@
 // generates a graph of the vertices of a volumetric mesh
 // two vertices are connected if they share an edge
 
+namespace vega
+{
 class GenerateMeshGraph
 {
 public:
   static Graph * Generate(VolumetricMesh * volumetricMesh);
 };
-
+}
 #endif
 
diff --git a/src/libvolumetricMesh/generateSurfaceMesh.cpp b/src/libvolumetricMesh/generateSurfaceMesh.cpp
index abe7c43edf96daae43d5d2920ed85a2079c793f6..e1f470f30298ce4d24c0f2a9b62d760ea7a275f7 100644
--- a/src/libvolumetricMesh/generateSurfaceMesh.cpp
+++ b/src/libvolumetricMesh/generateSurfaceMesh.cpp
@@ -34,6 +34,8 @@ using namespace std;
 
 // classes to disambiguate and sort faces
 
+namespace vega
+{
 class TopologicalFaceI
 {
 public:
@@ -490,3 +492,4 @@ ObjMesh * GenerateSurfaceMesh::ComputeMesh(VolumetricMesh * mesh, ObjMesh * supe
   return objMesh;
 }
 
+}
diff --git a/src/libvolumetricMesh/generateSurfaceMesh.h b/src/libvolumetricMesh/generateSurfaceMesh.h
index 96bf5a69d76fb49d8247fd95396aead64781fe16..24fc323a0c26d4f1b2887cf35f43c714beed0dc1 100644
--- a/src/libvolumetricMesh/generateSurfaceMesh.h
+++ b/src/libvolumetricMesh/generateSurfaceMesh.h
@@ -43,6 +43,8 @@
 #include "objMesh.h"
 
 
+namespace vega
+{
 class GenerateSurfaceMesh
 {
 public:
@@ -53,6 +55,6 @@ public:
 
   static ObjMesh * ComputeMesh(VolumetricMesh * volumetricMesh, ObjMesh * superMesh, bool triangulateOutputMesh=false); // computes the surface of the mesh, but only the part which is also the outer surface of the given super mesh (advanced routine)
 };
-
+}
 #endif
 
diff --git a/src/libvolumetricMesh/tetMesh.cpp b/src/libvolumetricMesh/tetMesh.cpp
index 50615d82a69f175c0bb3de361bbe2996ee111c27..9bb62a71b52654f35cd4aa260bda4eb96fbdf86a 100644
--- a/src/libvolumetricMesh/tetMesh.cpp
+++ b/src/libvolumetricMesh/tetMesh.cpp
@@ -31,6 +31,8 @@
 #include "tetMesh.h"
 #include "volumetricMeshParser.h"
 
+namespace vega
+{
 const VolumetricMesh::elementType TetMesh::elementType_ = TET;
 
 TetMesh::TetMesh(char * filename, int verbose) : VolumetricMesh(filename, 4, verbose, &temp)
@@ -423,4 +425,4 @@ void TetMesh::orient()
   }
 }
 
-
+}
diff --git a/src/libvolumetricMesh/tetMesh.h b/src/libvolumetricMesh/tetMesh.h
index 87a64687e3f6bf07d12a7d6b8e86b41a3fea44f2..758ce17d9c5e8de593e66d897c01634328f78f09 100755
--- a/src/libvolumetricMesh/tetMesh.h
+++ b/src/libvolumetricMesh/tetMesh.h
@@ -39,6 +39,8 @@
 
 // see also volumetricMesh.h for a description of the routines
 
+namespace vega
+{
 class TetMesh : public VolumetricMesh
 {
 public:
@@ -117,6 +119,6 @@ protected:
 
   friend class VolumetricMeshExtensions;
 };
-
+}
 #endif
 
diff --git a/src/libvolumetricMesh/volumetricMesh.cpp b/src/libvolumetricMesh/volumetricMesh.cpp
index 436201cd9bf6d6f54fa7075da987129cf03329cc..07fc915f38258c406d08c371f7517e7678ec7ebd 100644
--- a/src/libvolumetricMesh/volumetricMesh.cpp
+++ b/src/libvolumetricMesh/volumetricMesh.cpp
@@ -35,6 +35,8 @@
 #include "volumetricMeshMooneyRivlinMaterial.h"
 using namespace std;
 
+namespace vega
+{
 double VolumetricMesh::E_default = 1E9;
 double VolumetricMesh::nu_default = 0.45;
 double VolumetricMesh::density_default = 1000;
@@ -1824,3 +1826,4 @@ void VolumetricMesh::nop()
 {
 }
 
+}
diff --git a/src/libvolumetricMesh/volumetricMesh.h b/src/libvolumetricMesh/volumetricMesh.h
index 34ce1726305fe0341d975dee50f73be8f4f743c4..aed8e3b653b55e5827736cdb4502b83c42b8f33f 100755
--- a/src/libvolumetricMesh/volumetricMesh.h
+++ b/src/libvolumetricMesh/volumetricMesh.h
@@ -55,6 +55,8 @@
 #include <map>
 #include "minivector.h"
 
+namespace vega
+{
 class VolumetricMesh
 {
 public:
@@ -345,6 +347,6 @@ inline void VolumetricMesh::Material::setDensity(double density_) { density = de
 inline VolumetricMesh::Region::Region(int materialIndex_, int setIndex_): setIndex(setIndex_), materialIndex(materialIndex_) {}
 inline int VolumetricMesh::Region::getMaterialIndex() const { return materialIndex; }
 inline int VolumetricMesh::Region::getSetIndex() const { return setIndex; }
-
+}
 #endif
 
diff --git a/src/libvolumetricMesh/volumetricMeshENuMaterial.cpp b/src/libvolumetricMesh/volumetricMeshENuMaterial.cpp
index 08046b7a746534d1298334e8192e16fe9277aacb..ef74455a139cd17c0b9b64b0f4fbc2b992db9d04 100644
--- a/src/libvolumetricMesh/volumetricMeshENuMaterial.cpp
+++ b/src/libvolumetricMesh/volumetricMeshENuMaterial.cpp
@@ -28,6 +28,8 @@
 
 #include "volumetricMeshENuMaterial.h"
 
+namespace vega
+{
 VolumetricMesh::Material::materialType VolumetricMesh::ENuMaterial::getType() 
 { 
   return VolumetricMesh::Material::ENU; 
@@ -47,3 +49,4 @@ VolumetricMesh::ENuMaterial * downcastENuMaterial(VolumetricMesh::Material * mat
   return (VolumetricMesh::ENuMaterial*) material;
 }
 
+}
diff --git a/src/libvolumetricMesh/volumetricMeshENuMaterial.h b/src/libvolumetricMesh/volumetricMeshENuMaterial.h
index b8989f05b6b163dcf146fd07c2bc392ff0c27035..b9127040c724e3b2dfd6eb579add00d54968fc62 100644
--- a/src/libvolumetricMesh/volumetricMeshENuMaterial.h
+++ b/src/libvolumetricMesh/volumetricMeshENuMaterial.h
@@ -31,6 +31,8 @@
 
 #include "volumetricMesh.h"
 
+namespace vega
+{
 // stores a material specified by E (Young's modulus), nu (Poisson's ratio), and density
 // such a material specification is very common: (corotational) linear FEM, StVK, etc.
 class VolumetricMesh::ENuMaterial : public VolumetricMesh::Material
@@ -64,6 +66,6 @@ inline void VolumetricMesh::ENuMaterial::setNu(double nu) { nu_ = nu; }
 
 // obtain pointer to ENuMaterial (necessary inside classes that assume ENu material)
 VolumetricMesh::ENuMaterial * downcastENuMaterial(VolumetricMesh::Material * material); // performs a check via getType and returns NULL if material is not ENU
-
+}
 #endif
 
diff --git a/src/libvolumetricMesh/volumetricMeshExtensions.cpp b/src/libvolumetricMesh/volumetricMeshExtensions.cpp
index b3e4d76930dc36637cb4d73a79b7b3562c6051f4..6936f52967b9310c653d6924cab7bbc49571e590 100644
--- a/src/libvolumetricMesh/volumetricMeshExtensions.cpp
+++ b/src/libvolumetricMesh/volumetricMeshExtensions.cpp
@@ -28,3 +28,6 @@
 
 #include "volumetricMeshExtensions.h"
 
+namespace vega
+{
+}
diff --git a/src/libvolumetricMesh/volumetricMeshExtensions.h b/src/libvolumetricMesh/volumetricMeshExtensions.h
index 0c9543654f16e0d5463fc046268a230cc25613de..d1cd90ef83be4a40c81c7cc6f6b4c0fbeadd0c2e 100644
--- a/src/libvolumetricMesh/volumetricMeshExtensions.h
+++ b/src/libvolumetricMesh/volumetricMeshExtensions.h
@@ -29,8 +29,11 @@
 #ifndef _VOLUMETRICMESHEXTENSIONS_H_
 #define _VOLUMETRICMESHEXTENSIONS_H_
 
+namespace vega
+{
 class VolumetricMeshExtensions
 {
 };
+}
 
 #endif
diff --git a/src/libvolumetricMesh/volumetricMeshLoader.cpp b/src/libvolumetricMesh/volumetricMeshLoader.cpp
index f2a0f11e71adf69a9f79874205c004553ad27793..fed64bd2ef344a0058cff912644d7370caede098 100644
--- a/src/libvolumetricMesh/volumetricMeshLoader.cpp
+++ b/src/libvolumetricMesh/volumetricMeshLoader.cpp
@@ -30,6 +30,8 @@
 #include "cubicMesh.h"
 #include "tetMesh.h"
 
+namespace vega
+{
 VolumetricMesh * VolumetricMeshLoader::load(char * filename, int verbose)
 {
   VolumetricMesh::elementType elementType_ = VolumetricMesh::getElementType(filename);
@@ -48,4 +50,4 @@ VolumetricMesh * VolumetricMeshLoader::load(char * filename, int verbose)
 
   return volumetricMesh;
 }
-
+}
diff --git a/src/libvolumetricMesh/volumetricMeshLoader.h b/src/libvolumetricMesh/volumetricMeshLoader.h
index 80a23f3d0827355e0dc5008a8923e350248e4da5..a10bb33df57a779aa8582e9bb9203dd9e3a0d807 100755
--- a/src/libvolumetricMesh/volumetricMeshLoader.h
+++ b/src/libvolumetricMesh/volumetricMeshLoader.h
@@ -36,11 +36,13 @@
 
 #include "volumetricMesh.h"
 
+namespace vega
+{
 class VolumetricMeshLoader
 {
 public:
   static VolumetricMesh * load(char * filename, int verbose=1);
 };
-
+}
 #endif
 
diff --git a/src/libvolumetricMesh/volumetricMeshMooneyRivlinMaterial.cpp b/src/libvolumetricMesh/volumetricMeshMooneyRivlinMaterial.cpp
index bc46bf3cfcce18eac5a61566294640a2bb13f5be..f0f83d3972c46c6dc94661d6323bd3334d78ad66 100644
--- a/src/libvolumetricMesh/volumetricMeshMooneyRivlinMaterial.cpp
+++ b/src/libvolumetricMesh/volumetricMeshMooneyRivlinMaterial.cpp
@@ -28,6 +28,8 @@
 
 #include "volumetricMeshMooneyRivlinMaterial.h"
 
+namespace vega
+{
 VolumetricMesh::Material::materialType VolumetricMesh::MooneyRivlinMaterial::getType() 
 { 
   return VolumetricMesh::Material::MOONEYRIVLIN; 
@@ -47,3 +49,4 @@ VolumetricMesh::MooneyRivlinMaterial * downcastMooneyRivlinMaterial(VolumetricMe
   return (VolumetricMesh::MooneyRivlinMaterial*) material;
 }
 
+}
diff --git a/src/libvolumetricMesh/volumetricMeshMooneyRivlinMaterial.h b/src/libvolumetricMesh/volumetricMeshMooneyRivlinMaterial.h
index 1e5de03e97c1456ce1de74c98690be156ab2c90b..10bb6c391e2de13b442178b31604b1c56c1a7371 100644
--- a/src/libvolumetricMesh/volumetricMeshMooneyRivlinMaterial.h
+++ b/src/libvolumetricMesh/volumetricMeshMooneyRivlinMaterial.h
@@ -31,6 +31,8 @@
 
 #include "volumetricMesh.h"
 
+namespace vega
+{
 // Mooney-Rivlin material
 
 /*
@@ -74,6 +76,6 @@ inline void VolumetricMesh::MooneyRivlinMaterial::setv1(double v1) { v1_ = v1; }
 
 // obtain pointer to MooneyRivlinMaterial (necessary inside classes that implement the Mooney-Rivlin material)
 VolumetricMesh::MooneyRivlinMaterial * downcastMooneyRivlinMaterial(VolumetricMesh::Material * material); // performs a check via getType and returns NULL if material is not Mooney Rivlin
-
+}
 #endif
 
diff --git a/src/libvolumetricMesh/volumetricMeshParser.cpp b/src/libvolumetricMesh/volumetricMeshParser.cpp
index 2ffc28b50d9fab3e269a32989cde70ca80fb3c90..80a74ce229c3d4bc965c8188e522a53445bbd69b 100644
--- a/src/libvolumetricMesh/volumetricMeshParser.cpp
+++ b/src/libvolumetricMesh/volumetricMeshParser.cpp
@@ -29,6 +29,8 @@
 #include <string.h>
 #include "volumetricMeshParser.h"
 
+namespace vega
+{
 VolumetricMeshParser::VolumetricMeshParser(char * includeToken_)
 {
   fin = NULL;
@@ -254,3 +256,4 @@ void VolumetricMeshParser::removeWhitespace(char * s, int numRetainedSpaces)
   }
 }
 
+}
diff --git a/src/libvolumetricMesh/volumetricMeshParser.h b/src/libvolumetricMesh/volumetricMeshParser.h
index 675ab7ba73e0b9928ef6dc7004367ce325f28baa..6bed884cc51c1ff1d4275e4079b1a2a5fc4ddc69 100755
--- a/src/libvolumetricMesh/volumetricMeshParser.h
+++ b/src/libvolumetricMesh/volumetricMeshParser.h
@@ -34,6 +34,8 @@
 #include <vector>
 using namespace std;
 
+namespace vega
+{
 /*
   A parser for the volumetric mesh text file format.
   Note: the end user never needs to use this class directly.
@@ -70,6 +72,6 @@ protected:
   char includeToken[96]; // normally "*INCLUDE "
   int includeTokenLength; // normally 9
 };
-
+}
 #endif
 
diff --git a/src/util/volumetricMeshUtilities/generateInterpolant.cpp b/src/util/volumetricMeshUtilities/generateInterpolant.cpp
index 7fbb2168ef81ec2cdfa89e3653f19dd69808effb..b8ab48a9ef6b26170c618fe8643fca150438bd14 100644
--- a/src/util/volumetricMeshUtilities/generateInterpolant.cpp
+++ b/src/util/volumetricMeshUtilities/generateInterpolant.cpp
@@ -67,7 +67,7 @@ int main(int argc, char ** argv)
   char outputElementFilename[4096] = "__none";
   char zeroThresholdString[4096] = "__none";
 
-  opt_t opttable[] =
+  vega::opt_t opttable[] =
   {
     { (char*)"s", OPTSTR, &outputElementFilename },
     { (char*)"z", OPTSTR, &zeroThresholdString },
@@ -89,7 +89,7 @@ int main(int argc, char ** argv)
   else
     threshold = strtod(zeroThresholdString, NULL);
 
-  VolumetricMesh * volumetricMesh = VolumetricMeshLoader::load(meshFile);
+  vega::VolumetricMesh * volumetricMesh = vega::VolumetricMeshLoader::load(meshFile);
   
   if (volumetricMesh == NULL)
   {
@@ -103,13 +103,13 @@ int main(int argc, char ** argv)
   printf("Num vertices: %d\n", n);
   printf("Num elements: %d\n", nel);
 
-  ObjMesh * objMesh = new ObjMesh(objMeshname);
+  vega::ObjMesh * objMesh = new vega::ObjMesh(objMeshname);
 
   int numInterpolationLocations = objMesh->getNumVertices();
   double * interpolationLocations = (double*) malloc (sizeof(double) * 3 * numInterpolationLocations);
   for(int i=0; i< numInterpolationLocations; i++)
   {
-    Vec3d pos = objMesh->getPosition(i);
+    vega::Vec3d pos = objMesh->getPosition(i);
     interpolationLocations[3*i+0] = pos[0];
     interpolationLocations[3*i+1] = pos[1];
     interpolationLocations[3*i+2] = pos[2];
@@ -143,7 +143,7 @@ int main(int argc, char ** argv)
     for(set<int>::iterator iter = uniqueElementSet.begin(); iter != uniqueElementSet.end(); iter++)
       uniqueElementList.push_back(*iter);
 
-    LoadList saveList;
+    vega::LoadList saveList;
     sort(uniqueElementList.begin(), uniqueElementList.end());
     saveList.save(outputElementFilename, uniqueElementList.size(), &uniqueElementList[0], 1);
   }
diff --git a/src/util/volumetricMeshUtilities/generateInterpolationMatrix.cpp b/src/util/volumetricMeshUtilities/generateInterpolationMatrix.cpp
index d1de038ce20858f35753a3bab37fdf89d72b7d24..df1e4e58f9492b62b7be9003f425d0f399d265d6 100644
--- a/src/util/volumetricMeshUtilities/generateInterpolationMatrix.cpp
+++ b/src/util/volumetricMeshUtilities/generateInterpolationMatrix.cpp
@@ -64,7 +64,7 @@ int main(int argc, char ** argv)
 
   char zeroThresholdString[4096] = "__none";
   char interpolantFile[4096] = "__none";
-  opt_t opttable[] =
+  vega::opt_t opttable[] =
   {
     { (char*)"i", OPTSTR, &interpolantFile },
     { (char*)"z", OPTSTR, &zeroThresholdString },
@@ -86,7 +86,7 @@ int main(int argc, char ** argv)
   else
     threshold = strtod(zeroThresholdString, NULL);
 
-  VolumetricMesh * volumetricMesh = VolumetricMeshLoader::load(meshFile);
+  vega::VolumetricMesh * volumetricMesh = vega::VolumetricMeshLoader::load(meshFile);
 
   if (volumetricMesh == NULL)
   {
@@ -100,12 +100,12 @@ int main(int argc, char ** argv)
   printf("Num vertices: %d\n",n);
   printf("Num elements: %d\n",nel);
 
-  ObjMesh * objMesh = new ObjMesh(objMeshname);
+  vega::ObjMesh * objMesh = new vega::ObjMesh(objMeshname);
   int numInterpolationLocations = objMesh->getNumVertices();
   double * interpolationLocations = (double*) malloc (sizeof(double) * 3 * numInterpolationLocations);
   for(int i=0; i< numInterpolationLocations; i++)
   {
-    Vec3d pos = objMesh->getPosition(i);
+    vega::Vec3d pos = objMesh->getPosition(i);
     interpolationLocations[3*i+0] = pos[0];
     interpolationLocations[3*i+1] = pos[1];
     interpolationLocations[3*i+2] = pos[2];
@@ -131,8 +131,8 @@ int main(int argc, char ** argv)
     }    
   }
 
-  SparseMatrix * A;
-  GenerateInterpolationMatrix::generate(numInterpolationLocations, volumetricMesh->getNumElementVertices(), vertices, weights, &A, volumetricMesh->getNumVertices());
+  vega::SparseMatrix * A;
+  vega::GenerateInterpolationMatrix::generate(numInterpolationLocations, volumetricMesh->getNumElementVertices(), vertices, weights, &A, volumetricMesh->getNumVertices());
 
   A->Save(outputFilename);
 
diff --git a/src/util/volumetricMeshUtilities/generateMassMatrix.cpp b/src/util/volumetricMeshUtilities/generateMassMatrix.cpp
index eec8a23622d6861dcd0808b5312426f7b737992c..b97ae9be70079239ba99e8d49231fa91aed65b56 100644
--- a/src/util/volumetricMeshUtilities/generateMassMatrix.cpp
+++ b/src/util/volumetricMeshUtilities/generateMassMatrix.cpp
@@ -48,12 +48,12 @@ int main(int argc, char ** argv)
     return 1;
   }
 
-  VolumetricMesh * volumetricMesh = VolumetricMeshLoader::load(argv[1]);
+  vega::VolumetricMesh * volumetricMesh = vega::VolumetricMeshLoader::load(argv[1]);
   printf("The number of vertices is: %d\n", volumetricMesh->getNumVertices());
   printf("The number of elements is: %d\n", volumetricMesh->getNumElements());
 
-  SparseMatrix * massMatrix;
-  GenerateMassMatrix::computeMassMatrix(volumetricMesh, &massMatrix, false);
+  vega::SparseMatrix * massMatrix;
+  vega::GenerateMassMatrix::computeMassMatrix(volumetricMesh, &massMatrix, false);
 
   massMatrix->Save(argv[2]);
 
diff --git a/src/util/volumetricMeshUtilities/generateSurfaceMesh.cpp b/src/util/volumetricMeshUtilities/generateSurfaceMesh.cpp
index 4f0619e6625f5eaad196c97113a77048852dbd28..26fb50f04f73ce5e6f761234243f7675f7986bf2 100644
--- a/src/util/volumetricMeshUtilities/generateSurfaceMesh.cpp
+++ b/src/util/volumetricMeshUtilities/generateSurfaceMesh.cpp
@@ -60,7 +60,7 @@ int main( int argc, char** argv )
 
   bool outputTriangleMesh = false;
 
-  opt_t opttable[] =
+  vega::opt_t opttable[] =
   {
     { (char*)"t", OPTBOOL, &outputTriangleMesh },
     { NULL, 0, NULL }
@@ -73,10 +73,10 @@ int main( int argc, char** argv )
   if (outputTriangleMesh)
     printf("Triangle mesh will be triangulated (if needed).\n");
 
-  VolumetricMesh * mesh = VolumetricMeshLoader::load(meshFile);
+  vega::VolumetricMesh * mesh = vega::VolumetricMeshLoader::load(meshFile);
 
-  GenerateSurfaceMesh generateSurfaceMesh;
-  ObjMesh * objMesh = generateSurfaceMesh.ComputeMesh(mesh, outputTriangleMesh);
+  vega::GenerateSurfaceMesh generateSurfaceMesh;
+  vega::ObjMesh * objMesh = generateSurfaceMesh.ComputeMesh(mesh, outputTriangleMesh);
   objMesh->save(outputFile);
 
   return 0;