Index: /issm/trunk-jpl/src/mex/Makefile.am
===================================================================
--- /issm/trunk-jpl/src/mex/Makefile.am	(revision 11996)
+++ /issm/trunk-jpl/src/mex/Makefile.am	(revision 11997)
@@ -3,39 +3,17 @@
 #Bin programs {{{1
 
-if NOSERIAL
-bin_PROGRAMS = 
-else
+if MODULES
 if MATLAB
-bin_PROGRAMS = AverageFilter\
-				AddExternalResult\
+bin_PROGRAMS =  AverageFilter\
 				BamgMesher\
 				BamgConvertMesh\
 				BamgTriangulate\
 				Chaco\
-				ComputeBasalStress\
-				ConfigureObjects \
-				ControlOptimization\
-				ControlInputGetGradient\
-				ControlInputScaleGradient\
-				ControlInputSetGradient\
 				ContourToMesh \
 				ContourToNodes \
-				CostFunction \
-				CreateNodalConstraints\
-				CreateJacobianMatrix\
-				Echo\
 				ElementConnectivity\
 				EnumToString\
 				StringToEnum\
-				InputControlUpdate \
-				InputConvergence\
-				GetSolutionFromInputs\
-				GetVectorFromInputs\
-				Gradj\
-				GroundinglineMigration\
 				HoleFiller \
-				InputDuplicate\
-				InputScale\
-				InputToResult\
 				InternalFront\
 				InterpFromGridToMesh \
@@ -51,31 +29,10 @@
 				Exp2Kml \
 				Kml2Exp \
-				Mergesolutionfromftog\
 				MeshPartition\
 				MeshProfileIntersection\
-				ModelProcessor \
-				NodeConnectivity\
-				NodesDof\
-				Orth\
-				OutputResults\
-				ParsePetscOptions\
-				ConstraintsState\
 				PointCloudFindNeighbors\
 				PropagateFlagsFromConnectivity\
-				ProcessParams\
-				Reduceload\
-				Reducevectorgtos\
-				Reducevectorgtof\
-				Response\
-				ResetCoordinateSystem\
 				Scotch\
-				Solver\
-				SparseToVector\
-				SpcNodes\
 				Shp2Kml\
-				UpdateConstraints\
-				SurfaceArea\
-				SystemMatrices\
-				TimeAdapt\
 				TriaSearch\
 				TriMesh\
@@ -83,11 +40,5 @@
 				TriMeshNoDensity\
 				TriMeshProcessRifts\
-				TriMeshRefine\
-				InputUpdateFromConstant\
-				InputUpdateFromSolution\
-				InputUpdateFromVector\
-				UpdateVertexPositions\
-				UpdateDynamicConstraints\
-				VerticesDof
+				TriMeshRefine
 endif
 if PYTHON
@@ -96,27 +47,14 @@
 endif 
 #}}}
-#Dakota programs {{{1
-if NOSERIAL
-bin_PROGRAMS += 
-else
-if DAKOTA
-if MATLAB
-bin_PROGRAMS += DakotaResponses\
-				Dakota\
-				InputUpdateFromDakota
-endif 
-endif 
-endif
-#}}}
 #Flags and libraries {{{1
-LDADD = ../c/libISSM.a $(TRIANGLELIB) $(PETSCLIB) $(FLIBS) $(PLAPACKLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(SHAPELIBLIB) $(GSLLIB)
+LDADD = ../c/libISSMCore.a ../c/libISSMModules.a $(TRIANGLELIB) $(PETSCLIB) $(FLIBS) $(PLAPACKLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(SHAPELIBLIB) $(GSLLIB)
 
-#Initialize
-AM_CXXFLAGS = -D_SERIAL_
+#Triangle library
+AM_CXXFLAGS =  -DTRILIBRARY -DANSI_DECLARATORS -DNO_TIMER
 
 if MATLAB
-AM_LDFLAGS   = $(MEXLINK)
+AM_LDFLAGS  = $(MEXLINK)
 AM_CXXFLAGS +=  -DMATLAB  -D_GNU_SOURCE -fPIC -fno-omit-frame-pointer -pthread 
-LDADD       += $(MEXLIB) 
+LDADD       += $(MEXLIB) ../c/libISSMMatlab.a
 
 endif
@@ -124,11 +62,8 @@
 if PYTHON
 AM_LDFLAGS  = $(PYTHONLINK)
-AM_CXXFLAGS+=  -DNPY_NO_DEPRECATED_API 
-LDADD      += $(BOOSTLIB) $(PYTHONLIB)
+AM_CXXFLAGS +=  -DNPY_NO_DEPRECATED_API 
+LDADD       += $(BOOSTLIB) $(PYTHONLIB) ../c/libISSMPython.a
 endif
 
-
-#Triangle library
-AM_CXXFLAGS +=  -DTRILIBRARY -DANSI_DECLARATORS -DNO_TIMER
 
 #Optimization flags:
@@ -136,6 +71,6 @@
 #}}}
 #Bin sources {{{1
-AddExternalResult_SOURCES = AddExternalResult/AddExternalResult.cpp\
-					AddExternalResult/AddExternalResult.h
+AverageFilter_SOURCES = AverageFilter/AverageFilter.cpp\
+			  AverageFilter/AverageFilter.h
 
 BamgMesher_SOURCES = BamgMesher/BamgMesher.cpp\
@@ -151,10 +86,4 @@
 					Chaco/Chaco.h
 
-ComputeBasalStress_SOURCES = ComputeBasalStress/ComputeBasalStress.cpp\
-								  ComputeBasalStress/ComputeBasalStress.h
-
-ConfigureObjects_SOURCES = ConfigureObjects/ConfigureObjects.cpp\
-			  ConfigureObjects/ConfigureObjects.h
-
 ContourToMesh_SOURCES = ContourToMesh/ContourToMesh.cpp\
 			  ContourToMesh/ContourToMesh.h
@@ -162,34 +91,4 @@
 ContourToNodes_SOURCES = ContourToNodes/ContourToNodes.cpp\
 			  ContourToNodes/ContourToNodes.h
-
-ControlOptimization_SOURCES = ControlOptimization/ControlOptimization.cpp\
-			  ControlOptimization/ControlOptimization.h
-
-ControlInputGetGradient_SOURCES = ControlInputGetGradient/ControlInputGetGradient.cpp\
-										ControlInputGetGradient/ControlInputGetGradient.h
-
-ControlInputScaleGradient_SOURCES = ControlInputScaleGradient/ControlInputScaleGradient.cpp\
-											 ControlInputScaleGradient/ControlInputScaleGradient.h
-
-ControlInputSetGradient_SOURCES = ControlInputSetGradient/ControlInputSetGradient.cpp\
-			  ControlInputSetGradient/ControlInputSetGradient.h
-
-InputControlUpdate_SOURCES = InputControlUpdate/InputControlUpdate.cpp\
-										  InputControlUpdate/InputControlUpdate.h
-
-InputConvergence_SOURCES = InputConvergence/InputConvergence.cpp\
-			  InputConvergence/InputConvergence.h
-
-CostFunction_SOURCES =  CostFunction/CostFunction.cpp \
-						CostFunction/CostFunction.h
-
-CreateNodalConstraints_SOURCES =  CreateNodalConstraints/CreateNodalConstraints.cpp \
-								CreateNodalConstraints/CreateNodalConstraints.h
-
-NodesDof_SOURCES = NodesDof/NodesDof.cpp\
-			  NodesDof/NodesDof.h
-
-Echo_SOURCES = Echo/Echo.cpp\
-			  Echo/Echo.h
 
 ElementConnectivity_SOURCES = ElementConnectivity/ElementConnectivity.cpp\
@@ -202,27 +101,6 @@
 			  StringToEnum/StringToEnum.h
 
-GetSolutionFromInputs_SOURCES = GetSolutionFromInputs/GetSolutionFromInputs.cpp\
-			  GetSolutionFromInputs/GetSolutionFromInputs.h
-
-GetVectorFromInputs_SOURCES = GetVectorFromInputs/GetVectorFromInputs.cpp\
-			  GetVectorFromInputs/GetVectorFromInputs.h
-
-Gradj_SOURCES = Gradj/Gradj.cpp\
-			  Gradj/Gradj.h
-
-GroundinglineMigration_SOURCES = GroundinglineMigration/GroundinglineMigration.cpp\
-			  GroundinglineMigration/GroundinglineMigration.h
-
 HoleFiller_SOURCES = HoleFiller/HoleFiller.cpp\
 			  HoleFiller/HoleFiller.h
-
-InputDuplicate_SOURCES = InputDuplicate/InputDuplicate.cpp\
-			  InputDuplicate/InputDuplicate.h
-
-InputScale_SOURCES = InputScale/InputScale.cpp\
-			  InputScale/InputScale.h
-
-InputToResult_SOURCES = InputToResult/InputToResult.cpp\
-			  InputToResult/InputToResult.h
 
 InternalFront_SOURCES = InternalFront/InternalFront.cpp\
@@ -265,10 +143,4 @@
 			  Kml2Exp/Kml2Exp.h
 
-AverageFilter_SOURCES = AverageFilter/AverageFilter.cpp\
-			  AverageFilter/AverageFilter.h
-
-Mergesolutionfromftog_SOURCES = Mergesolutionfromftog/Mergesolutionfromftog.cpp\
-			  Mergesolutionfromftog/Mergesolutionfromftog.h
-
 MeshPartition_SOURCES = MeshPartition/MeshPartition.cpp\
 			  MeshPartition/MeshPartition.h
@@ -277,73 +149,15 @@
 			  MeshProfileIntersection/MeshProfileIntersection.h
 
-ModelProcessor_SOURCES =  ModelProcessor/ModelProcessor.cpp \
-						  ModelProcessor/ModelProcessor.h
-
-NodeConnectivity_SOURCES = NodeConnectivity/NodeConnectivity.cpp\
-			  NodeConnectivity/NodeConnectivity.h
-
-Orth_SOURCES = Orth/Orth.cpp\
-			  Orth/Orth.h
-
-OutputResults_SOURCES = OutputResults/OutputResults.cpp\
-			  OutputResults/OutputResults.h
-
-ConstraintsState_SOURCES = ConstraintsState/ConstraintsState.cpp\
-			  ConstraintsState/ConstraintsState.h
-
 PointCloudFindNeighbors_SOURCES = PointCloudFindNeighbors/PointCloudFindNeighbors.cpp\
 			  PointCloudFindNeighbors/PointCloudFindNeighbors.h
-
-ProcessParams_SOURCES = ProcessParams/ProcessParams.cpp\
-			  ProcessParams/ProcessParams.h
 
 PropagateFlagsFromConnectivity_SOURCES = PropagateFlagsFromConnectivity/PropagateFlagsFromConnectivity.cpp\
 			  PropagateFlagsFromConnectivity/PropagateFlagsFromConnectivity.h
 
-Reduceload_SOURCES = Reduceload/Reduceload.cpp\
-			  Reduceload/Reduceload.h
-
-Reducevectorgtos_SOURCES = Reducevectorgtos/Reducevectorgtos.cpp\
-			  Reducevectorgtos/Reducevectorgtos.h
-
-Reducevectorgtof_SOURCES = Reducevectorgtof/Reducevectorgtof.cpp\
-									Reducevectorgtof/Reducevectorgtof.h
-
-Response_SOURCES = Response/Response.cpp\
-									Response/Response.h
-
-ResetCoordinateSystem_SOURCES = ResetCoordinateSystem/ResetCoordinateSystem.cpp\
-						 ResetCoordinateSystem/ResetCoordinateSystem.h
-
 Scotch_SOURCES = Scotch/Scotch.cpp\
 			  Scotch/Scotch.h
 
-Solver_SOURCES = Solver/Solver.cpp\
-			  Solver/Solver.h
-
-SparseToVector_SOURCES = SparseToVector/SparseToVector.cpp\
-			  SparseToVector/SparseToVector.h
-
-SpcNodes_SOURCES = SpcNodes/SpcNodes.cpp\
-			  SpcNodes/SpcNodes.h
-
 Shp2Kml_SOURCES = Shp2Kml/Shp2Kml.cpp\
 			  Shp2Kml/Shp2Kml.h
-
-UpdateConstraints_SOURCES = UpdateConstraints/UpdateConstraints.cpp\
-			  UpdateConstraints/UpdateConstraints.h
-
-SystemMatrices_SOURCES = SystemMatrices/SystemMatrices.cpp\
-			  SystemMatrices/SystemMatrices.h
-
-
-CreateJacobianMatrix_SOURCES = CreateJacobianMatrix/CreateJacobianMatrix.cpp\
-								 CreateJacobianMatrix/CreateJacobianMatrix.h
-
-SurfaceArea_SOURCES = SurfaceArea/SurfaceArea.cpp\
-								 SurfaceArea/SurfaceArea.h
-
-TimeAdapt_SOURCES = TimeAdapt/TimeAdapt.cpp\
-			  TimeAdapt/TimeAdapt.h
 
 TriaSearch_SOURCES = TriaSearch/TriaSearch.cpp\
@@ -365,32 +179,3 @@
 			  TriMeshRefine/TriMeshRefine.h
 
-InputUpdateFromConstant_SOURCES = InputUpdateFromConstant/InputUpdateFromConstant.cpp\
-			  InputUpdateFromConstant/InputUpdateFromConstant.h
-
-InputUpdateFromSolution_SOURCES = InputUpdateFromSolution/InputUpdateFromSolution.cpp\
-			  InputUpdateFromSolution/InputUpdateFromSolution.h
-
-InputUpdateFromVector_SOURCES = InputUpdateFromVector/InputUpdateFromVector.cpp\
-			  InputUpdateFromVector/InputUpdateFromVector.h
-
-UpdateVertexPositions_SOURCES = UpdateVertexPositions/UpdateVertexPositions.cpp\
-			  UpdateVertexPositions/UpdateVertexPositions.h
-
-UpdateDynamicConstraints_SOURCES = UpdateDynamicConstraints/UpdateDynamicConstraints.cpp\
-			  UpdateDynamicConstraints/UpdateDynamicConstraints.h
-
-ParsePetscOptions_SOURCES = ParsePetscOptions/ParsePetscOptions.cpp\
-			  ParsePetscOptions/ParsePetscOptions.h
-
-VerticesDof_SOURCES = VerticesDof/VerticesDof.cpp\
-			  VerticesDof/VerticesDof.h
-
 #}}}
-#Dakota sources {{{1
-DakotaResponses_SOURCES = DakotaResponses/DakotaResponses.cpp\
-			  DakotaResponses/DakotaResponses.h
-Dakota_SOURCES = Dakota/Dakota.cpp\
-			  Dakota/Dakota.h
-InputUpdateFromDakota_SOURCES = InputUpdateFromDakota/InputUpdateFromDakota.cpp\
-			  InputUpdateFromDakota/InputUpdateFromDakota.h
-#}}}
Index: /issm/trunk-jpl/src/mex/TriMesh/TriMesh.h
===================================================================
--- /issm/trunk-jpl/src/mex/TriMesh/TriMesh.h	(revision 11996)
+++ /issm/trunk-jpl/src/mex/TriMesh/TriMesh.h	(revision 11997)
@@ -18,4 +18,5 @@
 #endif
 
+/*Header files: */
 #include "../../c/include/globals.h"
 #include "../../c/toolkits/toolkits.h"
@@ -32,5 +33,4 @@
 #define AREA        (mxArray *)prhs[1]
 #define ORDER     (mxArray *)prhs[2]
-
 /* serial output macros: */
 #define INDEX  (mxArray**)&plhs[0]
@@ -39,6 +39,6 @@
 #define SEGMENTS   (mxArray**)&plhs[3]
 #define SEGMENTMARKERLIST (mxArray**)&plhs[4]
+#endif
 
-#endif
 #ifdef _HAVE_PYTHON_
 /* serial input macros: */
@@ -46,5 +46,4 @@
 #define AREA        PyTuple_GetItem(args,1)
 #define ORDER     PyTuple_GetItem(args,2)
-
 /* serial output macros: */
 #define INDEX  output,0
@@ -54,7 +53,4 @@
 #define SEGMENTMARKERLIST output,4
 #endif
-
-/* local prototypes: */
-void TriMeshUsage(void);
 
 #undef __FUNCT__ 
@@ -67,3 +63,6 @@
 #define NRHS  3
 
+/* local prototypes: */
+void TriMeshUsage(void);
+
 #endif  /* _TRIMESH_H */
