diff --git a/.gitignore b/.gitignore index ab8a39d90..334a2a1c2 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ *.code-workspace .DS_Store docs/build/ +LocalPreferences.toml Manifest.toml tmp/ .vscode/ diff --git a/NEWS.md b/NEWS.md index 5de323b2d..d4f0c0647 100644 --- a/NEWS.md +++ b/NEWS.md @@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Define `GeneralPolytope` that represents general polytopes in 2 and 3 dimensions. Since PR[#1006](https://github.com/gridap/Gridap.jl/pull/1006). +### Changed + +- Added local preferences for Gridap through `Preferences.jl`. The macro `@check` can now be activated/deactivated by using the local preference `execution_mode`. Since PR[#1014](https://github.com/gridap/Gridap.jl/pull/1014). + ## [0.18.2] - 2024-05-02 ### Fixed diff --git a/Project.toml b/Project.toml index 1aae37493..7fd4cb586 100644 --- a/Project.toml +++ b/Project.toml @@ -21,6 +21,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56" NearestNeighbors = "b8a86587-4115-5ab1-83bc-aa920d37bbce" PolynomialBases = "c74db56a-226d-5e98-8bb0-a6049094aeea" +Preferences = "21216c6a-2e73-6563-6e65-726566657250" QuadGK = "1fd47b50-473d-5c70-9696-f719f8f3bcdc" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" @@ -47,6 +48,7 @@ LineSearches = "7.0.1" NLsolve = "4.3.0" NearestNeighbors = "0.4.8" PolynomialBases = "0.4.12" +Preferences = "1.4" QuadGK = "2.3.1, 2.4" SparseMatricesCSR = "0.6.4" StaticArrays = "0.12.1, 1.0" diff --git a/README.md b/README.md index 7525f659b..851451681 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ pkg> add Gridap ``` ## Plugins + - [GridapDistributed](https://github.com/gridap/GridapDistributed.jl) Distributed-memory extension of Gridap. - [GridapEmbedded](https://github.com/gridap/GridapEmbedded.jl) Embedded finite elements in Julia. - [GridapGmsh](https://github.com/gridap/GridapGmsh.jl) Generate a FE mesh with [GMSH](www.gmsh.info) and use it in Gridap. diff --git a/src/Adaptivity/EdgeBasedRefinement.jl b/src/Adaptivity/EdgeBasedRefinement.jl index 6039c4dd7..8327a7967 100644 --- a/src/Adaptivity/EdgeBasedRefinement.jl +++ b/src/Adaptivity/EdgeBasedRefinement.jl @@ -1020,7 +1020,7 @@ function get_relabeled_connectivity(::BarycentricRefinementRule,rr::RefinementRu end function get_relabeled_connectivity(::PowellSabinRefinement,rr::RefinementRule,faces_gids) - @assert is_simplex(get_polytope(rr)) + @check is_simplex(get_polytope(rr)) conn = rr.ref_grid.grid.cell_node_ids gids = vcat(faces_gids...) new_data = lazy_map(Reindex(gids),conn.data) diff --git a/src/Adaptivity/OldToNewFields.jl b/src/Adaptivity/OldToNewFields.jl index 02b468742..4c0ba21cc 100644 --- a/src/Adaptivity/OldToNewFields.jl +++ b/src/Adaptivity/OldToNewFields.jl @@ -18,7 +18,7 @@ end function OldToNewField(old_fields::AbstractArray{<:Fields.Field}, rrule::RefinementRule, child_ids::AbstractVector{<:Integer}) - @assert length(old_fields)==length(child_ids) + @check length(old_fields)==length(child_ids) if length(old_fields) == 1 cell_map = get_cell_map(rrule)[child_ids[1]] old_field = old_fields[1] @@ -29,7 +29,7 @@ function OldToNewField(old_fields::AbstractArray{<:Fields.Field}, refined_or_untouched_field = old_field∘cell_map return OldToNewField(RefinedOrUntouchedNewFieldType(),fine_to_coarse_field,refined_or_untouched_field) else - @assert length(old_fields) <= num_subcells(rrule) + @check length(old_fields) <= num_subcells(rrule) fine_to_coarse_field = FineToCoarseField(old_fields,rrule,child_ids) cell_map = get_cell_map(rrule)[1] refined_or_untouched_field = old_fields[1]∘cell_map diff --git a/src/Arrays/Tables.jl b/src/Arrays/Tables.jl index 70ef1991e..c11e032ab 100644 --- a/src/Arrays/Tables.jl +++ b/src/Arrays/Tables.jl @@ -276,7 +276,7 @@ function append_tables_locally(offsets::NTuple, tables::NTuple) first_table, = tables - @assert all( map(length,tables) .== length(first_table) ) "All tables must have the same length" + @check all( map(length,tables) .== length(first_table) ) "All tables must have the same length" ndata = sum( (length(table.data) for table in tables) ) T = get_data_eltype(first_table) diff --git a/src/CellData/CellDofs.jl b/src/CellData/CellDofs.jl index be26cd940..7ec441f3c 100644 --- a/src/CellData/CellDofs.jl +++ b/src/CellData/CellDofs.jl @@ -35,7 +35,7 @@ function change_domain(a::CellDof,strian::Triangulation,::ReferenceDomain,ttrian if strian === ttrian return a end - @assert is_change_possible(strian,ttrian) msg + @check is_change_possible(strian,ttrian) msg D = num_cell_dims(strian) sglue = get_glue(strian,Val(D)) tglue = get_glue(ttrian,Val(D)) @@ -51,7 +51,7 @@ function change_domain(a::CellDof,strian::Triangulation,::PhysicalDomain,ttrian: if strian === ttrian return a end - @assert is_change_possible(strian,ttrian) msg + @check is_change_possible(strian,ttrian) msg D = num_cell_dims(strian) sglue = get_glue(strian,Val(D)) tglue = get_glue(ttrian,Val(D)) diff --git a/src/CellData/CellFields.jl b/src/CellData/CellFields.jl index 9d613498b..e850843f2 100644 --- a/src/CellData/CellFields.jl +++ b/src/CellData/CellFields.jl @@ -156,7 +156,7 @@ function change_domain(a::CellField,strian::Triangulation,::ReferenceDomain,ttri if strian === ttrian return a end - @assert is_change_possible(strian,ttrian) msg + @check is_change_possible(strian,ttrian) msg D = num_cell_dims(strian) sglue = get_glue(strian,Val(D)) tglue = get_glue(ttrian,Val(D)) @@ -172,7 +172,7 @@ function change_domain(a::CellField,strian::Triangulation,::PhysicalDomain,ttria if strian === ttrian return a end - @assert is_change_possible(strian,ttrian) msg + @check is_change_possible(strian,ttrian) msg D = num_cell_dims(strian) sglue = get_glue(strian,Val(D)) tglue = get_glue(ttrian,Val(D)) diff --git a/src/FESpaces/CLagrangianFESpaces.jl b/src/FESpaces/CLagrangianFESpaces.jl index 701f1b0c7..c3ad07e1a 100644 --- a/src/FESpaces/CLagrangianFESpaces.jl +++ b/src/FESpaces/CLagrangianFESpaces.jl @@ -194,7 +194,7 @@ function _generate_node_to_dof_glue_component_major( nfree_dofs = 0 ndiri_dofs = 0 ncomps = length(z) - @assert length(testitem(tag_to_masks)) == ncomps + @check length(testitem(tag_to_masks)) == ncomps for (node,tag) in enumerate(node_to_tag) if tag == UNSET nfree_dofs += ncomps diff --git a/src/FESpaces/FESpaceInterface.jl b/src/FESpaces/FESpaceInterface.jl index 6cb011fe2..e54b4d871 100644 --- a/src/FESpaces/FESpaceInterface.jl +++ b/src/FESpaces/FESpaceInterface.jl @@ -23,7 +23,7 @@ function get_cell_fe_data(fun,f,ttrian) if strian === ttrian return sface_to_data end - @assert is_change_possible(strian,ttrian) + @check is_change_possible(strian,ttrian) D = num_cell_dims(strian) sglue = get_glue(strian,Val(D)) tglue = get_glue(ttrian,Val(D)) diff --git a/src/Helpers/Helpers.jl b/src/Helpers/Helpers.jl index 2ecff6949..e2e7f3d3d 100644 --- a/src/Helpers/Helpers.jl +++ b/src/Helpers/Helpers.jl @@ -9,6 +9,10 @@ $(EXPORTS) module Helpers using DocStringExtensions +@static if VERSION >= v"1.6" + using Preferences +end + import Base: +, -, *, /, transpose, adjoint import LinearAlgebra: cross, tr, dot @@ -21,8 +25,11 @@ export tfill export get_val_parameter export first_and_tail export GridapType +export set_debug_mode, set_performance_mode #export operate +include("Preferences.jl") + include("Macros.jl") include("HelperFunctions.jl") diff --git a/src/Helpers/Macros.jl b/src/Helpers/Macros.jl index 48deccd85..b27821144 100644 --- a/src/Helpers/Macros.jl +++ b/src/Helpers/Macros.jl @@ -53,11 +53,16 @@ end @check condition "Error message" Macro used to make sure that condition is fulfilled, like `@assert` -but the check gets deactivated when running Julia with --boundscheck=no +but the check gets deactivated when running Gridap in performance mode. """ macro check(test,msg="A check failed") - quote - @boundscheck @assert $(esc(test)) $(esc(msg)) + @static if execution_mode == "debug" + quote + @assert $(esc(test)) $(esc(msg)) + end + else + quote + nothing + end end end - diff --git a/src/Helpers/Preferences.jl b/src/Helpers/Preferences.jl new file mode 100644 index 000000000..a15b19995 --- /dev/null +++ b/src/Helpers/Preferences.jl @@ -0,0 +1,45 @@ + +""" + set_execution_mode(new_mode::String) + +Sets the execution mode to either "debug" or "performance", which controls +the behavior of the @check macro within the Gridap package. + +- Debug mode (default): The @check macro will be active, which activates consistency checks + within the library. This mode is recommended for development and debugging purposes. + +- Performance mode: The @check macro will be deactivated. This mode is recommended for + production runs, where no errors are expected. + +Pre-defined functions [`set_debug_mode`](@ref) and [`set_performance_mode`](@ref) are also available. +Feature only available in Julia 1.6 and later due to restrictions from `Preferences.jl`. +""" +function set_execution_mode(new_mode::String) + if !(new_mode in ("debug", "performance")) + throw(ArgumentError("Invalid execution mode: \"$(new_mode)\"")) + end + + # Set it in our runtime values, as well as saving it to disk + @set_preferences!("execution_mode" => new_mode) + @info("New execution mode set; restart your Julia session for this change to take effect!") +end + +""" + set_debug_mode() + + Equivalent to `set_execution_mode("debug")`. +""" +set_debug_mode() = set_execution_mode("debug") + +""" + set_performance_mode() + + Equivalent to `set_execution_mode("performance")`. +""" +set_performance_mode() = set_execution_mode("performance") + +@static if VERSION >= v"1.6" + const execution_mode = @load_preference("execution_mode", "debug") +else + const execution_mode = "debug" +end diff --git a/src/ODEs/ODESolvers/Tableaus.jl b/src/ODEs/ODESolvers/Tableaus.jl index 81901aef5..59d068e6c 100644 --- a/src/ODEs/ODESolvers/Tableaus.jl +++ b/src/ODEs/ODESolvers/Tableaus.jl @@ -221,11 +221,11 @@ struct IMEXTableau <: AbstractTableau{ImplicitExplicitTableau} msg = """Invalid IMEX tableau: the first tableau must be implicit and the second must be explicit.""" - @assert (Tim <: ImplicitTableau && Tex == ExplicitTableau) msg + @check (Tim <: ImplicitTableau && Tex == ExplicitTableau) msg msg = """Invalid IMEX tableau: the nodes of the implicit and explicit tableaus must coincide.""" - @assert isapprox(get_nodes(im_tableau), get_nodes(ex_tableau)) msg + @check isapprox(get_nodes(im_tableau), get_nodes(ex_tableau)) msg is_padded = _is_padded(im_tableau) diff --git a/src/Polynomials/JacobiPolynomialBases.jl b/src/Polynomials/JacobiPolynomialBases.jl index 20413cca6..2b615d9c3 100644 --- a/src/Polynomials/JacobiPolynomialBases.jl +++ b/src/Polynomials/JacobiPolynomialBases.jl @@ -47,7 +47,7 @@ return_type(::JacobiPolynomialBasis{D,T}) where {D,T} = T # Field implementation function return_cache(f::JacobiPolynomialBasis{D,T},x::AbstractVector{<:Point}) where {D,T} - @assert D == length(eltype(x)) "Incorrect number of point components" + @check D == length(eltype(x)) "Incorrect number of point components" np = length(x) ndof = length(f.terms)*num_components(T) n = 1 + _maximum(f.orders) diff --git a/src/Polynomials/MonomialBases.jl b/src/Polynomials/MonomialBases.jl index bd8a9966c..4f5238983 100644 --- a/src/Polynomials/MonomialBases.jl +++ b/src/Polynomials/MonomialBases.jl @@ -117,7 +117,7 @@ return_type(::MonomialBasis{D,T}) where {D,T} = T # Field implementation function return_cache(f::MonomialBasis{D,T},x::AbstractVector{<:Point}) where {D,T} - @assert D == length(eltype(x)) "Incorrect number of point components" + @check D == length(eltype(x)) "Incorrect number of point components" zT = zero(T) zxi = zero(eltype(eltype(x))) Tp = typeof( zT*zxi*zxi + zT*zxi*zxi ) @@ -155,7 +155,7 @@ function _return_cache( TisbitsType::Val{true}) where {D,V,T} f = fg.fa - @assert D == length(eltype(x)) "Incorrect number of point components" + @check D == length(eltype(x)) "Incorrect number of point components" np = length(x) ndof = length(f.terms)*num_components(V) n = 1 + _maximum(f.orders) @@ -253,7 +253,7 @@ function return_cache( x::AbstractVector{<:Point}) where {D,V} f = fg.fa - @assert D == length(eltype(x)) "Incorrect number of point components" + @check D == length(eltype(x)) "Incorrect number of point components" np = length(x) ndof = length(f.terms)*num_components(V) xi = testitem(x) diff --git a/src/Polynomials/PCurlGradMonomialBases.jl b/src/Polynomials/PCurlGradMonomialBases.jl index cbc39aad2..23c6d0f21 100644 --- a/src/Polynomials/PCurlGradMonomialBases.jl +++ b/src/Polynomials/PCurlGradMonomialBases.jl @@ -34,7 +34,7 @@ The `order` argument has the following meaning: the divergence of the functions in this basis is in the P space of degree `order`. """ function PCurlGradMonomialBasis{D}(::Type{T},order::Int) where {D,T} - @assert T<:Real "T needs to be <:Real since represents the type of the components of the vector value" + @check T<:Real "T needs to be <:Real since represents the type of the components of the vector value" P_k = MonomialBasis{D}(T, order, _p_filter) S_k = MonomialBasis{D}(T, order, _s_filter) pterms = P_k.terms @@ -55,7 +55,7 @@ get_order(f::PCurlGradMonomialBasis{D,T}) where {D,T} = f.order return_type(::PCurlGradMonomialBasis{D,T}) where {D,T} = T function return_cache(f::PCurlGradMonomialBasis{D,T},x::AbstractVector{<:Point}) where {D,T} - @assert D == length(eltype(x)) "Incorrect number of point components" + @check D == length(eltype(x)) "Incorrect number of point components" np = length(x) ndof = _ndofs_pgrad(f) n = 1 + f.order+1 @@ -89,7 +89,7 @@ function return_cache( x::AbstractVector{<:Point}) where {D,T} f = fg.fa - @assert D == length(eltype(x)) "Incorrect number of point components" + @check D == length(eltype(x)) "Incorrect number of point components" np = length(x) ndof = _ndofs_pgrad(f) n = 1 + f.order+1 diff --git a/src/Polynomials/QCurlGradMonomialBases.jl b/src/Polynomials/QCurlGradMonomialBases.jl index 17e5f4850..b0ad934dc 100644 --- a/src/Polynomials/QCurlGradMonomialBases.jl +++ b/src/Polynomials/QCurlGradMonomialBases.jl @@ -30,7 +30,7 @@ The `order` argument has the following meaning: the divergence of the functions is in the Q space of degree `order`. """ function QCurlGradMonomialBasis{D}(::Type{T},order::Int) where {D,T} - @assert T<:Real "T needs to be <:Real since represents the type of the components of the vector value" + @check T<:Real "T needs to be <:Real since represents the type of the components of the vector value" _order = order+1 _t = tfill(_order,Val{D-1}()) t = (_order+1,_t...) diff --git a/src/Polynomials/QGradMonomialBases.jl b/src/Polynomials/QGradMonomialBases.jl index a7b6ec836..2e69283ab 100644 --- a/src/Polynomials/QGradMonomialBases.jl +++ b/src/Polynomials/QGradMonomialBases.jl @@ -31,7 +31,7 @@ The `order` argument has the following meaning: the curl of the functions in th is in the Q space of degree `order`. """ function QGradMonomialBasis{D}(::Type{T},order::Int) where {D,T} - @assert T<:Real "T needs to be <:Real since represents the type of the components of the vector value" + @check T<:Real "T needs to be <:Real since represents the type of the components of the vector value" _order = order + 1 _t = tfill(_order+1,Val{D-1}()) t = (_order,_t...) @@ -48,7 +48,7 @@ num_terms(f::QGradMonomialBasis{D,T}) where {D,T} = length(f.terms)*D get_order(f::QGradMonomialBasis) = f.order function return_cache(f::QGradMonomialBasis{D,T},x::AbstractVector{<:Point}) where {D,T} - @assert D == length(eltype(x)) "Incorrect number of point components" + @check D == length(eltype(x)) "Incorrect number of point components" np = length(x) ndof = _ndofs_qgrad(f) n = 1 + f.order+1 @@ -82,7 +82,7 @@ function return_cache( x::AbstractVector{<:Point}) where {D,T} f = fg.fa - @assert D == length(eltype(x)) "Incorrect number of point components" + @check D == length(eltype(x)) "Incorrect number of point components" np = length(x) ndof = _ndofs_qgrad(f) n = 1 + f.order+1 diff --git a/src/ReferenceFEs/BDMRefFEs.jl b/src/ReferenceFEs/BDMRefFEs.jl index 5e38b6ff8..81d3bd9af 100644 --- a/src/ReferenceFEs/BDMRefFEs.jl +++ b/src/ReferenceFEs/BDMRefFEs.jl @@ -122,7 +122,7 @@ function Conformity(reffe::GenericRefFE{BDM},sym::Symbol) function _BDM_face_values(p,et,order,phi) # Reference facet - @assert is_simplex(p) "We are assuming that all n-faces of the same n-dim are the same." + @check is_simplex(p) "We are assuming that all n-faces of the same n-dim are the same." fp = Polytope{num_dims(p)-1}(p,1) # geomap from ref face to polytope faces diff --git a/src/ReferenceFEs/BezierRefFEs.jl b/src/ReferenceFEs/BezierRefFEs.jl index d46c9f21e..4620d5620 100644 --- a/src/ReferenceFEs/BezierRefFEs.jl +++ b/src/ReferenceFEs/BezierRefFEs.jl @@ -103,8 +103,8 @@ end ## Bernstein Basis function _bernstein_term(p,a,i) - @assert i ≤ p - @assert a ≤ p + @check i ≤ p + @check a ≤ p if ( i ≤ a ≤ p ) f = factorial(p) ÷ ( factorial(i)*factorial(p-i) ) b1 = binomial( p-i, a-i ) @@ -116,8 +116,8 @@ function _bernstein_term(p,a,i) end function _bernstein_term(p,a,b,i,j) - @assert i+j ≤ p - @assert a+b ≤ p + @check i+j ≤ p + @check a+b ≤ p if ( i ≤ a ≤ p-j ) && ( j ≤ b ≤ p-a ) f = factorial(p) ÷ ( factorial(i)*factorial(j)*factorial(p-i-j) ) b1 = binomial( p-i-j, a-i ) @@ -130,8 +130,8 @@ function _bernstein_term(p,a,b,i,j) end function _bernstein_term(p,a,b,c,i,j,k) - @assert i+j+k ≤ p - @assert a+b+c ≤ p + @check i+j+k ≤ p + @check a+b+c ≤ p if ( i ≤ a ≤ p-j-k ) && ( j ≤ b ≤ p-a-k ) && ( k ≤ c ≤ p-a-b ) p!,i!,j!,k! = factorial(p),factorial(i),factorial(j),factorial(k) f = p! ÷ ( i!*j!*k!*factorial(p-i-j-k) ) diff --git a/src/ReferenceFEs/CDLagrangianRefFEs.jl b/src/ReferenceFEs/CDLagrangianRefFEs.jl index d3932bee2..f4b071e08 100644 --- a/src/ReferenceFEs/CDLagrangianRefFEs.jl +++ b/src/ReferenceFEs/CDLagrangianRefFEs.jl @@ -34,13 +34,13 @@ end function _CDLagrangianRefFE(::Type{T},p::ExtrusionPolytope{D},orders,cont) where {T,D} cond(c,o) = ( o > 0 || c == DISC ) - @assert all((cond(cont[k],orders[k]) for k in 1:length(orders))) + @check all((cond(cont[k],orders[k]) for k in 1:length(orders))) _cd_lagrangian_ref_fe(T,p,orders,cont) end function _cd_lagrangian_ref_fe(::Type{T},p::ExtrusionPolytope{D},orders,cont) where {T,D} - @assert isa(p,ExtrusionPolytope) + @check isa(p,ExtrusionPolytope) prebasis = compute_monomial_basis(T,p,orders) diff --git a/src/TensorValues/SymFourthOrderTensorValueTypes.jl b/src/TensorValues/SymFourthOrderTensorValueTypes.jl index 0dfea5a93..d36c2cbd7 100644 --- a/src/TensorValues/SymFourthOrderTensorValueTypes.jl +++ b/src/TensorValues/SymFourthOrderTensorValueTypes.jl @@ -8,7 +8,7 @@ Type representing a symmetric fourth-order tensor struct SymFourthOrderTensorValue{D,T,L} <: MultiValue{Tuple{D,D,D,D},T,4,L} data::NTuple{L,T} function SymFourthOrderTensorValue{D,T}(data::NTuple{L,T}) where {D,T,L} - @assert L == (D*(D+1)÷2)^2 + @check L == (D*(D+1)÷2)^2 new{D,T,L}(data) end end diff --git a/src/TensorValues/SymTensorValueTypes.jl b/src/TensorValues/SymTensorValueTypes.jl index e84e95085..1f9412aef 100644 --- a/src/TensorValues/SymTensorValueTypes.jl +++ b/src/TensorValues/SymTensorValueTypes.jl @@ -8,7 +8,7 @@ Type representing a symmetric second-order tensor struct SymTensorValue{D,T,L} <: MultiValue{Tuple{D,D},T,2,L} data::NTuple{L,T} function SymTensorValue{D,T}(data::NTuple{L,T}) where {D,T,L} - @assert L == D*(D+1)÷2 + @check L == D*(D+1)÷2 new{D,T,L}(data) end end @@ -30,7 +30,7 @@ SymTensorValue{0}(data::NTuple{0}) = SymTensorValue{0,Int}(data) @generated function SymTensorValue(data::NTuple{L,T}) where {L,T} msg = "Invalid number of scalar arguments in SymTensorValue constructor" V = (sqrt(1+8*L)-1)/2 - @assert floor(Int,V) == ceil(Int,V) msg + @check floor(Int,V) == ceil(Int,V) msg D = Int(V) quote SymTensorValue{$D,T}(data) diff --git a/src/TensorValues/TensorValueTypes.jl b/src/TensorValues/TensorValueTypes.jl index a005984d5..327211c6f 100644 --- a/src/TensorValues/TensorValueTypes.jl +++ b/src/TensorValues/TensorValueTypes.jl @@ -8,7 +8,7 @@ Type representing a second-order tensor struct TensorValue{D1,D2,T,L} <: MultiValue{Tuple{D1,D2},T,2,L} data::NTuple{L,T} function TensorValue{D1,D2,T}(data::NTuple{L,T}) where {D1,D2,T,L} - @assert L == D1*D2 + @check L == D1*D2 new{D1,D2,T,L}(data) end end diff --git a/src/TensorValues/ThirdOrderTensorValueTypes.jl b/src/TensorValues/ThirdOrderTensorValueTypes.jl index 5d120c279..8b9b6b2c3 100644 --- a/src/TensorValues/ThirdOrderTensorValueTypes.jl +++ b/src/TensorValues/ThirdOrderTensorValueTypes.jl @@ -5,7 +5,7 @@ Type representing a third-order tensor struct ThirdOrderTensorValue{D1,D2,D3,T,L} <: MultiValue{Tuple{D1,D2,D3},T,3,L} data::NTuple{L,T} function ThirdOrderTensorValue{D1,D2,D3,T}(data::NTuple{L,T}) where {D1,D2,D3,T,L} - @assert L == D1*D2*D3 + @check L == D1*D2*D3 new{D1,D2,D3,T,L}(data) end end diff --git a/test/HelpersTests/PreferencesTests.jl b/test/HelpersTests/PreferencesTests.jl new file mode 100644 index 000000000..ce88abe20 --- /dev/null +++ b/test/HelpersTests/PreferencesTests.jl @@ -0,0 +1,10 @@ + +module PreferencesTests + +using Gridap +using Gridap.Helpers + +set_performance_mode() +set_debug_mode() + +end # module diff --git a/test/HelpersTests/runtests.jl b/test/HelpersTests/runtests.jl index 062099f0b..35b49b325 100644 --- a/test/HelpersTests/runtests.jl +++ b/test/HelpersTests/runtests.jl @@ -2,6 +2,8 @@ module HelpersTests using Test +@testset "Preferences" begin include("PreferencesTests.jl") end + @testset "Macros" begin include("MacrosTests.jl") end @testset "HelperFunctions" begin include("HelperFunctionsTests.jl") end @@ -9,4 +11,3 @@ using Test @testset "GridapTypes" begin include("GridapTypesTests.jl") end end # module -