Commit dde1f9ea authored by Christophe Geuzaine's avatar Christophe Geuzaine

Merge branch 'mma' into 'master'

framework for ccsa optimizers See merge request !31
parents 06dc9f2d eec47e95
Pipeline #1049 passed with stage
in 9 minutes 34 seconds
......@@ -41,6 +41,7 @@ opt(GSL "Enable GSL functions (for some built-in functions)" ${DEFAULT})
opt(HPDDM "Enable HPDDM support" ${DEFAULT})
opt(INTERNAL_DEVELOPER_API "Enable internal developer API (will be off be default)" OFF)
opt(KERNEL "Enable kernel (required for actual computations)" ON)
opt(MMA "Enable MMA optimizer" ${DEFAULT})
opt(MPI "Enable MPI parallelization (with PETSc/SLEPc)" OFF)
opt(MULTIHARMONIC "Enable multi-harmonic support" OFF)
opt(NR "Enable NR functions (if GSL is unavailable)" ${DEFAULT})
......@@ -586,6 +587,14 @@ if(ENABLE_NX)
endif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/contrib/NX/Unv_Format.cpp)
endif(ENABLE_NX)
if(ENABLE_MMA)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/contrib/mma/cpp/src/mma.cpp)
add_subdirectory(contrib/mma)
include_directories(contrib/mma/cpp/src)
set_config_option(HAVE_MMA "MMA")
endif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/contrib/mma/cpp/src/mma.cpp)
endif(ENABLE_MMA)
if(ENABLE_GSL)
find_library(GSL_LIB gsl PATH_SUFFIXES lib)
find_library(GSLCBLAS_LIB gslcblas PATH_SUFFIXES lib)
......
......@@ -13,6 +13,7 @@
#cmakedefine HAVE_HPDDM
#cmakedefine HAVE_LAPACK
#cmakedefine HAVE_KERNEL
#cmakedefine HAVE_MMA
#cmakedefine HAVE_MPI
#cmakedefine HAVE_MULTIHARMONIC
#cmakedefine HAVE_NO_FORTRAN
......
......@@ -1154,6 +1154,14 @@ struct Operation {
int useList;
char *from, *to;
} Copy;
struct {
int numConstraints;
List_T *lowerBounds, *upperBounds;
} OptimizerInitialize;
struct {
char *performanceVariable, *sensitivityVariable, *residualVariable;
int sensitivityField;
} OptimizerUpdate;
} Case;
};
......@@ -1304,6 +1312,8 @@ struct IterativeLoopSystem {
#define OPERATION_HPDDMSOLVE 104
#define OPERATION_BROADCASTVARIABLES 105
#define OPERATION_DEBUG 106
#define OPERATION_OPTIMIZER_INITIALIZE 107
#define OPERATION_OPTIMIZER_UPDATE 108
/* ChangeOfState.Type */
#define CHANGEOFSTATE_NOCHANGE 0
......
......@@ -346,6 +346,8 @@ OnRegion return tOnRegion;
OnSection return tOnSection;
Operation return tOperation;
OperationEnd return tOperationEnd;
OptimizerInitialize return tOptimizerInitialize;
OptimizerUpdate return tOptimizerUpdate;
Order return tOrder;
OriginSystem return tOriginSystem;
OverrideTimeStepValue return tOverrideTimeStepValue;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -307,6 +307,7 @@ struct doubleXstring{
%token tFourierTransform tFourierTransformJ
%token tCopySolution tCopyRHS tCopyResidual tCopyIncrement tCopyDofs
%token tGetNormSolution tGetNormResidual tGetNormRHS tGetNormIncrement
%token tOptimizerInitialize tOptimizerUpdate
%token tLanczos tEigenSolve tEigenSolveJac tPerturbation
%token tUpdate tUpdateConstraint tBreak tGetResidual tCreateSolution
%token tEvaluate tSelectCorrection tAddCorrection tMultiplySolution
......@@ -5832,6 +5833,40 @@ OperationTerm :
Operation_P->Case.Copy.from = $3 ;
}
| tOptimizerInitialize '[' FExpr ',' ListOfFExpr ',' ListOfFExpr ']' tEND
{
Operation_P = (struct Operation*)
List_Pointer(Operation_L, List_Nbr(Operation_L)-1) ;
Operation_P->Type = OPERATION_OPTIMIZER_INITIALIZE;
Operation_P->Case.OptimizerInitialize.numConstraints = (int)$3;
Operation_P->Case.OptimizerInitialize.lowerBounds = $5;
Operation_P->Case.OptimizerInitialize.upperBounds = $7;
}
| tOptimizerUpdate '[' '$' String__Index ',' '$' String__Index ','
'$' String__Index ']' tEND
{
Operation_P = (struct Operation*)
List_Pointer(Operation_L, List_Nbr(Operation_L)-1) ;
Operation_P->Type = OPERATION_OPTIMIZER_UPDATE;
Operation_P->Case.OptimizerUpdate.performanceVariable = $4;
Operation_P->Case.OptimizerUpdate.sensitivityVariable = $7;
Operation_P->Case.OptimizerUpdate.residualVariable = $10;
Operation_P->Case.OptimizerUpdate.sensitivityField = -1;
}
| tOptimizerUpdate '[' '$' String__Index ',' FExpr ','
'$' String__Index ']' tEND
{
Operation_P = (struct Operation*)
List_Pointer(Operation_L, List_Nbr(Operation_L)-1) ;
Operation_P->Type = OPERATION_OPTIMIZER_UPDATE;
Operation_P->Case.OptimizerUpdate.performanceVariable = $4;
Operation_P->Case.OptimizerUpdate.sensitivityVariable = 0;
Operation_P->Case.OptimizerUpdate.residualVariable = $9;
Operation_P->Case.OptimizerUpdate.sensitivityField = $6;
}
| Loop
{
Operation_P = (struct Operation*)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -37,6 +37,7 @@ set(SRC
Operation_ChangeOfCoordinates.cpp
Operation_PostOperation.cpp
Operation_HPDDM.cpp Operation_Debug.cpp
Operation_Optimizer.cpp
Treatment_Formulation.cpp
Get_DofOfElement.cpp
Get_ConstraintOfElement.cpp
......
// GetDP - Copyright (C) 1997-2017 P. Dular and C. Geuzaine, University of Liege
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to the public mailing list <getdp@onelab.info>.
//
// Contributed by Erin Kuci
#include <map>
#include <string>
#include <vector>
#include "ProData.h"
#include "DofData.h"
#include "Message.h"
#include "GetDPConfig.h"
#if defined(HAVE_MMA) && defined(HAVE_PETSC)
void Operation_OptimizerInitialize(struct Operation *Operation_P)
{
printf("opti init\n");
}
void Operation_OptimizerUpdate(struct Operation *Operation_P)
{
printf("opti update\n");
}
#else
void Operation_OptimizerInitialize(struct Operation *Operation_P)
{
Message::Error("This version of GetDP is not compiled with MMA support");
}
void Operation_OptimizerUpdate(struct Operation *Operation_P)
{
Message::Error("This version of GetDP is not compiled with MMA support");
}
#endif
......@@ -3286,6 +3286,17 @@ void Treatment_Operation(struct Resolution * Resolution_P,
#endif
break ;
/* --> O p t i m i z e r */
/* ------------------------------------------ */
case OPERATION_OPTIMIZER_INITIALIZE :
Operation_OptimizerInitialize(Operation_P);
break ;
case OPERATION_OPTIMIZER_UPDATE :
Operation_OptimizerUpdate(Operation_P);
break ;
/* --> O t h e r */
/* ------------------------------------------ */
......
......@@ -101,6 +101,10 @@ void Cal_SolutionErrorRatio(gVector *dx,
int NormType,
double *ErrorRatio) ;
void Operation_OptimizerInitialize(struct Operation *Operation_P);
void Operation_OptimizerUpdate(struct Operation *Operation_P);
void Cal_SolutionError(gVector *dx, gVector *x, int diff, double *MeanError);
void Free_UnusedSolutions(struct DofData * DofData_P);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment