From 41688f4fc350e8bfb933d7ad3391e97ee2f2818f Mon Sep 17 00:00:00 2001 From: tmigot Date: Thu, 14 Oct 2021 10:16:31 -0400 Subject: [PATCH 1/2] change signature --- src/apinene.jl | 2 +- src/bearing.jl | 3 ++- src/burger1d.jl | 2 +- src/burger1d_param.jl | 2 +- src/catmix.jl | 2 +- src/cellincrease.jl | 2 +- src/cellincrease_MichaelisMenten.jl | 2 +- src/channel.jl | 2 +- src/controlelasticmembrane1.jl | 2 +- src/controlelasticmembrane2.jl | 2 +- src/controlsir.jl | 2 +- src/dirichlet.jl | 3 ++- src/dynamicsir.jl | 2 +- src/gasoil.jl | 3 ++- src/glider.jl | 3 ++- src/henon.jl | 3 ++- src/ignition.jl | 2 +- src/incompressibleNavierStokes.jl | 2 +- src/inversepoissonproblem2d.jl | 2 +- src/lane_emden.jl | 3 ++- src/membrane.jl | 2 +- src/methanol.jl | 3 ++- src/minsurf.jl | 3 ++- src/morebv.jl | 2 +- src/penalizedpoisson.jl | 2 +- src/poisson3d.jl | 4 ++++ src/poisson_with_Neumann_and_Dirichlet.jl | 2 +- src/poissonboltzman2d.jl | 2 +- src/poissonmixed.jl | 2 +- src/poissonmixed2.jl | 2 +- src/poissonparam.jl | 2 +- src/robot.jl | 2 +- src/rocket.jl | 2 +- src/sis.jl | 2 +- src/smallestlaplacianeigenvalue.jl | 2 +- src/steering.jl | 2 +- src/torebrachistochrone.jl | 2 +- src/torsion.jl | 2 +- test/runtests.jl | 20 +++++++++----------- test/utils.jl | 2 +- 40 files changed, 59 insertions(+), 49 deletions(-) diff --git a/src/apinene.jl b/src/apinene.jl index 4896763..c6d59d7 100644 --- a/src/apinene.jl +++ b/src/apinene.jl @@ -2,7 +2,7 @@ export apinene # Isometrization of α-pinene COPS Problem v.0.3.1 # https://www.mcs.anl.gov/~more//cops/cops3.pdf -function apinene(args...; n = 400, kwargs...) +function apinene(n :: Int = 400, args...; kwargs...) T = 36420.0 model = CartesianDiscreteModel((0, T), n) diff --git a/src/bearing.jl b/src/bearing.jl index 355609a..b9209ea 100644 --- a/src/bearing.jl +++ b/src/bearing.jl @@ -3,7 +3,8 @@ export bearing # Journal Bearing COPS Problem v.0.3.1 # https://www.mcs.anl.gov/~more//cops/cops3.pdf # n= 50, 75, 100 -function bearing(args...; n = 50, kwargs...) +function bearing(n :: Int = 50, args...; kwargs...) + ϵ = 0.1 b = 10 diff --git a/src/burger1d.jl b/src/burger1d.jl index 438f907..84bed28 100644 --- a/src/burger1d.jl +++ b/src/burger1d.jl @@ -23,7 +23,7 @@ Suggestions: - FEOperatorFromTerms has only one term. We might consider splitting linear and nonlinear terms. """ -function burger1d(args...; n::Int = 512, kwargs...) +function burger1d(n :: Int = 512, args...; kwargs...) #Domain domain = (0, 1) diff --git a/src/burger1d_param.jl b/src/burger1d_param.jl index f675593..2dd6143 100644 --- a/src/burger1d_param.jl +++ b/src/burger1d_param.jl @@ -1,6 +1,6 @@ export burger1d_param -function burger1d_param(args...; n = 512, kwargs...) +function burger1d_param(n :: Int = 512, args...; kwargs...) domain = (0, 1) partition = n model = CartesianDiscreteModel(domain, partition) diff --git a/src/catmix.jl b/src/catmix.jl index e03c114..6ad522b 100644 --- a/src/catmix.jl +++ b/src/catmix.jl @@ -3,7 +3,7 @@ export catmix # Catalyst Mixing COPS Problem v.0.3.1 # https://www.mcs.anl.gov/~more//cops/cops3.pdf # n=100, 200, 400 -function catmix(args...; n::Int = 100, kwargs...) +function catmix(n :: Int = 100, args...; kwargs...) #Domain domain = (0, 1) diff --git a/src/cellincrease.jl b/src/cellincrease.jl index fbeb212..7cd2bc1 100644 --- a/src/cellincrease.jl +++ b/src/cellincrease.jl @@ -5,7 +5,7 @@ Mairet, F., & Bayen, T. (2021). The promise of dawn: microalgae photoacclimation Using a photosynthetic rate proportional to the photosynthetic apparatus mass fraction. """ -function cellincrease(args...; x0 = [0.6, 0.1], n = 10, T = 7, kwargs...) +function cellincrease(n :: Int = 10, args...; x0 = [0.6, 0.1], T = 7, kwargs...) kp(x) = 1.01 kr(x) = 2.03 diff --git a/src/cellincrease_MichaelisMenten.jl b/src/cellincrease_MichaelisMenten.jl index bd24930..f2f9076 100644 --- a/src/cellincrease_MichaelisMenten.jl +++ b/src/cellincrease_MichaelisMenten.jl @@ -5,7 +5,7 @@ Mairet, F., & Bayen, T. (2021). The promise of dawn: microalgae photoacclimation Using Michaelis-Menten's function for the photosynthetic rate. """ -function cellincrease_MichaelisMenten(args...; x0 = [0.6, 0.1], n = 10, T = 7, kwargs...) +function cellincrease_MichaelisMenten(n :: Int = 10, args...; x0 = [0.6, 0.1], T = 7, kwargs...) kp(x) = 1.6 kr(x) = 2.1 K(x) = 140. diff --git a/src/channel.jl b/src/channel.jl index 1bd54d4..efa5a45 100644 --- a/src/channel.jl +++ b/src/channel.jl @@ -2,7 +2,7 @@ export channel # Isometrization of Flow in a Channel COPS Problem v.0.3.1 # https://www.mcs.anl.gov/~more//cops/cops3.pdf -function channel(args...; n = 400, kwargs...) +function channel(n :: Int = 400, args...; kwargs...) model = CartesianDiscreteModel((0, 1), n) labels = get_face_labeling(model) diff --git a/src/controlelasticmembrane1.jl b/src/controlelasticmembrane1.jl index c3644e6..64f9e56 100644 --- a/src/controlelasticmembrane1.jl +++ b/src/controlelasticmembrane1.jl @@ -16,7 +16,7 @@ The force term is h(x_1,x_2) = - sin( ω x_1)sin( ω x_2) with ω = π - 1/8. In this first case, the bound constraints are constants with umin(x) = 0.0 and umax(x) = 1.0. """ -function controlelasticmembrane1(args...; n::Int = 10, kargs...) +function controlelasticmembrane1(n :: Int = 10, args...; kargs...) #Domain domain = (-1, 1, -1, 1) diff --git a/src/controlelasticmembrane2.jl b/src/controlelasticmembrane2.jl index dee9936..d8c1034 100644 --- a/src/controlelasticmembrane2.jl +++ b/src/controlelasticmembrane2.jl @@ -15,7 +15,7 @@ The force term is h(x_1,x_2) = - sin( ω x_1)sin( ω x_2) with ω = π - 1/8. In this second case, the bound constraints are umin(x) = x_1+x_2 and umax(x) = x_1^2+x_2^2 applied at the midpoint of the cells. """ -function controlelasticmembrane2(; n::Int = 10, args...) +function controlelasticmembrane2(n :: Int = 10, args...; kargs...) # Domain domain = (-1, 1, -1, 1) diff --git a/src/controlsir.jl b/src/controlsir.jl index f120f68..64dc17e 100644 --- a/src/controlsir.jl +++ b/src/controlsir.jl @@ -1,6 +1,6 @@ export controlsir -function controlsir(args...; x0 = [1, 2], n = 10, a = 0.2, b = 0.1, μ = 0.1, T = 1, kwargs...) +function controlsir(n :: Int = 10, args...; x0 = [1, 2], a = 0.2, b = 0.1, μ = 0.1, T = 1, kwargs...) model = CartesianDiscreteModel((0, T), n) labels = get_face_labeling(model) diff --git a/src/dirichlet.jl b/src/dirichlet.jl index e39e90c..49f0ffb 100644 --- a/src/dirichlet.jl +++ b/src/dirichlet.jl @@ -3,7 +3,8 @@ export dirichlet # Transition States for the Dirichlet Problem COPS Problem v.0.3.1 # https://www.mcs.anl.gov/~more//cops/cops3.pdf # n=10, 20, 40 -function dirichlet(args...; n = 10, kwargs...) +function dirichlet(n :: Int = 10, args...; kwargs...) + domain = (-1, 1, -1, 1) model = CartesianDiscreteModel(domain, n) diff --git a/src/dynamicsir.jl b/src/dynamicsir.jl index 3ef33e7..70ed505 100644 --- a/src/dynamicsir.jl +++ b/src/dynamicsir.jl @@ -1,6 +1,6 @@ export dynamicsir -function dynamicsir(args...; x0 = [1, 2], n = 10, T = 1, kwargs...) +function dynamicsir(n :: Int = 10, args...; x0 = [1, 2], T = 1, kwargs...) model = CartesianDiscreteModel((0, T), n) labels = get_face_labeling(model) add_tag_from_tags!(labels, "diri0", [1]) #initial time condition diff --git a/src/gasoil.jl b/src/gasoil.jl index ca4f421..531b6de 100644 --- a/src/gasoil.jl +++ b/src/gasoil.jl @@ -3,7 +3,8 @@ export gasoil # Catalytic Cracking of Gas Oil COPS Problem v.0.3.1 # https://www.mcs.anl.gov/~more//cops/cops3.pdf # n=100, 200, 400 -function gasoil(args...; n = 100, kwargs...) +function gasoil(n :: Int = 100, args...; kwargs...) + model = CartesianDiscreteModel((0, 1), n) valuetype = Float64 diff --git a/src/glider.jl b/src/glider.jl index c44ea48..9bc1043 100644 --- a/src/glider.jl +++ b/src/glider.jl @@ -3,7 +3,8 @@ export glider # Hang Glider COPS Problem v.0.3.1 # https://www.mcs.anl.gov/~more//cops/cops3.pdf # n=100, 200, 400 -function glider(args...; n = 100, kwargs...) +function glider(n :: Int = 100, args...; kwargs...) + model = CartesianDiscreteModel((0, 1), n) labels = get_face_labeling(model) add_tag_from_tags!(labels, "diri0", [1]) #initial time condition diff --git a/src/henon.jl b/src/henon.jl index 9714db3..b0e9db0 100644 --- a/src/henon.jl +++ b/src/henon.jl @@ -3,7 +3,8 @@ export henon # Transition States for the Henon Problem COPS Problem v.0.3.1 # https://www.mcs.anl.gov/~more//cops/cops3.pdf # n=10, 20, 40 -function henon(args...; n = 10, kwargs...) +function henon(n :: Int = 10, args...; kwargs...) + domain = (-1, 1, -1, 1) model = CartesianDiscreteModel(domain, n) diff --git a/src/ignition.jl b/src/ignition.jl index 3b8757d..f39f5de 100644 --- a/src/ignition.jl +++ b/src/ignition.jl @@ -4,7 +4,7 @@ export ignition # Example 2. IGNITION # Multilevel Active-Set Trust-Region (MASTR) Method for Bound Constrained Minimization # Alena Kopaničáková and Rolf Krause -function ignition(args...; n = 3, kwargs...) +function ignition(n :: Int = 3, args...; kwargs...) # n est la taille de la discrétisation (entier) domain = (0, 1, 0, 1) model = CartesianDiscreteModel(domain, (n, n)) diff --git a/src/incompressibleNavierStokes.jl b/src/incompressibleNavierStokes.jl index dd6a6a5..b5cf523 100644 --- a/src/incompressibleNavierStokes.jl +++ b/src/incompressibleNavierStokes.jl @@ -10,7 +10,7 @@ https://gridap.github.io/Tutorials/stable/pages/t008_inc_navier_stokes/ It has no objective function and no control, just the PDE. """ -function incompressiblenavierstokes(args...; n = 3, kwargs...) +function incompressiblenavierstokes(n :: Int = 3, args...; kwargs...) domain = (0, 1, 0, 1) partition = (n, n) model = CartesianDiscreteModel(domain, partition) diff --git a/src/inversepoissonproblem2d.jl b/src/inversepoissonproblem2d.jl index ae4bf83..c36bbbf 100644 --- a/src/inversepoissonproblem2d.jl +++ b/src/inversepoissonproblem2d.jl @@ -28,7 +28,7 @@ This example has been used in [Section 9.2](Estrin, R., Friedlander, M. P., Orba Implementing a smooth exact penalty function for equality-constrained nonlinear optimization. SIAM Journal on Scientific Computing, 42(3), A1809-A1835.) """ -function inversepoissonproblem2d(; n::Int = 100) +function inversepoissonproblem2d(n :: Int = 100, args...; kargs...) #Domain domain = (-1, 1, -1, 1) diff --git a/src/lane_emden.jl b/src/lane_emden.jl index cdfb6e2..ab9239f 100644 --- a/src/lane_emden.jl +++ b/src/lane_emden.jl @@ -3,7 +3,8 @@ export lane_emden # Transition States for the Lane-Emden Problem COPS Problem v.0.3.1 # https://www.mcs.anl.gov/~more//cops/cops3.pdf # n=10, 20, 40 -function lane_emden(args...; n = 10, kwargs...) +function lane_emden(n :: Int = 10, args...; kwargs...) + domain = (-1, 1, -1, 1) model = CartesianDiscreteModel(domain, n) diff --git a/src/membrane.jl b/src/membrane.jl index b9b04b5..4c32c28 100644 --- a/src/membrane.jl +++ b/src/membrane.jl @@ -9,7 +9,7 @@ Alena Kopaničáková and Rolf Krause The solution and original problem is given in Domorádová, M., & Dostál, Z. (2007). Projector preconditioning for partially bound‐constrained quadratic optimization. Numerical Linear Algebra with Applications, 14(10), 791-806. """ -function membrane(args...; n = 3, kwargs...) +function membrane(n :: Int = 3, args...; kwargs...) # n est la taille de la discrétisation (entier) domain = (0, 1, 0, 1) model = CartesianDiscreteModel(domain, (n, n)) diff --git a/src/methanol.jl b/src/methanol.jl index f4f3db8..33a74da 100644 --- a/src/methanol.jl +++ b/src/methanol.jl @@ -3,7 +3,8 @@ export methanol # Methanol to Hydrocarbons COPS Problem v.0.3.1 # https://www.mcs.anl.gov/~more//cops/cops3.pdf # n=100, 200, 400 -function methanol(args...; n = 100, kwargs...) +function methanol(n :: Int = 100, args...; kwargs...) + model = CartesianDiscreteModel((0, 1), n) valuetype = Float64 diff --git a/src/minsurf.jl b/src/minsurf.jl index 4c74ab3..9d88e66 100644 --- a/src/minsurf.jl +++ b/src/minsurf.jl @@ -3,7 +3,8 @@ export minsurf # Minimal Surface with Obstacle COPS Problem v.0.3.1 # https://www.mcs.anl.gov/~more//cops/cops3.pdf # n= 50, 75, 100 -function minsurf(args...; n = 50, kwargs...) +function minsurf(n :: Int = 50, args...; kwargs...) + domain = (0, 1, 0, 1) model = CartesianDiscreteModel(domain, (n, n)) trian = Triangulation(model) diff --git a/src/morebv.jl b/src/morebv.jl index 22f9b23..d49eccf 100644 --- a/src/morebv.jl +++ b/src/morebv.jl @@ -4,7 +4,7 @@ export morebv # Example 3. MOREBV # Multilevel Active-Set Trust-Region (MASTR) Method for Bound Constrained Minimization # Alena Kopaničáková and Rolf Krause -function morebv(args...; n = 3, kwargs...) +function morebv(n :: Int = 3, args...; kwargs...) # n est la taille de la discrétisation (entier) domain = (0, 1, 0, 1) model = CartesianDiscreteModel(domain, (n, n)) diff --git a/src/penalizedpoisson.jl b/src/penalizedpoisson.jl index 2f2f3e0..a1f7ee5 100644 --- a/src/penalizedpoisson.jl +++ b/src/penalizedpoisson.jl @@ -12,7 +12,7 @@ The minimizer of this problem is the solution of the Poisson equation: This example has been used in [Exercice 10.2.4 (p. 308)](G. Allaire, Analyse numérique et optimisation, Les éditions de Polytechnique) """ -function penalizedpoisson(args...; n = 2^4, kwargs...) +function penalizedpoisson(n :: Int = 2^4, args...; kwargs...) domain = (0, 1, 0, 1) partition = (n, n) model = CartesianDiscreteModel(domain, partition) diff --git a/src/poisson3d.jl b/src/poisson3d.jl index ad3cc31..9955aef 100644 --- a/src/poisson3d.jl +++ b/src/poisson3d.jl @@ -10,7 +10,11 @@ So, the minimal value is expected to be 0. It is inspired from the 2nd tutorial in Gridap.jl: https://gridap.github.io/Tutorials/stable/pages/t002_validation/ """ +<<<<<<< HEAD function poisson3d(; n::Int = 10) +======= +function poisson3d(n :: Int = 10, args...; kwargs...) +>>>>>>> 8f59ae4 (change signature) #For instance, the following lines build a CartesianDiscreteModel for the unit cube # (0,1)^3 with n cells per direction diff --git a/src/poisson_with_Neumann_and_Dirichlet.jl b/src/poisson_with_Neumann_and_Dirichlet.jl index 30151b2..1b4e285 100644 --- a/src/poisson_with_Neumann_and_Dirichlet.jl +++ b/src/poisson_with_Neumann_and_Dirichlet.jl @@ -1,6 +1,6 @@ export poisson_with_Neumann_and_Dirichlet -function poisson_with_Neumann_and_Dirichlet(args...; n::Int = 10, kwargs...) +function poisson_with_Neumann_and_Dirichlet(n :: Int = 10, args...; kwargs...) #model = DiscreteModelFromFile("https://github.com/gridap/Tutorials/tree/master/models/model.json") # model = DiscreteModelFromFile("models/model.json") #writevtk(model,"model") diff --git a/src/poissonboltzman2d.jl b/src/poissonboltzman2d.jl index 17bfcc1..170387a 100644 --- a/src/poissonboltzman2d.jl +++ b/src/poissonboltzman2d.jl @@ -24,7 +24,7 @@ The specificity of the problem: - quadratic objective function; - nonlinear constraints with AD jacobian; """ -function poissonboltzman2d(; n::Int = 100) +function poissonboltzman2d(n :: Int = 100, args...; kwargs...) #Domain domain = (-1, 1, -1, 1) diff --git a/src/poissonmixed.jl b/src/poissonmixed.jl index d2e4b84..9212875 100644 --- a/src/poissonmixed.jl +++ b/src/poissonmixed.jl @@ -11,7 +11,7 @@ export poissonmixed # * |k| = 2 # ############################################################################### -function poissonmixed(args...; n = 3, kwargs...) +function poissonmixed(n :: Int = 3, args...; kwargs...) domain = (0, 1, 0, 1) partition = (n, n) model = CartesianDiscreteModel(domain, partition) diff --git a/src/poissonmixed2.jl b/src/poissonmixed2.jl index c89f4be..7929a25 100644 --- a/src/poissonmixed2.jl +++ b/src/poissonmixed2.jl @@ -11,7 +11,7 @@ export poissonmixed2 # * |k| = 2 # ############################################################################### -function poissonmixed2(args...; n = 3, kwargs...) +function poissonmixed2(n :: Int = 3, args...; kwargs...) domain = (0, 1, 0, 1) partition = (n, n) model = CartesianDiscreteModel(domain, partition) diff --git a/src/poissonparam.jl b/src/poissonparam.jl index f8409a1..d4461db 100644 --- a/src/poissonparam.jl +++ b/src/poissonparam.jl @@ -11,7 +11,7 @@ export poissonparam # * |k| = 1 # ############################################################################### -function poissonparam(args...; n = 3, kwargs...) +function poissonparam(n :: Int = 3, args...; kwargs...) domain = (0, 1, 0, 1) partition = (n, n) model = CartesianDiscreteModel(domain, partition) diff --git a/src/robot.jl b/src/robot.jl index b7a5734..3c9d94e 100644 --- a/src/robot.jl +++ b/src/robot.jl @@ -3,7 +3,7 @@ export robot # Isometrization of Robot Arm COPS Problem v.0.3.1 # https://www.mcs.anl.gov/~more//cops/cops3.pdf # n=200, 400, 800 -function robot(args...; n = 400, kwargs...) +function robot(n :: Int = 400, args...; kwargs...) T = 1.0 model = CartesianDiscreteModel((0, T), n) labels = get_face_labeling(model) diff --git a/src/rocket.jl b/src/rocket.jl index 344d92b..8bcce13 100644 --- a/src/rocket.jl +++ b/src/rocket.jl @@ -3,7 +3,7 @@ export rocket # Goddard Rocket COPS Problem v.0.3.1 # https://www.mcs.anl.gov/~more//cops/cops3.pdf # n=400, 800, 1600 -function rocket(args...; n = 400, kwargs...) +function rocket(n :: Int = 400, args...; kwargs...) model = CartesianDiscreteModel((0, 1), n) labels = get_face_labeling(model) diff --git a/src/sis.jl b/src/sis.jl index 4618635..62e32a5 100644 --- a/src/sis.jl +++ b/src/sis.jl @@ -1,6 +1,6 @@ export sis -function sis(args...; x0 = [1, 2], n = 10, a = 0.2, b = 0.7, T = 1, kwargs...) +function sis(n :: Int = 10, args...; x0 = [1, 2], a = 0.2, b = 0.7, T = 1, kwargs...) model = CartesianDiscreteModel((0, T), n) labels = get_face_labeling(model) add_tag_from_tags!(labels, "diri0", [1]) #initial time condition diff --git a/src/smallestlaplacianeigenvalue.jl b/src/smallestlaplacianeigenvalue.jl index a747e7b..232d953 100644 --- a/src/smallestlaplacianeigenvalue.jl +++ b/src/smallestlaplacianeigenvalue.jl @@ -23,7 +23,7 @@ TODO: - does the 1 work as it is? or should it be put in lcon, ucon? - it is 1D for now. """ -function smallestlaplacianeigenvalue(; n::Int = 10, args...) +function smallestlaplacianeigenvalue(n :: Int = 10, args...; kwargs...) #Domain domain = (0, 1) diff --git a/src/steering.jl b/src/steering.jl index 016e875..cb29d46 100644 --- a/src/steering.jl +++ b/src/steering.jl @@ -3,7 +3,7 @@ export steering # Isometrization of Particle Steering COPS Problem v.0.3.1 # https://www.mcs.anl.gov/~more//cops/cops3.pdf # n=200, 400, 800 -function steering(args...; n = 400, kwargs...) +function steering(n :: Int = 400, args...; kwargs...) T = 1.0 model = CartesianDiscreteModel((0, T), n) labels = get_face_labeling(model) diff --git a/src/torebrachistochrone.jl b/src/torebrachistochrone.jl index b197111..c285675 100644 --- a/src/torebrachistochrone.jl +++ b/src/torebrachistochrone.jl @@ -1,6 +1,6 @@ export torebrachistochrone -function torebrachistochrone(args...; n = 3, kwargs...) +function torebrachistochrone(n :: Int = 3, args...; kwargs...) # n est la taille de la discrétisation (entier) # le domain au format (t₀, T) domain = (0, 1) diff --git a/src/torsion.jl b/src/torsion.jl index 5f75dbd..11d7f13 100644 --- a/src/torsion.jl +++ b/src/torsion.jl @@ -2,7 +2,7 @@ export torsion # Elastic-Plastic Torsion COPS Problem v.0.3.1 # https://www.mcs.anl.gov/~more//cops/cops3.pdf -function torsion(args...; n = 3, kwargs...) +function torsion(n :: Int = 3, args...; kwargs...) # n est la taille de la discrétisation (entier) # le domain au format (t₀, T) domain = (0, 1, 0, 1) diff --git a/test/runtests.jl b/test/runtests.jl index bb00eb8..b94c519 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -6,15 +6,13 @@ include("utils.jl") # Test that every problem can be instantiated. for prob in setdiff(names(PDEOptimizationProblems), [:PDEOptimizationProblems]) - @time begin - print(prob) - prob_fn = PDEOptimizationProblems.eval(prob) - nlp = prob_fn(n = 10) - println(" nvar=", nlp.meta.nvar, " ncon=", nlp.meta.ncon) - obj(nlp, nlp.meta.x0) - nlp.meta.ncon != 0 && cons(nlp, nlp.meta.x0) - hess(nlp, nlp.meta.x0, nlp.meta.y0) - # test meta information - meta_sanity(prob) - end + print(prob) + prob_fn = PDEOptimizationProblems.eval(prob) + nlp = prob_fn(10) + println(" nvar=",nlp.meta.nvar," ncon=",nlp.meta.ncon) + obj(nlp, nlp.meta.x0) + nlp.meta.ncon != 0 && cons(nlp, nlp.meta.x0) + hess(nlp, nlp.meta.x0, nlp.meta.y0) + # test meta information + meta_sanity(prob) end diff --git a/test/utils.jl b/test/utils.jl index c049647..59786da 100644 --- a/test/utils.jl +++ b/test/utils.jl @@ -3,7 +3,7 @@ function meta_sanity(name) meta = eval(Meta.parse("PDEOptimizationProblems.$(name)_meta")) n, m = eval(Meta.parse("PDEOptimizationProblems.get_$(name)_meta($ndef)")) - nlp = eval(Meta.parse("PDEOptimizationProblems.$(name)(n = $ndef)")) + nlp = eval(Meta.parse("PDEOptimizationProblems.$(name)($ndef)")) @show nlp.meta.name, meta[:name] if !(name in [:incompressiblenavierstokes]) From 55e1adaf16d1bfee0e30b52b6989fa5eb7d493bd Mon Sep 17 00:00:00 2001 From: tmigot Date: Thu, 14 Oct 2021 10:25:29 -0400 Subject: [PATCH 2/2] fix --- src/poisson3d.jl | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/poisson3d.jl b/src/poisson3d.jl index 9955aef..1a2d448 100644 --- a/src/poisson3d.jl +++ b/src/poisson3d.jl @@ -10,11 +10,7 @@ So, the minimal value is expected to be 0. It is inspired from the 2nd tutorial in Gridap.jl: https://gridap.github.io/Tutorials/stable/pages/t002_validation/ """ -<<<<<<< HEAD -function poisson3d(; n::Int = 10) -======= function poisson3d(n :: Int = 10, args...; kwargs...) ->>>>>>> 8f59ae4 (change signature) #For instance, the following lines build a CartesianDiscreteModel for the unit cube # (0,1)^3 with n cells per direction