Changeset 3984
- Timestamp:
- 06/01/10 14:51:09 (15 years ago)
- Location:
- issm/trunk
- Files:
-
- 4 added
- 3 deleted
- 44 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/etc/environment_variables.sh
r3676 r3984 7 7 #MATLAB 8 8 MATLAB_DIR="$ISSM_DIR/externalpackages/matlab/install" 9 MATLAB_VERSION= 9 MATLAB_VERSION=R2008a 10 10 11 11 #MPI -
issm/trunk/externalpackages/matlab/install.sh
r3700 r3984 8 8 9 9 # MAC symlink matlab to root matlab 10 #ln -s /Applications/MATLAB_R2008a/ install10 ln -s /Applications/MATLAB_R2008a/ install 11 11 #export MATLAB_VERSION=R2008a 12 12 # LINUX symlink matlab to root matlab 13 ln -s /usr/local/pkgs/matlab-7.6/ install13 #ln -s /usr/local/pkgs/matlab-7.6/ install 14 14 15 15 16 16 #initialize MATLAB_VERSION in etc/environment_variables 17 cat $ISSM_DIR/etc/environment_variables.sh | sed -e "/MATLAB_VERSION/d" | sed "/^MATLAB_DIR.*$/a\MATLAB_VERSION=$MATLAB_VERSION" > $ISSM_DIR/etc/environment_variables.sh.bak18 mv $ISSM_DIR/etc/environment_variables.sh.bak $ISSM_DIR/etc/environment_variables.sh19 cat $ISSM_DIR/etc/environment_variables.csh | sed -e "/MATLAB_VERSION/d" | sed "/^set MATLAB_DIR.*$/a\set MATLAB_VERSION=$MATLAB_VERSION" > $ISSM_DIR/etc/environment_variables.csh.bak20 mv $ISSM_DIR/etc/environment_variables.csh.bak $ISSM_DIR/etc/environment_variables.csh17 #cat $ISSM_DIR/etc/environment_variables.sh | sed -e "/MATLAB_VERSION/d" | sed "/^MATLAB_DIR.*$/a\MATLAB_VERSION=$MATLAB_VERSION" > $ISSM_DIR/etc/environment_variables.sh.bak 18 #mv $ISSM_DIR/etc/environment_variables.sh.bak $ISSM_DIR/etc/environment_variables.sh 19 #cat $ISSM_DIR/etc/environment_variables.csh | sed -e "/MATLAB_VERSION/d" | sed "/^set MATLAB_DIR.*$/a\set MATLAB_VERSION=$MATLAB_VERSION" > $ISSM_DIR/etc/environment_variables.csh.bak 20 #mv $ISSM_DIR/etc/environment_variables.csh.bak $ISSM_DIR/etc/environment_variables.csh -
issm/trunk/externalpackages/metis/configs/macosx64/Makefile.in.patch
r3318 r3984 8 8 < OPTFLAGS = -DLINUX 9 9 --- 10 > OPTFLAGS = -O2 10 > OPTFLAGS = -O2 -m64 -
issm/trunk/externalpackages/triangle/configs/macosx64/configure.make
r3319 r3984 1 CC=gcc 1 CC=gcc -m64 2 2 CSWITCHES = $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -I$(MATLAB_DIR)/extern/include -fPIC -I$(MATLAB_DIR)/include 3 3 TRILIBDEFS = -DTRILIBRARY -
issm/trunk/m4/matlab.m4
r3754 r3984 312 312 MATLAB_MINOR=`echo $MATLAB_VERSION | sed -e 's/^@<:@0-9@:>@*\.\(@<:@0-9@:>@*\).*/\1/'` 313 313 ;; 314 R2010a) 315 MATLAB_VERSION=R2010a 316 MATLAB_MAJOR=7 317 MATLAB_MINOR=8 318 ;; 319 314 320 R2009a) 315 321 MATLAB_VERSION=R2009a -
issm/trunk/src/c/Makefile.am
r3982 r3984 298 298 ./EnumDefinitions/StringAsEnum.cpp\ 299 299 ./modules/ModelProcessorx/ModelProcessorx.h\ 300 ./modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp 301 ./modules/ModelProcessorx/NodesPartitioning.cpp 300 302 ./modules/ModelProcessorx/Partitioning.cpp\ 301 303 ./modules/ModelProcessorx/CreateDataSets.cpp\ … … 748 750 ./EnumDefinitions/StringAsEnum.cpp\ 749 751 ./modules/ModelProcessorx/ModelProcessorx.h\ 752 ./modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp 753 ./modules/ModelProcessorx/NodesPartitioning.cpp 750 754 ./modules/ModelProcessorx/Partitioning.cpp\ 751 755 ./modules/ModelProcessorx/CreateDataSets.cpp\ -
issm/trunk/src/c/modules/ModelProcessorx/Balancedthickness/CreateElementsNodesAndMaterialsBalancedthickness.cpp
r3913 r3984 34 34 35 35 /*2d mesh: */ 36 if ( strcmp(iomodel->meshtype,"2d")==0){36 if (iomodel->dim==2){ 37 37 38 38 /*Fetch data needed: */ … … 75 75 76 76 } 77 else{ // if ( strcmp(meshtype,"2d")==0)77 else{ // if (dim==2) 78 78 79 79 /*Fetch data needed: */ … … 122 122 123 123 124 } //if ( strcmp(meshtype,"2d")==0)124 } //if (dim==2) 125 125 126 126 /*Add new constrant material property to materials, at the end: */ … … 128 128 129 129 /*First fetch data: */ 130 if ( strcmp(iomodel->meshtype,"3d")==0){130 if (iomodel->dim==3){ 131 131 IoModelFetchData(&iomodel->deadgrids,NULL,NULL,iomodel_handle,"deadgrids"); 132 132 IoModelFetchData(&iomodel->uppernodes,NULL,NULL,iomodel_handle,"uppergrids"); -
issm/trunk/src/c/modules/ModelProcessorx/Balancedthickness2/CreateElementsNodesAndMaterialsBalancedthickness2.cpp
r3913 r3984 37 37 /*elements created vary if we are dealing with a 2d mesh, or a 3d mesh: */ 38 38 /*2d mesh: */ 39 if ( strcmp(iomodel->meshtype,"2d")==0){39 if (iomodel->dim==2){ 40 40 41 41 /*Fetch data needed: */ … … 77 77 78 78 } 79 else{ // if ( strcmp(meshtype,"2d")==0)79 else{ // if (dim==2) 80 80 ISSMERROR("not implemented yet"); 81 } //if ( strcmp(meshtype,"2d")==0)81 } //if (dim==2) 82 82 83 83 /*Add new constrant material property tgo materials, at the end: */ … … 95 95 IoModelFetchData(&iomodel->gridonicesheet,NULL,NULL,iomodel_handle,"gridonicesheet"); 96 96 IoModelFetchData(&iomodel->gridoniceshelf,NULL,NULL,iomodel_handle,"gridoniceshelf"); 97 if ( strcmp(iomodel->meshtype,"3d")==0){97 if (iomodel->dim==3){ 98 98 IoModelFetchData(&iomodel->deadgrids,NULL,NULL,iomodel_handle,"deadgrids"); 99 99 IoModelFetchData(&iomodel->uppernodes,NULL,NULL,iomodel_handle,"uppergrids"); -
issm/trunk/src/c/modules/ModelProcessorx/Balancedvelocities/CreateElementsNodesAndMaterialsBalancedvelocities.cpp
r3913 r3984 34 34 35 35 /*2d mesh: */ 36 if ( strcmp(iomodel->meshtype,"2d")==0){36 if (iomodel->dim==2){ 37 37 38 38 /*Fetch data needed: */ … … 75 75 76 76 } 77 else{ // if ( strcmp(meshtype,"2d")==0)77 else{ // if (dim==2) 78 78 79 79 /*Fetch data needed: */ … … 122 122 123 123 124 } //if ( strcmp(meshtype,"2d")==0)124 } //if (dim==2) 125 125 126 126 /*Add new constrant material property to materials, at the end: */ … … 128 128 129 129 /*First fetch data: */ 130 if ( strcmp(iomodel->meshtype,"3d")==0){130 if (iomodel->dim==3){ 131 131 IoModelFetchData(&iomodel->deadgrids,NULL,NULL,iomodel_handle,"deadgrids"); 132 132 IoModelFetchData(&iomodel->uppernodes,NULL,NULL,iomodel_handle,"uppergrids"); -
issm/trunk/src/c/modules/ModelProcessorx/CreateDataSets.cpp
r3982 r3984 16 16 17 17 18 void CreateDataSets(DataSet** pelements,DataSet** pnodes, DataSet** pvertices, DataSet** pmaterials, DataSet** pconstraints, DataSet** ploads,Parameters** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle,int analysis_type ){18 void CreateDataSets(DataSet** pelements,DataSet** pnodes, DataSet** pvertices, DataSet** pmaterials, DataSet** pconstraints, DataSet** ploads,Parameters** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle,int analysis_type,int nummodels,int analysis_counter){ 19 19 20 /*First, partition elements and vertices. Nodes will partitioned on a per analysis_type basis: */ 21 VerticesPartitioning(&iomodel->my_elements, &iomodel->my_vertices, &iomodel->my_bordervertices, iomodel, iomodel_handle); 20 bool continuous=true; 21 DataSet* elements=NULL; 22 23 /*Create elements, vertices and materials, independent of analysis_type: */ 24 CreateElementsVerticesAndMaterials(pelements, pvertices, pmaterials, iomodel,iomodel_handle,nummodels); 22 25 23 /*create parameters common to all solutions: */ 26 /*Recover elements, for future update: */ 27 elements=*pelements; 28 29 /*Now, branch onto analysis dependent model generation: */ 30 switch(analysis_type){ 31 case DiagnosticHorizAnalysisEnum: 32 CreateNodesDiagnosticHoriz(pnodes, iomodel,iomodel_handle); 33 CreateConstraintsDiagnosticHoriz(pconstraints,iomodel,iomodel_handle); 34 CreateLoadsDiagnosticHoriz(ploads,iomodel,iomodel_handle); 35 UpdateElementsDiagnosticHoriz(elements,iomodel,iomodel_handle,analysis_counter); 36 break; 37 38 case DiagnosticVertAnalysisEnum: 39 CreateNodesDiagnosticVert(pnodes, iomodel,iomodel_handle); 40 CreateConstraintsDiagnosticVert(pconstraints,iomodel,iomodel_handle); 41 CreateLoadsDiagnosticVert(ploads,iomodel,iomodel_handle); 42 UpdateElementsDiagnosticVert(elements,iomodel,iomodel_handle,analysis_counter); 43 break; 44 45 case DiagnosticStokesAnalysisEnum: 46 CreateNodesDiagnosticStokes(pnodes, iomodel,iomodel_handle); 47 CreateConstraintsDiagnosticStokes(pconstraints,iomodel,iomodel_handle); 48 CreateLoadsDiagnosticStokes(ploads,iomodel,iomodel_handle); 49 UpdateElementsDiagnosticStokes(elements,iomodel,iomodel_handle,analysis_counter); 50 break; 51 52 case DiagnosticHutterAnalysisEnum: 53 CreateNodesDiagnosticHutter(pnodes, iomodel,iomodel_handle); 54 CreateConstraintsDiagnosticHutter(pconstraints,iomodel,iomodel_handle); 55 CreateLoadsDiagnosticHutter(ploads,iomodel,iomodel_handle); 56 UpdateElementsDiagnosticHutter(elements,iomodel,iomodel_handle,analysis_counter); 57 break; 58 59 case SlopecomputeAnalysisEnum: 60 CreateNodesSlopeCompute(pnodes, iomodel,iomodel_handle); 61 CreateConstraintsSlopeCompute(pconstraints,iomodel,iomodel_handle); 62 CreateLoadsSlopeCompute(ploads,iomodel,iomodel_handle); 63 UpdateElementsSlopeCompute(elements,iomodel,iomodel_handle,analysis_counter); 64 break; 65 66 case ThermalAnalysisEnum: 67 CreateNodesThermal(pnodes, iomodel,iomodel_handle); 68 CreateConstraintsThermal(pconstraints,iomodel,iomodel_handle); 69 CreateLoadsThermal(ploads,iomodel,iomodel_handle); 70 UpdateElementsThermal(elements,iomodel,iomodel_handle,analysis_counter); 71 break; 72 73 case MeltingAnalysisEnum: 74 CreateNodesMelting(pnodes, iomodel,iomodel_handle); 75 CreateConstraintsMelting(pconstraints,iomodel,iomodel_handle); 76 CreateLoadsMelting(ploads,iomodel,iomodel_handle); 77 UpdateElementsMelting(elements,iomodel,iomodel_handle,analysis_counter); 78 break; 79 80 case PrognosticAnalysisEnum: 81 CreateNodesPrognostic(pnodes, iomodel,iomodel_handle); 82 CreateConstraintsPrognostic(pconstraints,iomodel,iomodel_handle); 83 CreateLoadsPrognostic(ploads,iomodel,iomodel_handle); 84 UpdateElementsPrognostic(elements,iomodel,iomodel_handle,analysis_counter); 85 break; 86 87 case Prognostic2AnalysisEnum: 88 CreateNodesPrognostic2(pnodes, iomodel,iomodel_handle); 89 CreateConstraintsPrognostic2(pconstraints,iomodel,iomodel_handle); 90 CreateLoadsPrognostic2(ploads,iomodel,iomodel_handle); 91 UpdateElementsPrognostic2(elements,iomodel,iomodel_handle,analysis_counter); 92 break; 93 94 case BalancedthicknessAnalysisEnum: 95 CreateNodesBalancedthickness(pnodes, iomodel,iomodel_handle); 96 CreateConstraintsBalancedthickness(pconstraints,iomodel,iomodel_handle); 97 CreateLoadsBalancedthickness(ploads,iomodel,iomodel_handle); 98 UpdateElementsBalancedthickness(elements,iomodel,iomodel_handle,analysis_counter); 99 break; 100 101 case Balancedthickness2AnalysisEnum: 102 CreateNodesBalancedthickness2(pnodes, iomodel,iomodel_handle); 103 CreateConstraintsBalancedthickness2(pconstraints,iomodel,iomodel_handle); 104 CreateLoadsBalancedthickness2(ploads,iomodel,iomodel_handle); 105 UpdateElementsBalancedthickness2(elements,iomodel,iomodel_handle,analysis_counter); 106 break; 107 case BalancedvelocitiesAnalysisEnum: 108 CreateNodesBalancedvelocities(pnodes, iomodel,iomodel_handle); 109 CreateConstraintsBalancedvelocities(pconstraints,iomodel,iomodel_handle); 110 CreateLoadsBalancedvelocities(ploads,iomodel,iomodel_handle); 111 UpdateElementsBalancedvelocities(elements,iomodel,iomodel_handle,analysis_counter); 112 break; 113 default: 114 ISSMERROR("%s%s%s"," analysis_type: ",EnumAsString(analysis_type)," not supported yet!"); 115 } 116 117 /*Generate objects that are not dependent on any analysis_type: */ 24 118 CreateParameters(pparameters,iomodel,iomodel_handle); 25 26 119 CreateParametersControl(pparameters,iomodel,iomodel_handle); 27 28 /*This is just a high level driver: */29 if (analysis_type==DiagnosticHorizAnalysisEnum){30 CreateElementsNodesAndMaterialsDiagnosticHoriz(pelements,pnodes, pvertices, pmaterials, iomodel,iomodel_handle);31 CreateConstraintsDiagnosticHoriz(pconstraints,iomodel,iomodel_handle);32 CreateLoadsDiagnosticHoriz(ploads,iomodel,iomodel_handle);33 }34 else if (analysis_type==DiagnosticVertAnalysisEnum){35 36 CreateElementsNodesAndMaterialsDiagnosticVert(pelements,pnodes, pvertices, pmaterials, iomodel,iomodel_handle);37 CreateConstraintsDiagnosticVert(pconstraints,iomodel,iomodel_handle);38 CreateLoadsDiagnosticVert(ploads,iomodel,iomodel_handle);39 }40 else if (analysis_type==DiagnosticStokesAnalysisEnum){41 42 CreateElementsNodesAndMaterialsDiagnosticStokes(pelements,pnodes, pvertices, pmaterials, iomodel,iomodel_handle);43 CreateConstraintsDiagnosticStokes(pconstraints,iomodel,iomodel_handle);44 CreateLoadsDiagnosticStokes(ploads,iomodel,iomodel_handle);45 }46 else if (analysis_type==DiagnosticHutterAnalysisEnum){47 48 CreateElementsNodesAndMaterialsDiagnosticHutter(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);49 CreateConstraintsDiagnosticHutter(pconstraints,iomodel,iomodel_handle);50 CreateLoadsDiagnosticHutter(ploads,iomodel,iomodel_handle);51 }52 else if (analysis_type==SlopecomputeAnalysisEnum){53 54 CreateElementsNodesAndMaterialsSlopeCompute(pelements,pnodes, pvertices,pmaterials, iomodel,iomodel_handle);55 CreateConstraintsSlopeCompute(pconstraints,iomodel,iomodel_handle);56 CreateLoadsSlopeCompute(ploads,iomodel,iomodel_handle);57 }58 else if (analysis_type==ThermalAnalysisEnum){59 60 CreateElementsNodesAndMaterialsThermal(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);61 CreateConstraintsThermal(pconstraints,iomodel,iomodel_handle);62 CreateLoadsThermal(ploads,iomodel,iomodel_handle);63 64 }65 else if (analysis_type==MeltingAnalysisEnum){66 67 CreateElementsNodesAndMaterialsMelting(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);68 CreateConstraintsMelting(pconstraints,iomodel,iomodel_handle);69 CreateLoadsMelting(ploads,iomodel,iomodel_handle);70 }71 else if (analysis_type==PrognosticAnalysisEnum){72 73 CreateElementsNodesAndMaterialsPrognostic(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);74 CreateConstraintsPrognostic(pconstraints,iomodel,iomodel_handle);75 CreateLoadsPrognostic(ploads,iomodel,iomodel_handle);76 }77 else if (analysis_type==Prognostic2AnalysisEnum){78 79 CreateElementsNodesAndMaterialsPrognostic2(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);80 CreateConstraintsPrognostic2(pconstraints,iomodel,iomodel_handle);81 CreateLoadsPrognostic2(ploads,iomodel,iomodel_handle);82 }83 else if (analysis_type==BalancedthicknessAnalysisEnum){84 85 CreateElementsNodesAndMaterialsBalancedthickness(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);86 CreateConstraintsBalancedthickness(pconstraints,iomodel,iomodel_handle);87 CreateLoadsBalancedthickness(ploads,iomodel,iomodel_handle);88 }89 else if (analysis_type==Balancedthickness2AnalysisEnum){90 91 CreateElementsNodesAndMaterialsBalancedthickness2(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);92 CreateConstraintsBalancedthickness2(pconstraints,iomodel,iomodel_handle);93 CreateLoadsBalancedthickness2(ploads,iomodel,iomodel_handle);94 }95 else if (analysis_type==BalancedvelocitiesAnalysisEnum){96 97 CreateElementsNodesAndMaterialsBalancedvelocities(pelements,pnodes,pvertices,pmaterials, iomodel,iomodel_handle);98 CreateConstraintsBalancedvelocities(pconstraints,iomodel,iomodel_handle);99 CreateLoadsBalancedvelocities(ploads,iomodel,iomodel_handle);100 }101 else{102 ISSMERROR("%s%i%s%i%s"," analysis_type: ",analysis_type," analysis_type: ",analysis_type," not supported yet!");103 104 }105 120 CreateParametersQmu(pparameters,iomodel,iomodel_handle); 106 107 121 } -
issm/trunk/src/c/modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp
r3931 r3984 33 33 34 34 /*Get element width (3 or 6)*/ 35 if ( strcmp(iomodel->meshtype,"2d")==0){35 if (iomodel->dim==2){ 36 36 elementswidth=3; 37 37 } -
issm/trunk/src/c/modules/ModelProcessorx/CreateParameters.cpp
r3913 r3984 28 28 parameters = new Parameters(ParametersEnum); 29 29 30 if ( strcmp(iomodel->meshtype,"2d")==0) parameters->AddObject(new IntParam(DimEnum,2));30 if (iomodel->dim==2) parameters->AddObject(new IntParam(DimEnum,2)); 31 31 else parameters->AddObject(new IntParam(DimEnum,3)); 32 32 parameters->AddObject(new IntParam(AnalysisTypeEnum,iomodel->analysis_type)); -
issm/trunk/src/c/modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp
r3913 r3984 34 34 35 35 /*Get element width (3 or 6)*/ 36 if ( strcmp(iomodel->meshtype,"2d")==0){36 if (iomodel->dim==2){ 37 37 elementswidth=3; 38 38 } -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp
r3913 r3984 39 39 40 40 /*Retrieve element to which this icefront belongs: */ 41 if ( strcmp(iomodel->meshtype,"2d")==0) segment_width=4;41 if (iomodel->dim==2) segment_width=4; 42 42 else segment_width=6; 43 43 element=(int)(*(iomodel->pressureload+segment_width*i+segment_width-2)-1); //element is in the penultimate column (grid1 grid2 ... elem fill) -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHutter/CreateElementsNodesAndMaterialsDiagnosticHutter.cpp
r3947 r3984 59 59 60 60 /*2d mesh: */ 61 if ( strcmp(iomodel->meshtype,"2d")==0){61 if (iomodel->dim==2){ 62 62 63 63 for (i=0;i<iomodel->numberofelements;i++){ … … 75 75 } 76 76 } //for (i=0;i<iomodel->numberofvertices;i++) 77 } //if ( strcmp(iomodel->meshtype,"2d")==0)77 } //if (iomodel->dim==2) 78 78 else{ 79 79 … … 96 96 } //for (i=0;i<iomodel->numberofelements;i++) 97 97 98 } //if ( strcmp(iomodel->meshtype,"2d")==0)98 } //if (iomodel->dim==2) 99 99 100 100 /*Free data: */ … … 117 117 118 118 /*Add new constrant material property to materials, at the end: */ 119 if ( strcmp(iomodel->meshtype,"2d")==0){119 if (iomodel->dim==2){ 120 120 materials->AddObject(new Matpar(iomodel->numberofelements+1,iomodel)); //put it at the end of the materials 121 121 } … … 125 125 126 126 /*First fetch data: */ 127 if ( strcmp(iomodel->meshtype,"3d")==0){127 if (iomodel->dim==3){ 128 128 IoModelFetchData(&iomodel->deadgrids,NULL,NULL,iomodel_handle,"deadgrids"); 129 129 IoModelFetchData(&iomodel->uppernodes,NULL,NULL,iomodel_handle,"uppergrids"); -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticStokes/CreateElementsNodesAndMaterialsDiagnosticStokes.cpp
r3913 r3984 31 31 32 32 /*Now, do we have Stokes elements?*/ 33 if ( strcmp(iomodel->meshtype,"2d")==0) goto cleanup_and_return;33 if (iomodel->dim==2) goto cleanup_and_return; 34 34 if (!iomodel->isstokes) goto cleanup_and_return; 35 35 -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticVert/CreateConstraintsDiagnosticVert.cpp
r3913 r3984 21 21 22 22 /*return if 2d mesh*/ 23 if ( strcmp(iomodel->meshtype,"2d")==0)goto cleanup_and_return;23 if (iomodel->dim==2)goto cleanup_and_return; 24 24 25 25 /*Fetch data: */ -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticVert/CreateElementsNodesAndMaterialsDiagnosticVert.cpp
r3913 r3984 31 31 32 32 /*Now, is the flag macayaealpattyn on? otherwise, do nothing: */ 33 if ( strcmp(iomodel->meshtype,"2d")==0)goto cleanup_and_return;33 if (iomodel->dim==2)goto cleanup_and_return; 34 34 35 35 /*Partition elements and vertices and nodes: */ -
issm/trunk/src/c/modules/ModelProcessorx/Melting/CreateElementsNodesAndMaterialsMelting.cpp
r3913 r3984 92 92 93 93 /*First fetch data: */ 94 if ( strcmp(iomodel->meshtype,"3d")==0){94 if (iomodel->dim==3){ 95 95 IoModelFetchData(&iomodel->deadgrids,NULL,NULL,iomodel_handle,"deadgrids"); 96 96 IoModelFetchData(&iomodel->uppernodes,NULL,NULL,iomodel_handle,"uppergrids"); -
issm/trunk/src/c/modules/ModelProcessorx/Melting/CreateLoadsMelting.cpp
r3913 r3984 18 18 19 19 /*if 2d: return*/ 20 if ( strcmp(iomodel->meshtype,"2d")==0)goto cleanup_and_return;20 if (iomodel->dim==2)goto cleanup_and_return; 21 21 22 22 /*Create loads: */ -
issm/trunk/src/c/modules/ModelProcessorx/ModelProcessorx.h
r3982 r3984 13 13 #include "../../io/io.h" 14 14 15 /*Creation of fem datasets: general drivers*/ 16 void CreateDataSets(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, DataSet** pconstraints, DataSet** ploads,Parameters** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle,int analysis_type,int nummodels,int analysis_counter); 17 void CreateElementsVerticesAndMaterials(DataSet** pelements,DataSet** pvertices,DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle,int nummodels); 18 void CreateParameters(Parameters** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle); 19 void CreateParametersControl(Parameters** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle); 20 void CreateParametersQmu(Parameters** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle); 15 21 16 /*Creation of fem datasets: general drivers*/ 17 void CreateDataSets(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, DataSet** pconstraints, DataSet** ploads,Parameters** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle,int analysis_type); 18 void CreateParameters(Parameters** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle); 19 20 /*Create of fem datasets: specialised drivers: */ 22 /*Creation of fem datasets: specialised drivers: */ 21 23 22 24 /*diagnostic horizontal*/ 23 void Create ElementsNodesAndMaterialsDiagnosticHoriz(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);25 void CreateNodesDiagnosticHoriz(pnodes,IoModel* iomodel_handle,ConstDataHandle iomodel_handle); 24 26 void CreateConstraintsDiagnosticHoriz(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle); 25 void CreateLoadsDiagnosticHoriz(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle); 27 void CreateLoadsDiagnosticHoriz(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle); 28 void UpdateElementsDiagnosticHoriz(DataSet* elements,IoModel* iomodel_handle,ConstDataHandle iomodel_handle); 26 29 27 30 /*diagnostic vertical*/ 28 void Create ElementsNodesAndMaterialsDiagnosticVert(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);31 void CreateNodesDiagnosticVert(pnodes,IoModel* iomodel_handle,ConstDataHandle iomodel_handle); 29 32 void CreateConstraintsDiagnosticVert(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle); 30 void CreateLoadsDiagnosticVert(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle); 33 void CreateLoadsDiagnosticVert(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle); 34 void UpdateElements(DataSet* elements,IoModel* iomodel_handle,ConstDataHandle iomodel_handle); 31 35 32 36 /*diagnostic hutter*/ 33 void Create ElementsNodesAndMaterialsDiagnosticHutter(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);37 void CreateNodesDiagnosticHutter(pnodes,IoModel* iomodel_handle,ConstDataHandle iomodel_handle); 34 38 void CreateConstraintsDiagnosticHutter(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle); 35 void CreateLoadsDiagnosticHutter(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle); 39 void CreateLoadsDiagnosticHutter(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle); 40 void UpdateElements(DataSet* elements,IoModel* iomodel_handle,ConstDataHandle iomodel_handle); 36 41 37 42 /*diagnostic stokes*/ 38 void Create ElementsNodesAndMaterialsDiagnosticStokes(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);43 void CreateNodesDiagnosticStokes(pnodes,IoModel* iomodel_handle,ConstDataHandle iomodel_handle); 39 44 void CreateConstraintsDiagnosticStokes(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle); 40 void CreateLoadsDiagnosticStokes(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle); 45 void CreateLoadsDiagnosticStokes(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle); 46 void UpdateElements(DataSet* elements,IoModel* iomodel_handle,ConstDataHandle iomodel_handle); 41 47 42 48 /*slope compute*/ 43 void Create ElementsNodesAndMaterialsSlopeCompute(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);49 void CreateNodesSlopeCompute(pnodes,IoModel* iomodel_handle,ConstDataHandle iomodel_handle); 44 50 void CreateConstraintsSlopeCompute(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle); 45 void CreateLoadsSlopeCompute(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle); 46 47 /*control:*/ 48 void CreateParametersControl(Parameters** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle); 51 void CreateLoadsSlopeCompute(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle); 52 void UpdateElements(DataSet* elements,IoModel* iomodel_handle,ConstDataHandle iomodel_handle); 49 53 50 54 /*thermal:*/ 51 void Create ElementsNodesAndMaterialsThermal(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);55 void CreateNodesThermal(pnodes,IoModel* iomodel_handle,ConstDataHandle iomodel_handle); 52 56 void CreateConstraintsThermal(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle); 53 void CreateLoadsThermal(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle); 57 void CreateLoadsThermal(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle); 58 void UpdateElements(DataSet* elements,IoModel* iomodel_handle,ConstDataHandle iomodel_handle); 54 59 55 60 /*melting:*/ 56 void Create ElementsNodesAndMaterialsMelting(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);61 void CreateNodesMelting(pnodes,IoModel* iomodel_handle,ConstDataHandle iomodel_handle); 57 62 void CreateConstraintsMelting(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle); 58 void CreateLoadsMelting(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle); 63 void CreateLoadsMelting(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle); 64 void UpdateElements(DataSet* elements,IoModel* iomodel_handle,ConstDataHandle iomodel_handle); 59 65 60 66 /*prognostic:*/ 61 void Create ElementsNodesAndMaterialsPrognostic(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);67 void CreateNodesPrognostic(pnodes,IoModel* iomodel_handle,ConstDataHandle iomodel_handle); 62 68 void CreateConstraintsPrognostic(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle); 63 void CreateLoadsPrognostic(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle); 69 void CreateLoadsPrognostic(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle); 70 void UpdateElements(DataSet* elements,IoModel* iomodel_handle,ConstDataHandle iomodel_handle); 64 71 65 72 /*prognostic2:*/ 66 void Create ElementsNodesAndMaterialsPrognostic2(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);73 void CreateNodesPrognostic2(pnodes,IoModel* iomodel_handle,ConstDataHandle iomodel_handle); 67 74 void CreateConstraintsPrognostic2(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle); 68 void CreateLoadsPrognostic2(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle); 75 void CreateLoadsPrognostic2(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle); 76 void UpdateElements(DataSet* elements,IoModel* iomodel_handle,ConstDataHandle iomodel_handle); 69 77 70 78 /*balancedthickness:*/ 71 void Create ElementsNodesAndMaterialsBalancedthickness(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);79 void CreateNodesBalancedthickness(pnodes,IoModel* iomodel_handle,ConstDataHandle iomodel_handle); 72 80 void CreateConstraintsBalancedthickness(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle); 73 void CreateLoadsBalancedthickness(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle); 81 void CreateLoadsBalancedthickness(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle); 82 void UpdateElements(DataSet* elements,IoModel* iomodel_handle,ConstDataHandle iomodel_handle); 74 83 75 void Create ElementsNodesAndMaterialsBalancedthickness2(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);84 void CreateNodesBalancedthickness2(pnodes,IoModel* iomodel_handle,ConstDataHandle iomodel_handle); 76 85 void CreateConstraintsBalancedthickness2(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle); 77 void CreateLoadsBalancedthickness2(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle);78 86 void CreateLoadsBalancedthickness2(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle); 87 void UpdateElements(DataSet* elements,IoModel* iomodel_handle,ConstDataHandle iomodel_handle); 79 88 80 89 /*balancedvelocities:*/ 81 void Create ElementsNodesAndMaterialsBalancedvelocities(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle);90 void CreateNodesBalancedvelocities(pnodes,IoModel* iomodel_handle,ConstDataHandle iomodel_handle); 82 91 void CreateConstraintsBalancedvelocities(DataSet** pconstraints,IoModel* iomodel,ConstDataHandle iomodel_handle); 83 void CreateLoadsBalancedvelocities(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle); 84 85 /*qmu: */ 86 void CreateParametersQmu(Parameters** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle); 92 void CreateLoadsBalancedvelocities(DataSet** ploads, IoModel* iomodel, ConstDataHandle iomodel_handle); 93 void UpdateElements(DataSet* elements,IoModel* iomodel_handle,ConstDataHandle iomodel_handle); 87 94 88 95 /*partitioning: */ 89 void VerticesPartitioning(bool** pmy_elements, bool** pmy_vertices, bool** pmy_bordervertices, IoModel* iomodel, ConstDataHandle iomodel_handle);90 void NodesPartitioning(bool** pmy_nodes,bool* my_elements, bool* my_vertices, bool* my_bordervertices, IoModel* iomodel, ConstDataHandle iomodel_handle,bool continuous);96 void ElementsAndVerticesPartitioning(bool** pmy_elements, bool** pmy_vertices, bool** pmy_bordervertices, IoModel* iomodel, ConstDataHandle iomodel_handle); 97 void NodesPartitioning(bool** pmy_nodes,bool* my_elements, bool* my_vertices, bool* my_bordervertices, IoModel* iomodel, ConstDataHandle iomodel_handle,bool continuous); 91 98 92 /*Con ectivity*/93 void CreateSingleNodeToElementConnectivity(IoModel* iomodel);94 void CreateNumberNodeToElementConnectivity(IoModel* iomodel);99 /*Connectivity*/ 100 void CreateSingleNodeToElementConnectivity(IoModel* iomodel); 101 void CreateNumberNodeToElementConnectivity(IoModel* iomodel); 95 102 96 103 #endif -
issm/trunk/src/c/modules/ModelProcessorx/NodesPartitioning.cpp
r3982 r3984 23 23 void NodesPartitioning(bool** pmy_nodes,bool* my_elements, bool* my_vertices, bool* my_bordervertices, IoModel* iomodel, ConstDataHandle iomodel_handle,bool continuous){ 24 24 25 /*First thing, this is a new partition for a new analysis_type, therefore, to avoid a leak, erase the nodes partition that might come through pmy_nodes: */ 26 xfree((void**)pmy_nodes); 27 28 /*Now, depending on whether we are running galerkin discontinous or continuous elements, carry out a different partition of the nodes: */ 25 29 if(continuous==true){ 26 30 ContinuousGalerkinNodesPartitioning(pmy_nodes,my_elements, my_vertices, my_bordervertices, iomodel, iomodel_handle); … … 73 77 74 78 /*First: add all the nodes of all the elements belonging to this cpu*/ 75 if ( strcmp(iomodel->meshtype,"2d")==0){79 if (iomodel->dim==2){ 76 80 for (i=0;i<iomodel->numberofelements;i++){ 77 81 if (my_elements[i]){ -
issm/trunk/src/c/modules/ModelProcessorx/Prognostic/CreateElementsNodesAndMaterialsPrognostic.cpp
r3913 r3984 34 34 35 35 /*2d mesh: */ 36 if ( strcmp(iomodel->meshtype,"2d")==0){36 if (iomodel->dim==2){ 37 37 38 38 /*Fetch data needed: */ … … 74 74 75 75 } 76 else{ // if ( strcmp(meshtype,"2d")==0)76 else{ // if (dim==2) 77 77 78 78 /*Fetch data needed: */ … … 123 123 124 124 125 } //if ( strcmp(meshtype,"2d")==0)125 } //if (dim==2) 126 126 127 127 /*Add new constrant material property to materials, at the end: */ … … 129 129 130 130 /*First fetch data: */ 131 if ( strcmp(iomodel->meshtype,"3d")==0){131 if (iomodel->dim==3){ 132 132 IoModelFetchData(&iomodel->deadgrids,NULL,NULL,iomodel_handle,"deadgrids"); 133 133 IoModelFetchData(&iomodel->uppernodes,NULL,NULL,iomodel_handle,"uppergrids"); -
issm/trunk/src/c/modules/ModelProcessorx/Prognostic2/CreateElementsNodesAndMaterialsPrognostic2.cpp
r3913 r3984 37 37 /*elements created vary if we are dealing with a 2d mesh, or a 3d mesh: */ 38 38 /*2d mesh: */ 39 if ( strcmp(iomodel->meshtype,"2d")==0){39 if (iomodel->dim==2){ 40 40 41 41 /*Fetch data needed: */ … … 75 75 76 76 } 77 else{ // if ( strcmp(meshtype,"2d")==0)77 else{ // if (dim==2) 78 78 ISSMERROR("not implemented yet"); 79 } //if ( strcmp(meshtype,"2d")==0)79 } //if (dim==2) 80 80 81 81 /*Add new constrant material property tgo materials, at the end: */ … … 93 93 IoModelFetchData(&iomodel->gridonicesheet,NULL,NULL,iomodel_handle,"gridonicesheet"); 94 94 IoModelFetchData(&iomodel->gridoniceshelf,NULL,NULL,iomodel_handle,"gridoniceshelf"); 95 if ( strcmp(iomodel->meshtype,"3d")==0){95 if (iomodel->dim==3){ 96 96 IoModelFetchData(&iomodel->deadgrids,NULL,NULL,iomodel_handle,"deadgrids"); 97 97 IoModelFetchData(&iomodel->uppernodes,NULL,NULL,iomodel_handle,"uppergrids"); -
issm/trunk/src/c/modules/ModelProcessorx/SlopeCompute/CreateElementsNodesAndMaterialsSlopeCompute.cpp
r3913 r3984 34 34 35 35 /*2d mesh: */ 36 if ( strcmp(iomodel->meshtype,"2d")==0){36 if (iomodel->dim==2){ 37 37 38 38 /*Fetch data needed: */ … … 63 63 64 64 } 65 else{ // if ( strcmp(meshtype,"2d")==0)65 else{ // if (dim==2) 66 66 67 67 /*Fetch data needed: */ … … 94 94 xfree((void**)&iomodel->lowerelements); 95 95 96 } //if ( strcmp(meshtype,"2d")==0)96 } //if (dim==2) 97 97 98 98 /*Add new constrant material property tgo materials, at the end: */ … … 100 100 101 101 /*First fetch data: */ 102 if ( strcmp(iomodel->meshtype,"3d")==0){102 if (iomodel->dim==3){ 103 103 IoModelFetchData(&iomodel->deadgrids,NULL,NULL,iomodel_handle,"deadgrids"); 104 104 IoModelFetchData(&iomodel->uppernodes,NULL,NULL,iomodel_handle,"uppergrids"); -
issm/trunk/src/c/modules/ModelProcessorx/Thermal/CreateConstraintsThermal.cpp
r3913 r3984 23 23 24 24 /*return if 2d mesh*/ 25 if ( strcmp(iomodel->meshtype,"2d")==0)goto cleanup_and_return;25 if (iomodel->dim==2)goto cleanup_and_return; 26 26 27 27 /*Fetch data: */ -
issm/trunk/src/c/modules/ModelProcessorx/Thermal/CreateElementsNodesAndMaterialsThermal.cpp
r3955 r3984 96 96 97 97 /*Create nodes and vertices: */ 98 if ( strcmp(iomodel->meshtype,"3d")==0){98 if (iomodel->dim==3){ 99 99 IoModelFetchData(&iomodel->deadgrids,NULL,NULL,iomodel_handle,"deadgrids"); 100 100 IoModelFetchData(&iomodel->uppernodes,NULL,NULL,iomodel_handle,"uppergrids"); -
issm/trunk/src/c/modules/ModelProcessorx/Thermal/CreateLoadsThermal.cpp
r3913 r3984 19 19 20 20 /*return if 2d mesh*/ 21 if ( strcmp(iomodel->meshtype,"2d")==0)goto cleanup_and_return;21 if (iomodel->dim==2)goto cleanup_and_return; 22 22 23 23 /*Create loads: */ -
issm/trunk/src/c/objects/Elements/Penta.cpp
r3977 r3984 27 27 this->matpar=NULL; 28 28 this->neighbors=NULL; 29 this->collapse=NULL; 29 30 30 31 this->inputs=NULL; … … 36 37 delete inputs; 37 38 this->parameters=NULL; 38 } 39 /*}}}*/ 40 /*FUNCTION Penta::Penta(int id, int index, IoModel* iomodel) {{{1*/ 41 Penta::Penta(int penta_id, int index, IoModel* iomodel){ //i is the element index 39 xfree((void**)&collapse); 40 } 41 /*}}}*/ 42 /*FUNCTION Penta::Penta(int id, int index, IoModel* iomodel,int nummodels) {{{1*/ 43 Penta::Penta(int penta_id, int index, IoModel* iomodel,int nummodels){ //i is the element index 42 44 43 45 IssmInt i; 44 int penta_node_ids[6];45 46 int penta_matice_id; 46 47 int penta_matpar_id; 47 48 int penta_elements_ids[2]; 48 double nodeinputs[6];49 49 bool collapse; 50 50 … … 53 53 54 54 /*hooks: */ 55 ISSMASSERT(iomodel->elements);56 for(i=0;i<6;i++){ //go recover node ids, needed to initialize the node hook.57 penta_node_ids[i]=(int)*(iomodel->elements+6*index+i); //ids for vertices are in the elements array from Matlab58 }59 55 penta_matice_id=index+1; //refers to the corresponding ice material object 60 56 penta_matpar_id=iomodel->numberofelements+1; //refers to the constant material parameters object 61 57 62 ISSMASSERT(iomodel->upperelements);63 58 if isnan(iomodel->upperelements[index]){ 64 59 penta_elements_ids[0]=this->id; //upper penta is the same penta … … 67 62 penta_elements_ids[0]=(int)(iomodel->upperelements[index]); 68 63 } 69 ISSMASSERT(iomodel->lowerelements);64 70 65 if isnan(iomodel->lowerelements[index]){ 71 66 penta_elements_ids[1]=this->id; //lower penta is the same penta … … 74 69 penta_elements_ids[1]=(int)(iomodel->lowerelements[index]); 75 70 } 76 this->InitHookNodes( penta_node_ids);this->nodes=NULL;71 this->InitHookNodes(nummodels);this->nodes=NULL; 77 72 this->InitHookMatice(penta_matice_id);this->matice=NULL; 78 73 this->InitHookMatpar(penta_matpar_id);this->matpar=NULL; 79 74 this->InitHookNeighbors(penta_elements_ids);this->neighbors=NULL; 75 76 //this->parameters: we still can't point to it, it may not even exist. Configure will handle this. 77 this->parameters=NULL; 78 79 //collpase flags 80 collapse=(bool*)xcalloc(nummodels*sizeof(bool)); 81 82 } 83 /*}}}*/ 84 /*FUNCTION Penta::Update(IoModel* iomodel,int analysis_counter) {{{1*/ 85 Penta::Update(IoModel* iomodel,int analysis_counter){ 86 87 IssmInt i; 88 int penta_node_ids[6]; 89 double nodeinputs[6]; 90 91 /*hooks: */ 92 for(i=0;i<6;i++){ //go recover node ids, needed to initialize the node hook. 93 penta_node_ids[i]=(int)*(iomodel->elements+6*index+i); //ids for vertices are in the elements array from Matlab 94 } 95 96 this->SettHookNodes(penta_node_ids,analysis_counter); this->nodes=NULL; //set hook to nodes, for this analysis type 80 97 81 98 //intialize inputs, and add as many inputs per element as requested: … … 186 203 if(iomodel->elements_type){ 187 204 if (*(iomodel->elements_type+2*i+0)==MacAyealFormulationEnum){ 188 collapse =1;205 collapse[analysis_counter]=true; 189 206 } 190 207 else{ 191 collapse =0;208 collapse[analysis_counter]=false; 192 209 } 193 210 } 194 this->inputs->AddInput(new BoolInput(CollapseEnum,(IssmBool)collapse));195 196 211 } 197 212 /*}}}*/ … … 215 230 216 231 /*now deal with hooks and objects: */ 232 penta->InitHookNodes(this->nummodels); 233 for(i=0;i<this->nummodels;i++)penta->hnodes[i].copy(&this->hnodes[i]); 217 234 penta->hnodes.copy(&this->hnodes); 218 235 penta->hmatice.copy(&this->hmatice); … … 221 238 222 239 /*recover objects: */ 223 penta->nodes=(Node**)penta->hnodes.deliverp(); 240 penta->nodes=(Node**)xmalloc(6*sizeof(Node*)); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes. 241 for(i=0;i<6;i++)penta->nodes[i]=this->nodes[i]; 224 242 penta->matice=(Matice*)penta->hmatice.delivers(); 225 243 penta->matpar=(Matpar*)penta->hmatpar.delivers(); … … 232 250 /*Object management: */ 233 251 /*FUNCTION Penta::Configure {{{1*/ 234 void Penta::Configure(DataSet* elementsin, DataSet* loadsin, DataSet* nodesin, DataSet* materialsin, Parameters* parametersin ){252 void Penta::Configure(DataSet* elementsin, DataSet* loadsin, DataSet* nodesin, DataSet* materialsin, Parameters* parametersin,int analysis_counter){ 235 253 236 254 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 237 255 * datasets, using internal ids and offsets hidden in hooks: */ 238 this->hnodes .configure(nodesin);256 this->hnodes[analysis_counter].configure(nodesin); 239 257 this->hmatice.configure(materialsin); 240 258 this->hmatpar.configure(materialsin); … … 242 260 243 261 /*Now, go pick up the objects inside the hooks: */ 244 this->nodes=(Node**)this->hnodes .deliverp();262 this->nodes=(Node**)this->hnodes[analysis_counter].deliverp(); 245 263 this->matice=(Matice*)this->hmatice.delivers(); 246 264 this->matpar=(Matpar*)this->hmatpar.delivers(); … … 264 282 265 283 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 284 memcpy(&nummodels,marshalled_dataset,sizeof(nummodels));marshalled_dataset+=sizeof(nummodels); 285 286 /*allocate dynamic memory: */ 287 collapse=(bool*)xmalloc(nummodels*sizeof(bool)); 288 InitHookNodes(nummodels); 266 289 267 290 /*demarshall hooks: */ 268 hnodes.Demarshall(&marshalled_dataset);291 for(i=0;i<nummodels;i++)hnodes[i].Demarshall(&marshalled_dataset); 269 292 hmatice.Demarshall(&marshalled_dataset); 270 293 hmatpar.Demarshall(&marshalled_dataset); 271 294 hneighbors.Demarshall(&marshalled_dataset); 272 295 273 /*pointers are garba be, until configuration is carried out: */296 /*pointers are garbage, until configuration is carried out: */ 274 297 nodes=NULL; 275 298 matice=NULL; … … 280 303 inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset); 281 304 305 /*demarshall internal parameters: */ 306 memcpy(collapse,marshalled_dataset,nummodels*sizeof(bool));marshalled_dataset+=nummodels*sizeof(bool); 307 282 308 /*parameters: may not exist even yet, so let Configure handle it: */ 283 309 this->parameters=NULL; … … 291 317 void Penta::DeepEcho(void){ 292 318 319 int i; 320 293 321 printf("Penta:\n"); 294 322 printf(" id: %i\n",id); … … 306 334 printf(" inputs\n"); 307 335 inputs->DeepEcho(); 308 336 printf(" collapse: \n "); 337 for(i=0;i<nummodels;i++)printf("%s|",value?"true":"false"); 309 338 return; 310 339 } … … 323 352 } 324 353 /*}}}*/ 325 /*FUNCTION Penta::IsInput{{{1*/326 bool Penta::IsInput(int name){327 if (name==ThicknessEnum ||328 name==SurfaceEnum ||329 name==BedEnum ||330 name==SurfaceSlopexEnum ||331 name==SurfaceSlopeyEnum ||332 name==MeltingRateEnum ||333 name==AccumulationRateEnum ||334 name==GeothermalFluxEnum ||335 name==PressureEnum ||336 name==VxEnum ||337 name==VyEnum ||338 name==VzEnum ||339 name==TemperatureEnum ||340 name==TemperatureAverageEnum ||341 name==RheologyBEnum ||342 name==RheologyNEnum) {343 return true;344 }345 else return false;346 }347 /*}}}*/348 /*FUNCTION Penta::IsOnSurface{{{1*/349 bool Penta::IsOnSurface(void){350 351 bool onsurface;352 inputs->GetParameterValue(&onsurface,ElementOnSurfaceEnum);353 return onsurface;354 355 }356 /*}}}*/357 /*FUNCTION Penta::GetUpperElement{{{1*/358 Penta* Penta::GetUpperElement(void){359 360 Penta* upper_penta=NULL;361 upper_penta=(Penta*)neighbors[1]; //first one under, second one above362 return upper_penta;363 364 }365 /*}}}*/366 354 /*FUNCTION Penta::Marshall {{{1*/ 367 355 void Penta::Marshall(char** pmarshalled_dataset){ 368 356 357 int i; 369 358 char* marshalled_dataset=NULL; 370 359 int enum_type=0; … … 383 372 /*marshall Penta data: */ 384 373 memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id); 374 memcpy(marshalled_dataset,&nummodels,sizeof(nummodels));marshalled_dataset+=sizeof(nummodels); 385 375 386 376 /*Marshall hooks: */ 387 hnodes.Marshall(&marshalled_dataset);377 for(i=0;i<nummodels;i++)hnodes[i].Marshall(&marshalled_dataset); 388 378 hmatice.Marshall(&marshalled_dataset); 389 379 hmatpar.Marshall(&marshalled_dataset); … … 396 386 marshalled_dataset+=marshalled_inputs_size; 397 387 388 /*marshall internal parameters: */ 389 memcpy(marshalled_dataset,collapse,nummodels*sizeof(bool));marshalled_dataset+=nummodels*sizeof(bool); 390 398 391 /*parameters: don't do anything about it. parameters are marshalled somewhere else!*/ 399 392 … … 406 399 /*FUNCTION Penta::MarshallSize {{{1*/ 407 400 int Penta::MarshallSize(){ 408 401 402 int i; 403 int hnodes_size=0;; 404 405 for(i=0;i<nummodels;i++)hnodes_size+=hnodes[i].MarshallSize; 406 409 407 return sizeof(id) 410 +hnodes .MarshallSize()408 +hnodes_size 411 409 +hmatice.MarshallSize() 412 410 +hmatpar.MarshallSize() 413 411 +hneighbors.MarshallSize() 414 412 +inputs->MarshallSize() 413 +nummodels*sizeof(bool) 415 414 +sizeof(int); //sizeof(int) for enum type 416 415 } … … 423 422 int indices[3]; 424 423 int zero=0; 425 Hook* tria_hnodes=NULL;426 Hook* tria_hmatice=NULL;427 Hook* tria_hmatpar=NULL;428 424 Parameters* tria_parameters=NULL; 429 425 Inputs* tria_inputs=NULL; … … 433 429 indices[2]=g2; 434 430 435 tria_hnodes =this->hnodes.Spawn(indices,3);436 tria_hmatice=this->hmatice.Spawn(&zero,1);437 tria_hmatpar=this->hmatpar.Spawn(&zero,1);438 431 tria_parameters=this->parameters; 439 432 tria_inputs=(Inputs*)this->inputs->SpawnTriaInputs(indices); … … 444 437 tria->parameters=tria_parameters; 445 438 446 /*now deal with hooks and objects: */ 447 tria->hnodes.copy(tria_hnodes); 448 tria->hmatice.copy(tria_hmatice); 449 tria->hmatpar.copy(tria_hmatpar); 450 451 /*recover objects: */ 452 tria->nodes=(Node**)tria->hnodes.deliverp(); 453 tria->matice=(Matice*)tria->hmatice.delivers(); 454 tria->matpar=(Matpar*)tria->hmatpar.delivers(); 455 456 delete tria_hnodes; 457 delete tria_hmatice; 458 delete tria_hmatpar; 439 /*now deal with nodes, matice and matpar: */ 440 tria->nodes=(Node**)xmalloc(3*sizeof(Node*)); 441 for(i=0;i<3;i++)tria->nodes[i]=this->nodes[indices[i]]; 442 tria->matice=this->matice; 443 tria->matpar=this->matpar; 459 444 460 445 return tria; … … 468 453 int indices[2]; 469 454 int zero=0; 470 Hook *beam_hnodes = NULL;471 Hook *beam_hmatice = NULL;472 Hook *beam_hmatpar = NULL;473 455 Parameters *beam_parameters = NULL; 474 456 Inputs *beam_inputs = NULL; … … 477 459 indices[1]=g1; 478 460 479 beam_hnodes =this->hnodes.Spawn(indices,2);480 beam_hmatice=this->hmatice.Spawn(&zero,1);481 beam_hmatpar=this->hmatpar.Spawn(&zero,1);482 461 beam_parameters=this->parameters; 483 462 beam_inputs=(Inputs*)this->inputs->SpawnBeamInputs(indices); … … 488 467 beam->parameters=beam_parameters; 489 468 490 /*now deal with hooks and objects: */ 491 beam->hnodes.copy(beam_hnodes); 492 beam->hmatice.copy(beam_hmatice); 493 beam->hmatpar.copy(beam_hmatpar); 494 495 /*recover objects: */ 496 //beam->nodes=(Node**)beam->hnodes.deliverp(); 497 //beam->matice=(Matice*)beam->hmatice.delivers(); 498 //beam->matpar=(Matpar*)beam->hmatpar.delivers(); 499 500 delete beam_hnodes; 501 delete beam_hmatice; 502 delete beam_hmatpar; 469 /*now deal with ndoes,matice and matpar: */ 470 beam->nodes=(Node**)xmalloc(2*sizeof(Node*)); 471 for(i=0;i<2;i++)beam->nodes[i]=this->nodes[indices[i]]; 472 beam->matice=this->matice; 473 beam->matpar=this->matpar; 503 474 504 475 return beam; … … 510 481 Sing* sing=NULL; 511 482 int zero=0; 512 Hook *sing_hnodes = NULL;513 Hook *sing_hmatice = NULL;514 Hook *sing_hmatpar = NULL;515 483 Parameters *sing_parameters = NULL; 516 484 Inputs *sing_inputs = NULL; 517 485 518 sing_hnodes =this->hnodes.Spawn(&index,1);519 sing_hmatice=this->hmatice.Spawn(&zero,1);520 sing_hmatpar=this->hmatpar.Spawn(&zero,1);521 486 sing_parameters=this->parameters; 522 487 sing_inputs=(Inputs*)this->inputs->SpawnSingInputs(index); … … 527 492 sing->parameters=sing_parameters; 528 493 529 /*now deal with hooks and objects: */ 530 sing->hnodes.copy(sing_hnodes); 531 sing->hmatice.copy(sing_hmatice); 532 sing->hmatpar.copy(sing_hmatpar); 533 534 /*recover objects: */ 535 //sing->nodes=(Node**)sing->hnodes.deliverp(); 536 //sing->matice=(Matice*)sing->hmatice.delivers(); 537 //sing->matpar=(Matpar*)sing->hmatpar.delivers(); 538 539 delete sing_hnodes; 540 delete sing_hmatice; 541 delete sing_hmatpar; 542 494 /*now deal with nodes,matice and matpar: */ 495 sing->node=this->nodes[index]; 496 sing->matice=this->matice; 497 sing->matpar=this->matpar; 498 543 499 return sing; 544 500 } … … 840 796 841 797 /*Object functions*/ 798 /*FUNCTION Penta::IsInput{{{1*/ 799 bool Penta::IsInput(int name){ 800 if (name==ThicknessEnum || 801 name==SurfaceEnum || 802 name==BedEnum || 803 name==SurfaceSlopexEnum || 804 name==SurfaceSlopeyEnum || 805 name==MeltingRateEnum || 806 name==AccumulationRateEnum || 807 name==GeothermalFluxEnum || 808 name==PressureEnum || 809 name==VxEnum || 810 name==VyEnum || 811 name==VzEnum || 812 name==TemperatureEnum || 813 name==TemperatureAverageEnum || 814 name==RheologyBEnum || 815 name==RheologyNEnum) { 816 return true; 817 } 818 else return false; 819 } 820 /*}}}*/ 821 /*FUNCTION Penta::IsOnSurface{{{1*/ 822 bool Penta::IsOnSurface(void){ 823 824 bool onsurface; 825 inputs->GetParameterValue(&onsurface,ElementOnSurfaceEnum); 826 return onsurface; 827 828 } 829 /*}}}*/ 830 /*FUNCTION Penta::GetUpperElement{{{1*/ 831 Penta* Penta::GetUpperElement(void){ 832 833 Penta* upper_penta=NULL; 834 upper_penta=(Penta*)neighbors[1]; //first one under, second one above 835 return upper_penta; 836 837 } 838 /*}}}*/ 842 839 /*FUNCTION Penta::ComputeBasalStress {{{1*/ 843 840 void Penta::ComputeBasalStress(Vec sigma_b,int analysis_type,int sub_analysis_type){ -
issm/trunk/src/c/objects/Elements/Penta.h
r3956 r3984 37 37 Inputs *inputs; 38 38 39 /*internal parameters: */ 40 bool *collapse; //collapse elements, depending on analysis_type 41 39 42 /*FUNCTION constructors, destructors {{{1*/ 40 43 Penta(); 41 Penta(int penta_id,int i, IoModel* iomodel); 44 Penta(int penta_id,int i, IoModel* iomodel,int nummodels); 45 Update(IoModel* iomodel,int analysis_counter,int analysis_type); 42 46 ~Penta(); 43 47 /*}}}*/ 44 48 /*FUNCTION object management {{{1*/ 45 void Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* materials,Parameters* parameters );49 void Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* materials,Parameters* parameters,int analysis_counter); 46 50 Object* copy(); 47 51 void DeepEcho(); -
issm/trunk/src/c/objects/Elements/PentaHook.cpp
r3822 r3984 23 23 /*FUNCTION PentaHook::PentaHook(){{{1*/ 24 24 PentaHook::PentaHook(){ 25 numanalyses=UNDEF; 26 this->hooks=NULL; 25 27 } 26 28 /*}}}*/ 27 29 /*FUNCTION PentaHook::~PentaHook(){{{1*/ 28 30 PentaHook::~PentaHook(){ 31 xfree((void**)&hnodes); 29 32 } 30 33 /*}}}*/ 31 /*FUNCTION PentaHook::InitHookNodes(int* node_ids){{{1*/ 32 void PentaHook::InitHookNodes(int* node_ids){ 33 this->hnodes.Init(node_ids,6); 34 /*FUNCTION PentaHook::InitHookNodes(int numanalyses){{{1*/ 35 void PentaHook::InitHookNodes(int numanalyses){ 36 this->hnodes=(Hook*)xmalloc(numanalyses*sizeof(Hook)); 37 } 38 /*}}}*/ 39 /*FUNCTION PentaHook::SetHookNodes(int* node_ids,int analysis_counter){{{1*/ 40 void PentaHook::SetHookNodes(int* node_ids,int analysis_counter){ 41 this->hnodes[analysis_counter].Init(node_ids,6); 34 42 35 43 } -
issm/trunk/src/c/objects/Elements/PentaHook.h
r3822 r3984 11 11 12 12 public: 13 Hook hnodes; // 6 nodes 13 int numanalyses; //number of analysis types 14 Hook* hnodes; // 6 nodes for each analysis type 14 15 Hook hmatice; // 1 ice material 15 16 Hook hmatpar; // 1 material parameter … … 20 21 PentaHook(); 21 22 ~PentaHook(); 22 void InitHookNodes(int* node_ids); 23 void InitHookNodes(int numanalyses); 24 void SetHookNodes(int* node_ids,int analysis_counter); 23 25 void InitHookMatice(int matice_id); 24 26 void InitHookMatpar(int matpar_id); -
issm/trunk/src/c/objects/Elements/Tria.cpp
r3977 r3984 28 28 this->inputs=NULL; 29 29 this->parameters=NULL; 30 this->collapse=NULL; 30 31 } 31 32 /*}}}*/ … … 34 35 delete inputs; 35 36 this->parameters=NULL; 36 } 37 /*}}}*/ 38 /*FUNCTION Tria::Tria(int id, int index, IoModel* iomodel){{{1*/ 39 Tria::Tria(int tria_id, int index, IoModel* iomodel){ //i is the element index 37 xfree((void**)&collapse); 38 } 39 /*}}}*/ 40 /*FUNCTION Tria::Tria(int id, int index, IoModel* iomodel,int nummodels){{{1*/ 41 Tria::Tria(int tria_id, int index, IoModel* iomodel,int nummodels){ //i is the element index 40 42 41 43 int i; 42 int j;43 int tria_node_ids[3];44 44 int tria_matice_id; 45 45 int tria_matpar_id; 46 double nodeinputs[3];47 46 48 47 /*id: */ … … 52 51 this->InitInterpolationType(P1Enum); 53 52 53 /*hooks: */ 54 tria_matice_id=index+1; //refers to the corresponding ice material object 55 tria_matpar_id=iomodel->numberofelements+1; //refers to the constant material parameters object 56 57 this->InitHookNodes(nummodels);this->nodes=NULL; 58 this->InitHookNodes(tria_node_ids); this->nodes=NULL; 59 this->InitHookMatice(tria_matice_id);this->matice=NULL; 60 this->InitHookMatpar(tria_matpar_id);this->matpar=NULL; 61 62 //this->parameters: we still can't point to it, it may not even exist. Configure will handle this. 63 this->parameters=NULL; 64 65 } 66 /*}}}*/ 67 /*FUNCTION Tria::Update(IoModel* iomodel,int analysis_counter,int analysis_type){{{1*/ 68 Tria::Update(IoModel* iomodel,int analysis_counter,int analysis_type){ //i is the element index 69 70 int i; 71 int tria_node_ids[3]; 72 double nodeinputs[3]; 73 54 74 /*hooks: */ 55 75 //go recover node ids, needed to initialize the node hook. … … 67 87 } 68 88 } 69 tria_matice_id=index+1; //refers to the corresponding ice material object 70 tria_matpar_id=iomodel->numberofelements+1; //refers to the constant material parameters object 71 72 this->InitHookNodes(tria_node_ids); this->nodes=NULL; 73 this->InitHookMatice(tria_matice_id);this->matice=NULL; 74 this->InitHookMatpar(tria_matpar_id);this->matpar=NULL; 89 90 this->SetHookNodes(tria_node_ids,analysis_counter); this->nodes=NULL; //set hook to nodes, for this analysis type 75 91 76 92 //intialize inputs, and add as many inputs per element as requested: … … 204 220 205 221 /*now deal with hooks and objects: */ 222 tria->InitHookNodes(this->nummodels); 223 for(i=0;i<this->nummodels;i++)tria->hnodes[i].copy(&this->hnodes[i]); 206 224 tria->hnodes.copy(&this->hnodes); 207 225 tria->hmatice.copy(&this->hmatice); … … 209 227 210 228 /*recover objects: */ 229 tria->nodes=(Node**)xmalloc(3*sizeof(Node*)); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes. 230 for(i=0;i<3;i++)tria->nodes[i]=this->nodes[i]; 211 231 tria->nodes=(Node**)tria->hnodes.deliverp(); 212 232 tria->matice=(Matice*)tria->hmatice.delivers(); … … 219 239 /*Object management: */ 220 240 /*FUNCTION Tria::Configure {{{1*/ 221 void Tria::Configure(DataSet* elementsin, DataSet* loadsin, DataSet* nodesin, DataSet* materialsin, Parameters* parametersin ){241 void Tria::Configure(DataSet* elementsin, DataSet* loadsin, DataSet* nodesin, DataSet* materialsin, Parameters* parametersin,int analysis_counter){ 222 242 223 243 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 224 244 * datasets, using internal ids and offsets hidden in hooks: */ 225 this->hnodes .configure(nodesin);245 this->hnodes[analysis_counter].configure(nodesin); 226 246 this->hmatice.configure(materialsin); 227 247 this->hmatpar.configure(materialsin); 228 248 229 249 /*Now, go pick up the objects inside the hooks: */ 230 this->nodes=(Node**)this->hnodes .deliverp();250 this->nodes=(Node**)this->hnodes[analysis_counter].deliverp(); 231 251 this->matice=(Matice*)this->hmatice.delivers(); 232 252 this->matpar=(Matpar*)this->hmatpar.delivers(); … … 241 261 242 262 char* marshalled_dataset=NULL; 263 int i; 243 264 244 265 /*recover marshalled_dataset: */ … … 249 270 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 250 271 memcpy(&interpolation_type,marshalled_dataset,sizeof(interpolation_type));marshalled_dataset+=sizeof(interpolation_type); 272 memcpy(&nummodels,marshalled_dataset,sizeof(nummodels));marshalled_dataset+=sizeof(nummodels); 273 274 /*allocate dynamic memory: */ 275 InitHookNodes(nummodels); 251 276 252 277 /*demarshall hooks: */ 253 hnodes.Demarshall(&marshalled_dataset);278 for(i=0;i<nummodels;i++)hnodes[i].Demarshall(&marshalled_dataset); 254 279 hmatice.Demarshall(&marshalled_dataset); 255 280 hmatpar.Demarshall(&marshalled_dataset); … … 307 332 } 308 333 /*}}}*/ 309 /*FUNCTION Tria::IsInput{{{1*/310 bool Tria::IsInput(int name){311 if (name==SurfaceSlopexEnum ||312 name==SurfaceSlopeyEnum){313 return true;314 }315 else return false;316 }317 /*}}}*/318 334 /*FUNCTION Tria::Marshall {{{1*/ 319 335 void Tria::Marshall(char** pmarshalled_dataset){ 320 336 337 int i; 321 338 char* marshalled_dataset=NULL; 322 339 int enum_type=0; … … 336 353 memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id); 337 354 memcpy(marshalled_dataset,&interpolation_type,sizeof(interpolation_type));marshalled_dataset+=sizeof(interpolation_type); 355 memcpy(marshalled_dataset,&nummodels,sizeof(nummodels));marshalled_dataset+=sizeof(nummodels); 338 356 339 357 /*Marshall hooks: */ 340 hnodes.Marshall(&marshalled_dataset);358 for(i=0;i<nummodels;i++)hnodes[i].Marshall(&marshalled_dataset); 341 359 hmatice.Marshall(&marshalled_dataset); 342 360 hmatpar.Marshall(&marshalled_dataset); … … 358 376 /*FUNCTION Tria::MarshallSize {{{1*/ 359 377 int Tria::MarshallSize(){ 378 379 int i; 380 int hnodes_size=0;; 381 382 for(i=0;i<nummodels;i++)hnodes_size+=hnodes[i].MarshallSize; 383 360 384 361 385 return sizeof(id) 386 +hnodes_size 362 387 +sizeof(interpolation_type) 363 +hnodes.MarshallSize()364 388 +hmatice.MarshallSize() 365 389 +hmatpar.MarshallSize() … … 375 399 int indices[2]; 376 400 int zero=0; 377 Hook *beam_hnodes = NULL;378 Hook *beam_hmatice = NULL;379 Hook *beam_hmatpar = NULL;380 401 Parameters *beam_parameters = NULL; 381 402 Inputs *beam_inputs = NULL; … … 384 405 indices[1]=g1; 385 406 386 beam_hnodes =this->hnodes.Spawn(indices,2);387 beam_hmatice=this->hmatice.Spawn(&zero,1);388 beam_hmatpar=this->hmatpar.Spawn(&zero,1);389 407 beam_parameters=this->parameters; 390 408 beam_inputs=(Inputs*)this->inputs->SpawnBeamInputs(indices); … … 395 413 beam->parameters=beam_parameters; 396 414 397 /*now deal with hooks and objects: */ 398 beam->hnodes.copy(beam_hnodes); 399 beam->hmatice.copy(beam_hmatice); 400 beam->hmatpar.copy(beam_hmatpar); 401 402 /*recover objects: */ 403 //beam->nodes=(Node**)beam->hnodes.deliverp(); 404 //beam->matice=(Matice*)beam->hmatice.delivers(); 405 //beam->matpar=(Matpar*)beam->hmatpar.delivers(); 406 407 delete beam_hnodes; 408 delete beam_hmatice; 409 delete beam_hmatpar; 415 /*now deal with nodes, matice and matpar: */ 416 beam->nodes=(Node**)xmalloc(2*sizeof(Node*)); 417 for(i=0;i<2;i++)beam->nodes[i]=this->nodes[indices[i]]; 418 beam->matice=this->matice; 419 beam->matpar=this->matpar; 420 410 421 411 422 return beam; … … 417 428 Sing* sing=NULL; 418 429 int zero=0; 419 Hook *sing_hnodes = NULL;420 Hook *sing_hmatice = NULL;421 Hook *sing_hmatpar = NULL;422 430 Parameters *sing_parameters = NULL; 423 431 Inputs *sing_inputs = NULL; 424 432 425 sing_hnodes =this->hnodes.Spawn(&index,1);426 sing_hmatice=this->hmatice.Spawn(&zero,1);427 sing_hmatpar=this->hmatpar.Spawn(&zero,1);428 433 sing_parameters=this->parameters; 429 434 sing_inputs=(Inputs*)this->inputs->SpawnSingInputs(index); … … 434 439 sing->parameters=sing_parameters; 435 440 436 /*now deal with hooks and objects: */ 437 sing->hnodes.copy(sing_hnodes); 438 sing->hmatice.copy(sing_hmatice); 439 sing->hmatpar.copy(sing_hmatpar); 440 441 /*recover objects: */ 442 //sing->nodes=(Node**)sing->hnodes.deliverp(); 443 //sing->matice=(Matice*)sing->hmatice.delivers(); 444 //sing->matpar=(Matpar*)sing->hmatpar.delivers(); 445 446 delete sing_hnodes; 447 delete sing_hmatice; 448 delete sing_hmatpar; 449 441 /*now deal with node,matice and matpar: */ 442 sing->node=this->nodes[index]; 443 sing->matice=this->matice; 444 sing->matpar=this->matpar; 445 450 446 return sing; 451 447 } … … 686 682 687 683 /*Object functions*/ 684 /*FUNCTION Tria::IsInput{{{1*/ 685 bool Tria::IsInput(int name){ 686 if (name==SurfaceSlopexEnum || 687 name==SurfaceSlopeyEnum){ 688 return true; 689 } 690 else return false; 691 } 692 /*}}}*/ 688 693 /*FUNCTION Tria::ComputeBasalStress {{{1*/ 689 694 void Tria::ComputeBasalStress(Vec eps,int analysis_type,int sub_analysis_type){ -
issm/trunk/src/c/objects/Elements/Tria.h
r3965 r3984 38 38 Tria(); 39 39 Tria(int tria_id,int i, IoModel* iomodel); 40 Update(IoModel* iomodel,int analysis_counter,int analysis_type); 40 41 ~Tria(); 41 42 /*}}}*/ -
issm/trunk/src/c/objects/Elements/TriaHook.cpp
r3791 r3984 23 23 /*FUNCTION TriaHook::TriaHook(){{{1*/ 24 24 TriaHook::TriaHook(){ 25 numanalyses=UNDEF; 26 this->hooks=NULL; 25 27 } 26 28 /*}}}*/ 27 29 /*FUNCTION TriaHook::~TriaHook(){{{1*/ 28 30 TriaHook::~TriaHook(){ 31 xfree((void**)&hnodes); 29 32 } 30 33 /*}}}*/ 31 /*FUNCTION TriaHook::InitHookNodes(int* node_ids){{{1*/ 32 void TriaHook::InitHookNodes(int* node_ids){ 33 this->hnodes.Init(node_ids,3); 34 /*FU/*FUNCTION TriaHook::InitHookNodes(int numanalyses){{{1*/ 35 void TriaHook::InitHookNodes(int numanalyses){ 36 this->hnodes=(Hook*)xmalloc(numanalyses*sizeof(Hook)); 37 } 38 /*}}}*/ 39 /*FUNCTION TriaHook::SetHookNodes(int* node_ids,int analysis_counter){{{1*/ 40 void TriaHook::SetHookNodes(int* node_ids,int analysis_counter){ 41 this->hnodes[analysis_counter].Init(node_ids,3); 34 42 35 43 } -
issm/trunk/src/c/objects/Elements/TriaHook.h
r3805 r3984 11 11 12 12 public: 13 Hook hnodes; // 3 nodes 13 int numanalyses; //number of analysis types 14 Hook* hnodes; // 3 nodes for each analysis type 14 15 Hook hmatice; // 1 ice material 15 16 Hook hmatpar; // 1 material parameter … … 19 20 TriaHook(); 20 21 ~TriaHook(); 21 void InitHookNodes(int* node_ids); 22 void InitHookNodes(int numanalyses); 23 void SetHookNodes(int* node_ids,int analysis_counter); 22 24 void InitHookMatice(int matice_id); 23 25 void InitHookMatpar(int matpar_id); 26 void InitHookNeighbors(int* element_ids); 27 24 28 /*}}}*/ 25 29 -
issm/trunk/src/c/objects/FemModel.cpp
r3982 r3984 24 24 25 25 nummodels=in_nummodels; 26 current_analysis_type=-1;26 analysis_counter=-1; 27 27 28 28 /*Dynamically allocate whatever is a list of length nummodels: */ … … 97 97 for(i=0;i<nummodels;i++)printf(" %i: %s\n",i,EnumAsString(analysis_type_list[i])); 98 98 printf(" current analysis_type: \n"); 99 printf(" %i: %s\n",i,EnumAsString(analysis_type_list[ current_analysis_type]));99 printf(" %i: %s\n",i,EnumAsString(analysis_type_list[analysis_counter])); 100 100 101 101 … … 107 107 void FemModel::AddAnalysis(ConstDataHandle IOMODEL, int analysis_type){ 108 108 109 110 int i; //practical counter111 112 109 /*Set counter: */ 113 if (current_analysis_type==-1)current_analysis_type=0; 114 else current_analysis_type++; 115 116 i=current_analysis_type; 110 if (analysis_counter==-1)analysis_counter=0; 111 else analysis_counter++; 117 112 118 113 /*intermediary: */ … … 123 118 124 119 _printf_(" create datasets:\n"); 125 CreateDataSets(&elements,&nodes,&vertices,&materials,&constraints,&loads,¶meters,iomodel,IOMODEL,analysis_type );120 CreateDataSets(&elements,&nodes,&vertices,&materials,&constraints,&loads,¶meters,iomodel,IOMODEL,analysis_type,nummodels,analysis_counter); 126 121 127 122 _printf_(" create degrees of freedom: \n"); … … 129 124 130 125 _printf_(" create single point constraints: \n"); 131 SpcNodesx( &yg[ i], nodes,constraints);126 SpcNodesx( &yg[analysis_counter], nodes,constraints); 132 127 133 128 _printf_(" create rigid body constraints:\n"); 134 MpcNodesx( &Rmg[ i], nodes,constraints);129 MpcNodesx( &Rmg[analysis_counter], nodes,constraints); 135 130 136 131 _printf_(" create node sets:\n"); 137 BuildNodeSetsx(&nodesets[ i], nodes);132 BuildNodeSetsx(&nodesets[analysis_counter], nodes); 138 133 139 134 _printf_(" reducing single point constraints vector:\n"); 140 Reducevectorgtosx(&ys[ i], yg[i]->vector,nodesets[i]);135 Reducevectorgtosx(&ys[analysis_counter], yg[analysis_counter]->vector,nodesets[analysis_counter]); 141 136 142 137 _printf_(" normalizing rigid body constraints matrix:\n"); 143 NormalizeConstraintsx(&Gmn[ i], Rmg[i],nodesets[i]);138 NormalizeConstraintsx(&Gmn[analysis_counter], Rmg[analysis_counter],nodesets[analysis_counter]); 144 139 145 140 _printf_(" configuring element and loads:\n"); … … 155 150 /*FUNCTION FemModel::GetCurrentAnalysis {{{1*/ 156 151 FemFemModel* FemModel::GetCurrentAnalysis(){ 157 return analysis_type_list[ current_analysis_type];152 return analysis_type_list[analysis_counter]; 158 153 } 159 154 /*}}}1*/ … … 167 162 } 168 163 } 169 if(found) current_analysis_type=i;164 if(found)analysis_counter=i; 170 165 else ISSMERRR("%s%s%s"," could not find analysis_type ",EnumAsString(analysis_type) " in list of FemModel analyses"); 171 166 } -
issm/trunk/src/c/objects/FemModel.h
r3982 r3984 24 24 25 25 int nummodels; 26 int* analysis_type_list; //list of analyses this femmodel is capable of.27 int current_analysis_type; //counter to the current analysis being carried out26 int* analysis_type_list; //list of analyses this femmodel is going to carry out 27 int analysis_counter; //counter into analysis_type_list 28 28 29 29 DataSet* elements; //elements (one set for all analyses) … … 38 38 DofVec* tpartition; 39 39 40 //multiple sets of vectors for each analysis_type40 //multiple sets of matrices/vectors for each analysis_type 41 41 Mat* Rmg; //rigid body motions matrices 42 42 Mat* Gmn; -
issm/trunk/src/c/objects/IoModel.cpp
r3982 r3984 41 41 xfree((void**)&this->gridonhutter); 42 42 xfree((void**)&this->gridonmacayeal); 43 if ( strcmp(this->meshtype,"3d")==0){43 if (this->dim==3){ 44 44 xfree((void**)&this->elements2d); 45 45 xfree((void**)&this->deadgrids); … … 96 96 xfree((void**)&this->outputfilename); 97 97 xfree((void**)&this->repository); 98 xfree((void**)&this->meshtype);99 98 xfree((void**)&this->name); 100 99 … … 132 131 IoModelFetchData(&this->qmu_analysis,iomodel_handle,"qmu_analysis"); 133 132 IoModelFetchData(&this->control_analysis,iomodel_handle,"control_analysis"); 134 IoModelFetchData(&this-> meshtype,iomodel_handle,"type");133 IoModelFetchData(&this->dim,iomodel_handle,"dim"); 135 134 /*!Get numberofelements and numberofvertices: */ 136 135 IoModelFetchData(&this->numberofvertices,iomodel_handle,"numberofgrids"); 137 136 IoModelFetchData(&this->numberofelements,iomodel_handle,"numberofelements"); 138 137 /*!In case we are running 3d, we are going to need the collapsed and non-collapsed 2d meshes, from which the 3d mesh was extruded: */ 139 if ( strcmp(this->meshtype,"3d")==0){138 if (this->dim==3){ 140 139 141 140 /*!Deal with 2d mesh: */ … … 229 228 this->outputfilename=NULL; 230 229 this->repository=NULL; 231 this->meshtype=NULL;232 230 this->qmu_analysis=0; 233 231 this->control_analysis=0; … … 392 390 int i,j; 393 391 394 if(which_part==1 && my_rank==rank && (strcmp(this->meshtype,"3d")==0)){392 if(which_part==1 && my_rank==rank && this->dim==3){ 395 393 printf("IoModel penalties: \n"); 396 394 printf(" number of penalties: %i\n",this->numpenalties); -
issm/trunk/src/c/objects/IoModel.h
r3982 r3984 19 19 char* outputfilename; 20 20 char* repository; 21 char* meshtype;21 int dim; 22 22 int qmu_analysis; 23 23 int control_analysis; -
issm/trunk/src/c/objects/Materials/Matice.cpp
r3863 r3984 35 35 /*}}}*/ 36 36 /*FUNCTION Matice::Matice(int id, int i, IoModel* iomodel, int num_vertices){{{1*/ 37 Matice::Matice(int matice_mid,int i, IoModel* iomodel , int num_vertices){37 Matice::Matice(int matice_mid,int i, IoModel* iomodel){ 38 38 39 39 int j; … … 45 45 /*intermediary: */ 46 46 double B_avg; 47 47 48 /*2d or 3d? */ 49 if(strcmp(iomodel->meshtype,"2d")==0){ 50 num_vertices=3; //tria elements 51 } 52 else if(strcmp(iomodel->meshtype,"3d")==0){ 53 num_vertices=6; //penta elements 54 } 55 else ISSMERROR(" Mesh type not supported yet!"); 56 48 57 /*Compute B on the element if provided*/ 49 if (num_vertices==3 || num_vertices==6){ 50 if (iomodel->rheology_B){ 51 B_avg=0; 52 for(j=0;j<num_vertices;j++){ 53 B_avg+=*(iomodel->rheology_B+((int)*(iomodel->elements+num_vertices*i+j)-1)); 54 } 55 B_avg=B_avg/num_vertices; 56 } 57 } 58 else if (num_vertices==1 || num_vertices==2){ 59 if (iomodel->rheology_B){ 60 B_avg=*(iomodel->rheology_B+i); 61 } 62 } 63 else ISSMERROR("num_vertices = %i not supported yet",num_vertices); 64 65 if (iomodel->rheology_B) matice_B=B_avg; 66 else matice_B=UNDEF; 67 if (iomodel->rheology_n){ 68 if (num_vertices==3 || num_vertices==6){ 69 matice_n=(double)*(iomodel->rheology_n+i); 70 } 71 else if (num_vertices==1 || num_vertices==2){ 72 /*n is on the elements for now, so just take the first one*/ 73 matice_n=(double)*(iomodel->rheology_n); 74 } 75 else ISSMERROR("num_vertices = %i not supported yet",num_vertices); 76 } 77 else matice_n=UNDEF; 58 if (iomodel->rheology_B){ 59 B_avg=0; 60 for(j=0;j<num_vertices;j++){ 61 B_avg+=*(iomodel->rheology_B+((int)*(iomodel->elements+num_vertices*i+j)-1)); 62 } 63 B_avg=B_avg/num_vertices; 64 matice_B=B_avg; 65 } 66 else matice_B=UNDEF; 67 68 if (iomodel->rheology_n) matice_n=(double)*(iomodel->rheology_n+i); 69 else matice_n=UNDEF; 78 70 79 71 this->Init(matice_mid,matice_B,matice_n); -
issm/trunk/src/c/objects/Materials/Matice.h
r3863 r3984 23 23 Matice(); 24 24 Matice(int mid,double B,double n); 25 Matice(int mid,int i, IoModel* iomodel , int num_vertices);25 Matice(int mid,int i, IoModel* iomodel); 26 26 void Init(int mid,double B,double n); 27 27 ~Matice(); -
issm/trunk/src/c/objects/Node.cpp
r3956 r3984 36 36 } 37 37 /*}}}*/ 38 /*FUNCTION Node::Node(int id, DofIndexing* indexing, Hook* vertex, Hook* uppernode,Inputs* inputs ){{{2*/39 Node::Node(int node_id,DofIndexing* node_indexing, Hook* node_vertex, Hook* node_upper_node,Inputs* node_inputs ):38 /*FUNCTION Node::Node(int id, DofIndexing* indexing, Hook* vertex, Hook* uppernode,Inputs* inputs,int analysis_type){{{2*/ 39 Node::Node(int node_id,DofIndexing* node_indexing, Hook* node_vertex, Hook* node_upper_node,Inputs* node_inputs,int analysis_type): 40 40 indexing(node_indexing), 41 41 hvertex(node_vertex), … … 44 44 /*all the initialization has been done by the initializer, just fill in the id: */ 45 45 this->id=node_id; 46 this->analysis_type=analysis_type; 46 47 47 48 if(node_inputs){ … … 53 54 } 54 55 /*}}}*/ 55 /*FUNCTION Node::Node(int id, int i, IoModel* iomodel ) -> Continuous Galerkin{{{2*/56 Node::Node(int node_id, int i, IoModel* iomodel ){ //i is the node index56 /*FUNCTION Node::Node(int id, int i, IoModel* iomodel,int analysis_type) -> Continuous Galerkin{{{2*/ 57 Node::Node(int node_id, int i, IoModel* iomodel,int analysis_type){ //i is the node index 57 58 58 59 int k; … … 63 64 /*id: */ 64 65 this->id=node_id; //matlab indexing 66 this->analysis_type=analysis_type; 65 67 66 68 /*indexing:*/ … … 167 169 } 168 170 /*}}}*/ 169 /*FUNCTION Node::Node(int id, int i, int j, IoModel* iomodel ) -> Discontinuous Galerkin{{{2*/170 Node::Node(int node_id,int i,int j,IoModel* iomodel ){171 /*FUNCTION Node::Node(int id, int i, int j, IoModel* iomodel,int analysis_type) -> Discontinuous Galerkin{{{2*/ 172 Node::Node(int node_id,int i,int j,IoModel* iomodel,int analysis_type){ 171 173 /* i -> index of the vertex in C indexing 172 174 * j -> index of the node in C indexing*/ … … 178 180 /*id: */ 179 181 this->id=node_id; //matlab indexing 182 this->analysis_type=analysis_type; 180 183 181 184 /*indexing:*/ … … 236 239 Object* Node::copy() { 237 240 238 return new Node(this->id,&this->indexing, &this->hvertex,&this->hupper_node,this->inputs );241 return new Node(this->id,&this->indexing, &this->hvertex,&this->hupper_node,this->inputs,this->analysis_type); 239 242 240 243 } … … 246 249 printf("Node:\n"); 247 250 printf(" id: %i\n",id); 251 printf(" analysis_type: %s\n",EnumAsString(analysis_type)); 248 252 indexing.DeepEcho(); 249 253 printf("Vertex:\n"); … … 269 273 270 274 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 275 memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type); 271 276 272 277 /*demarshall objects: */ … … 288 293 printf("Node:\n"); 289 294 printf(" id: %i\n",id); 295 printf(" analysis_type: %s\n",EnumAsString(analysis_type)); 290 296 indexing.Echo(); 291 297 hvertex.Echo(); … … 372 378 /*marshall Node data: */ 373 379 memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id); 380 memcpy(marshalled_dataset,&analysis_type,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type); 374 381 375 382 /*marshall objects: */ … … 399 406 hupper_node.MarshallSize()+ 400 407 inputs->MarshallSize()+ 408 sizeof(analysis_type)+ 401 409 sizeof(int); //sizeof(int) for enum type 402 410 } -
issm/trunk/src/c/objects/Node.h
r3969 r3984 27 27 Hook hvertex; 28 28 Hook hupper_node; 29 Inputs* inputs; //properties of this node 29 Inputs* inputs; //properties of this node 30 int analysis_type; 30 31 31 32 public: … … 34 35 Node(); 35 36 Node(int id,int vertex_id, int upper_node_id, int numberofdofs); 36 Node(int id,DofIndexing* indexing, Hook* vertex, Hook* upper_node, Inputs* inputs );37 Node(int id, int i, IoModel* iomodel );38 Node(int id, int i,int j,IoModel* iomodel );37 Node(int id,DofIndexing* indexing, Hook* vertex, Hook* upper_node, Inputs* inputs,int analysis_type); 38 Node(int id, int i, IoModel* iomodel,int analysis_type); 39 Node(int id, int i,int j,IoModel* iomodel,int analysis_type); 39 40 ~Node(); 40 41 /*}}}*/
Note:
See TracChangeset
for help on using the changeset viewer.