Index: issm/trunk/src/c/Makefile.am
===================================================================
--- issm/trunk/src/c/Makefile.am	(revision 15396)
+++ issm/trunk/src/c/Makefile.am	(revision 16137)
@@ -1,3 +1,4 @@
-AM_CPPFLAGS = @DAKOTAINCL@ @SHAPELIBINCL@ @PETSCINCL@ @SLEPCINCL@ @MPIINCL@ @METISINCL@ @CHACOINCL@ @SCOTCHINCL@ @PLAPACKINCL@ @BLASLAPACKINCL@ @MKLINCL@ @MUMPSINCL@ @TRIANGLEINCL@ @SPAIINCL@ @HYPREINCL@ @PROMETHEUSINCL@ @SUPERLUINCL@ @SPOOLESINCL@ @PASTIXINCL@ @MLINCL@ @TAOINCL@ @ADIC2INCL@ @ADOLCINCL@ @GSLINCL@ @BOOSTINCL@ @ANDROID_NDKINCL@
+AM_CPPFLAGS = @DAKOTAINCL@ @SHAPELIBINCL@ @PETSCINCL@ @SLEPCINCL@ @AMPIINCL@ @MPIINCL@ @METISINCL@ @CHACOINCL@ @SCOTCHINCL@ @PLAPACKINCL@ @BLASLAPACKINCL@ @MKLINCL@ @MUMPSINCL@ @TRIANGLEINCL@ @SPAIINCL@ @HYPREINCL@ @PROMETHEUSINCL@ @SUPERLUINCL@ @SPOOLESINCL@ @PASTIXINCL@ @MLINCL@ @TAOINCL@ @ADIC2INCL@ @ADOLCINCL@ @GSLINCL@ @BOOSTINCL@ @ANDROID_NDKINCL@ @METEOIOINCL@ @SNOWPACKINCL@
+AUTOMAKE_OPTIONS = subdir-objects
 
 EXEEXT=$(ISSMEXT)
@@ -19,7 +20,5 @@
 #sources
 #Core sources{{{
-core_sources = ./main/issm.h\
-			   ./main/globals.h\
-			   ./datastructures/DataSet.h\
+core_sources = ./datastructures/DataSet.h\
 					./datastructures/DataSet.cpp\
 					./datastructures/Object.h\
@@ -118,6 +117,4 @@
 					./classes/Loads/Pengrid.cpp\
 					./classes/Loads/Pengrid.h\
-					./classes/Loads/Icefront.cpp\
-					./classes/Loads/Icefront.h\
 					./classes/Loads/Numericalflux.cpp\
 					./classes/Loads/Numericalflux.h\
@@ -167,4 +164,5 @@
 					./shared/shared.h\
 					./shared/MemOps/MemOps.h\
+					./shared/MemOps/MemOps.cpp\
 					./shared/Matrix/matrix.h\
 					./shared/Matrix/MatrixUtils.cpp\
@@ -176,6 +174,4 @@
 					./shared/io/Print/PrintfFunction.cpp\
 					./shared/io/Print/Print.h\
-					./shared/io/Comm/Comm.h\
-					./shared/io/Comm/CommDef.h\
 					./shared/io/Comm/IssmComm.h\
 					./shared/io/Comm/IssmComm.cpp\
@@ -209,7 +205,9 @@
 					./shared/Elements/Paterson.cpp\
 					./shared/Elements/Arrhenius.cpp\
+					./shared/Elements/LliboutryDuval.cpp \
 					./shared/Elements/PrintArrays.cpp\
 					./shared/Elements/PddSurfaceMassBalance.cpp\
 					./shared/Elements/ComputeDelta18oTemperaturePrecipitation.cpp\
+					./shared/Elements/DrainageFunctionWaterfraction.cpp\
 					./shared/String/sharedstring.h\
 					./shared/String/DescriptorIndex.cpp\
@@ -227,4 +225,11 @@
 					./toolkits/issm/IssmSolver.cpp\
 					./toolkits/issm/Bucket.h\
+					./toolkits/mpi/issmmpi.h\
+					./toolkits/mpi/issmmpi.cpp\
+					./toolkits/mpi/commops/commops.h\
+					./toolkits/mpi/commops/DetermineLocalSize.cpp\
+					./toolkits/mpi/commops/DetermineGlobalSize.cpp\
+					./toolkits/mpi/commops/DetermineRowRankFromLocalSize.cpp\
+					./toolkits/mpi/commops/GetOwnershipBoundariesFromRange.cpp\
 					./toolkits/adolc/adolcincludes.h\
 					./toolkits/adolc/AdolcEdf.h\
@@ -243,4 +248,6 @@
 					./modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp\
 					./modules/ModelProcessorx/NodesPartitioning.cpp\
+					./modules/ModelProcessorx/EdgesPartitioning.cpp\
+					./modules/ModelProcessorx/FacesPartitioning.cpp\
 					./modules/ModelProcessorx/SortDataSets.cpp\
 					./modules/ModelProcessorx/UpdateCounters.cpp\
@@ -248,7 +255,10 @@
 					./modules/ModelProcessorx/CreateParameters.cpp\
 					./modules/ModelProcessorx/Autodiff/CreateParametersAutodiff.cpp\
+					./modules/ModelProcessorx/CreateFaces.cpp\
+					./modules/ModelProcessorx/CreateEdges.cpp\
 					./modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp\
 					./modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp\
 					./modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp\
+					./modules/ModelProcessorx/CreateNodes.cpp\
 					./modules/ParseToolkitsOptionsx/ParseToolkitsOptionsx.h\
 					./modules/ParseToolkitsOptionsx/ParseToolkitsOptionsx.cpp\
@@ -269,4 +279,10 @@
 					./modules/SurfaceAreax/SurfaceAreax.h\
 					./modules/SurfaceAreax/SurfaceAreax.cpp\
+					./modules/AllocateSystemMatricesx/AllocateSystemMatricesx.h\
+					./modules/AllocateSystemMatricesx/AllocateSystemMatricesx.cpp\
+					./modules/CreateJacobianMatrixx/CreateJacobianMatrixx.h\
+					./modules/CreateJacobianMatrixx/CreateJacobianMatrixx.cpp\
+					./modules/SystemMatricesx/SystemMatricesx.h\
+					./modules/SystemMatricesx/SystemMatricesx.cpp\
 					./modules/CreateNodalConstraintsx/CreateNodalConstraintsx.h\
 					./modules/CreateNodalConstraintsx/CreateNodalConstraintsx.cpp\
@@ -297,4 +313,6 @@
 					./modules/PositiveDegreeDayx/PositiveDegreeDayx.h\
 					./modules/PositiveDegreeDayx/PositiveDegreeDayx.cpp\
+					./modules/PostprocessingEnthalpyx/PostprocessingEnthalpyx.h\
+					./modules/PostprocessingEnthalpyx/PostprocessingEnthalpyx.cpp\
 					./modules/Delta18oParameterizationx/Delta18oParameterizationx.h\
 					./modules/Delta18oParameterizationx/Delta18oParameterizationx.cpp\
@@ -363,10 +381,19 @@
 steadystate_sources = ./analyses/steadystate_core.cpp
 #}}}
-#Prognostic sources  {{{
-prognostic_sources = ./modules/ModelProcessorx/Prognostic/UpdateElementsPrognostic.cpp\
-					      ./modules/ModelProcessorx/Prognostic/CreateNodesPrognostic.cpp\
-					      ./modules/ModelProcessorx/Prognostic/CreateConstraintsPrognostic.cpp\
-					      ./modules/ModelProcessorx/Prognostic/CreateLoadsPrognostic.cpp\
-							./analyses/prognostic_core.cpp
+#Masstransport sources  {{{
+masstransport_sources = ./modules/ModelProcessorx/Masstransport/UpdateElementsMasstransport.cpp\
+								./modules/ModelProcessorx/Masstransport/CreateNodesMasstransport.cpp\
+								./modules/ModelProcessorx/Masstransport/CreateConstraintsMasstransport.cpp\
+								./modules/ModelProcessorx/Masstransport/CreateLoadsMasstransport.cpp\
+								./modules/ModelProcessorx/FreeSurfaceTop/UpdateElementsFreeSurfaceTop.cpp\
+								./modules/ModelProcessorx/FreeSurfaceTop/CreateNodesFreeSurfaceTop.cpp\
+								./modules/ModelProcessorx/FreeSurfaceTop/CreateConstraintsFreeSurfaceTop.cpp\
+								./modules/ModelProcessorx/FreeSurfaceTop/CreateLoadsFreeSurfaceTop.cpp\
+								./modules/ModelProcessorx/FreeSurfaceBase/UpdateElementsFreeSurfaceBase.cpp\
+								./modules/ModelProcessorx/FreeSurfaceBase/CreateNodesFreeSurfaceBase.cpp\
+								./modules/ModelProcessorx/FreeSurfaceBase/CreateConstraintsFreeSurfaceBase.cpp\
+								./modules/ModelProcessorx/FreeSurfaceBase/CreateLoadsFreeSurfaceBase.cpp\
+								./analyses/masstransport_core.cpp
+
 #}}}
 #Thermal sources  {{{
@@ -437,5 +464,5 @@
 					  ./analyses/objectivefunction.cpp\
 					  ./analyses/gradient_core.cpp\
-					  ./analyses/adjointdiagnostic_core.cpp\
+					  ./analyses/adjointstressbalance_core.cpp\
 					  ./analyses/adjointbalancethickness_core.cpp\
 					  ./analyses/AdjointCorePointerFromSolutionEnum.cpp\
@@ -462,18 +489,18 @@
 							./solutionsequences/solutionsequence_hydro_nonlinear.cpp
 #}}}
-#Diagnostic sources  {{{
-diagnostic_sources = ./modules/ModelProcessorx/DiagnosticHoriz/UpdateElementsDiagnosticHoriz.cpp\
-					      ./modules/ModelProcessorx/DiagnosticHoriz/CreateNodesDiagnosticHoriz.cpp \
-					      ./modules/ModelProcessorx/DiagnosticHoriz/CreateConstraintsDiagnosticHoriz.cpp \
-					      ./modules/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp\
-					      ./modules/ModelProcessorx/DiagnosticVert/UpdateElementsDiagnosticVert.cpp\
-					      ./modules/ModelProcessorx/DiagnosticVert/CreateNodesDiagnosticVert.cpp \
-					      ./modules/ModelProcessorx/DiagnosticVert/CreateConstraintsDiagnosticVert.cpp \
-					      ./modules/ModelProcessorx/DiagnosticVert/CreateLoadsDiagnosticVert.cpp\
-					      ./modules/ModelProcessorx/DiagnosticHutter/UpdateElementsDiagnosticHutter.cpp\
-					      ./modules/ModelProcessorx/DiagnosticHutter/CreateNodesDiagnosticHutter.cpp \
-					      ./modules/ModelProcessorx/DiagnosticHutter/CreateConstraintsDiagnosticHutter.cpp \
-							./modules/ModelProcessorx/DiagnosticHutter/CreateLoadsDiagnosticHutter.cpp \
-							./analyses/diagnostic_core.cpp\
+#Stressbalance sources  {{{
+stressbalance_sources = ./modules/ModelProcessorx/Stressbalance/UpdateElementsStressbalance.cpp\
+					      ./modules/ModelProcessorx/Stressbalance/CreateNodesStressbalance.cpp \
+					      ./modules/ModelProcessorx/Stressbalance/CreateConstraintsStressbalance.cpp \
+					      ./modules/ModelProcessorx/Stressbalance/CreateLoadsStressbalance.cpp\
+					      ./modules/ModelProcessorx/StressbalanceVertical/UpdateElementsStressbalanceVertical.cpp\
+					      ./modules/ModelProcessorx/StressbalanceVertical/CreateNodesStressbalanceVertical.cpp \
+					      ./modules/ModelProcessorx/StressbalanceVertical/CreateConstraintsStressbalanceVertical.cpp \
+					      ./modules/ModelProcessorx/StressbalanceVertical/CreateLoadsStressbalanceVertical.cpp\
+					      ./modules/ModelProcessorx/StressbalanceSIA/UpdateElementsStressbalanceSIA.cpp\
+					      ./modules/ModelProcessorx/StressbalanceSIA/CreateNodesStressbalanceSIA.cpp \
+					      ./modules/ModelProcessorx/StressbalanceSIA/CreateConstraintsStressbalanceSIA.cpp \
+							./modules/ModelProcessorx/StressbalanceSIA/CreateLoadsStressbalanceSIA.cpp \
+							./analyses/stressbalance_core.cpp\
 							./solutionsequences/solutionsequence_stokescoupling_nonlinear.cpp
 #}}}
@@ -483,5 +510,10 @@
 					    ./modules/ModelProcessorx/Balancethickness/CreateConstraintsBalancethickness.cpp\
 						 ./modules/ModelProcessorx/Balancethickness/CreateLoadsBalancethickness.cpp\
+						 ./modules/ModelProcessorx/Balancevelocity/UpdateElementsBalancevelocity.cpp\
+						 ./modules/ModelProcessorx/Balancevelocity/CreateNodesBalancevelocity.cpp\
+						 ./modules/ModelProcessorx/Balancevelocity/CreateConstraintsBalancevelocity.cpp\
+						 ./modules/ModelProcessorx/Balancevelocity/CreateLoadsBalancevelocity.cpp\
 						 ./analyses/balancethickness_core.cpp \
+						 ./analyses/balancevelocity_core.cpp \
 						 ./analyses/dummy_core.cpp
 #}}}
@@ -533,6 +565,6 @@
 				     ./classes/ElementResults/PentaP1ElementResult.h\
 				     ./classes/ElementResults/PentaP1ElementResult.cpp\
-				     ./classes/Inputs/PentaP1Input.h\
-				     ./classes/Inputs/PentaP1Input.cpp\
+				     ./classes/Inputs/PentaInput.h\
+				     ./classes/Inputs/PentaInput.cpp\
 				     ./classes/Elements/Penta.h\
 				     ./classes/Elements/Penta.cpp\
@@ -760,11 +792,5 @@
 #}}}
 #Mpi sources  {{{
-mpi_sources= ./toolkits/mpi/mpiincludes.h\
-				./toolkits/mpi/patches/mpipatches.h\
-				./toolkits/mpi/patches/DetermineLocalSize.cpp\
-				./toolkits/mpi/patches/DetermineGlobalSize.cpp\
-				./toolkits/mpi/patches/DetermineRowRankFromLocalSize.cpp\
-				./toolkits/mpi/patches/GetOwnershipBoundariesFromRange.cpp\
-				./toolkits/issm/IssmMpiDenseMat.h\
+mpi_sources= ./toolkits/issm/IssmMpiDenseMat.h\
 				./toolkits/issm/IssmMpiVec.h
 #}}}
@@ -867,6 +893,6 @@
 endif
 
-if PROGNOSTIC
-issm_sources  +=  $(prognostic_sources)
+if MASSTRANSPORT
+issm_sources  +=  $(masstransport_sources)
 endif
 
@@ -887,6 +913,6 @@
 endif
 
-if DIAGNOSTIC
-issm_sources  +=  $(diagnostic_sources)
+if STRESSBALANCE
+issm_sources  +=  $(stressbalance_sources)
 endif
 
@@ -939,5 +965,5 @@
 
 libISSMCore_la_SOURCES  = $(issm_sources)
-libISSMCore_la_LIBADD = $(PETSCLIB) $(TAOLIB) $(PLAPACKLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPOOLESLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB) $(ADOLCLIB)
+libISSMCore_la_LIBADD = $(PETSCLIB) $(TAOLIB) $(PLAPACKLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPOOLESLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB)   $(ADOLCLIB) $(AMPILIB) $(METEOIOLIB) $(SNOWPACKLIB) 
 libISSMCore_la_FFLAGS = $(AM_FFLAGS)
 endif
@@ -987,5 +1013,5 @@
 
 #External packages
-LDADD += $(PETSCLIB) $(TAOLIB) $(PLAPACKLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPOOLESLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB) $(ADOLCLIB)
+LDADD += $(PETSCLIB) $(TAOLIB) $(PLAPACKLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPOOLESLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB)  $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB) $(AMPILIB) $(ADOLCLIB) $(METEOIOLIB) $(SNOWPACKLIB)
 
 if FORTRAN
@@ -993,10 +1019,10 @@
 endif
 
-issm_SOURCES = main/issm.cpp
+issm_SOURCES = main/issm.h main/globals.h main/issm.cpp
 issm_CXXFLAGS= -fPIC $(CXXFLAGS) $(CXXOPTFLAGS) $(COPTFLAGS) 
 
 if KRIGING
 bin_PROGRAMS += kriging
-kriging_SOURCES = main/kriging.cpp
+kriging_SOURCES = main/issm.h main/globals.h main/kriging.cpp
 kriging_CXXFLAGS= -fPIC $(CXXFLAGS) $(CXXOPTFLAGS) $(COPTFLAGS) 
 endif
