Skip to content

Commit e50c9f0

Browse files
Putting in ifdef guards to allow use to compile code
even when STKExprEval is not on in Trilinos. Sorry, @mperego, for not doing this earlier.
1 parent f509195 commit e50c9f0

8 files changed

+59
-26
lines changed

CMakeLists.txt

+11
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ if (NOT SET_COMPILERS_AUTOMATICALLY)
2424
project(Albany CXX C Fortran)
2525
endif ()
2626

27+
2728
# Advertise that we support shared libs
2829
SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
2930

@@ -370,6 +371,16 @@ IF (have_stk_List_ID GREATER -1)
370371
SET(ALBANY_STK_PERCEPT FALSE)
371372
ENDIF()
372373

374+
#set optional dependency on STKExprEval
375+
LIST(FIND Trilinos_PACKAGE_LIST STKExprEval STKExprEval_List_ID)
376+
IF (STKExprEval_List_ID GREATER -1)
377+
MESSAGE(" -- Looking for STKExprEval: Found. Compiling with -DALBANY_STK_EXPR_EVAL.")
378+
SET(ALBANY_STK_EXPR_EVAL TRUE)
379+
add_definitions(-DALBANY_STK_EXPR_EVAL)
380+
ELSE()
381+
MESSAGE(" -- Looking for STKExprEval: NOT Found.")
382+
SET(ALBANY_STK_EXPR_EVAL FALSE)
383+
ENDIF()
373384
ELSE()
374385
MESSAGE("-- Looking for STK: NOT found.")
375386
SET(ALBANY_STK FALSE)

src/CMakeLists.txt

+10-3
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,6 @@ ENDIF ()
292292
#evaluators
293293
SET(SOURCES ${SOURCES}
294294
evaluators/bc/PHAL_Dirichlet.cpp
295-
evaluators/bc/PHAL_ExprEvalSDBC.cpp
296295
evaluators/bc/PHAL_TimeDepDBC.cpp
297296
evaluators/bc/PHAL_TimeDepSDBC.cpp
298297
evaluators/bc/PHAL_SDirichlet.cpp
@@ -368,6 +367,10 @@ SET(SOURCES ${SOURCES}
368367
IF (ALBANY_STK)
369368
SET(SOURCES ${SOURCES}
370369
evaluators/state/PHAL_SaveSideSetStateField.cpp)
370+
IF(ALBANY_STK_EXPR_EVAL)
371+
SET(SOURCES ${SOURCES}
372+
evaluators/bc/PHAL_ExprEvalSDBC.cpp)
373+
ENDIF()
371374
ENDIF()
372375

373376
IF (ALBANY_EPETRA)
@@ -411,7 +414,6 @@ SET(PDE_SRCS ${PDE_SRCS}
411414

412415
SET(HEADERS ${HEADERS}
413416
evaluators/bc/PHAL_Dirichlet.hpp
414-
evaluators/bc/PHAL_ExprEvalSDBC.hpp
415417
evaluators/bc/PHAL_TimeDepDBC.hpp
416418
evaluators/bc/PHAL_TimeDepSDBC.hpp
417419
evaluators/bc/PHAL_SDirichlet.hpp
@@ -424,7 +426,6 @@ SET(HEADERS ${HEADERS}
424426
evaluators/bc/PHAL_DirichletOffNodeSet.hpp
425427
evaluators/bc/PHAL_DirichletOffNodeSet_Def.hpp
426428
evaluators/bc/PHAL_Dirichlet_Def.hpp
427-
evaluators/bc/PHAL_ExprEvalSDBC_Def.hpp
428429
evaluators/bc/PHAL_TimeDepDBC_Def.hpp
429430
evaluators/bc/PHAL_TimeDepSDBC_Def.hpp
430431
evaluators/bc/PHAL_SDirichlet_Def.hpp
@@ -552,11 +553,17 @@ SET(HEADERS ${HEADERS}
552553
evaluators/utility/QCAD_MeshRegion.hpp
553554
evaluators/utility/QCAD_MeshRegion_Def.hpp
554555
)
556+
555557

556558
IF (ALBANY_STK)
557559
SET(HEADERS ${HEADERS}
558560
evaluators/state/PHAL_SaveSideSetStateField.hpp
559561
evaluators/state/PHAL_SaveSideSetStateField_Def.hpp)
562+
IF(ALBANY_STK_EXPR_EVAL)
563+
SET(HEADERS ${HEADERS}
564+
evaluators/bc/PHAL_ExprEvalSDBC.hpp
565+
evaluators/bc/PHAL_ExprEvalSDBC_Def.hpp)
566+
ENDIF()
560567
ENDIF()
561568

562569

src/PHAL_FactoryTraits.hpp

+22-19
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,17 @@ namespace PHAL {
7171
static const int id_dirichlet_coordinate_function = 2;
7272
static const int id_dirichlet_field = 3;
7373
static const int id_dirichlet_off_nodeset = 4; // To handle equations on side set (see PHAL_DirichletOffNodeSet)
74-
static const int id_timedep_bc = 5; // Only for LCM probs
75-
static const int id_timedep_sdbc = 6; // Only for LCM probs
74+
static const int id_timedep_bc = 5;
75+
static const int id_timedep_sdbc = 6;
7676
static const int id_sdbc = 7;
77-
static int const id_expreval_sdbc = 8;
78-
static const int id_sdirichlet_field = 9;
79-
static const int id_kfield_bc = 10; // Only for LCM probs
80-
static const int id_eq_concentration_bc = 11; // Only for LCM probs
81-
static const int id_time = 12; // Only for LCM probs
82-
static const int id_torsion_bc = 13; // Only for LCM probs
83-
static const int id_schwarz_bc = 14; // Only for LCM probs
84-
static const int id_strong_schwarz_bc = 15; // Only for LCM probs
77+
static const int id_sdirichlet_field = 8;
78+
static const int id_kfield_bc = 9; // Only for LCM probs
79+
static const int id_eq_concentration_bc = 10; // Only for LCM probs
80+
static const int id_time = 11; // Only for LCM probs
81+
static const int id_torsion_bc = 12; // Only for LCM probs
82+
static const int id_schwarz_bc = 13; // Only for LCM probs
83+
static const int id_strong_schwarz_bc = 14; // Only for LCM probs
84+
static int const id_expreval_sdbc = 15; // Only if ALBANY_STK_EXPR_EVAL is ON
8585

8686
typedef Sacado::mpl::vector<
8787
PHAL::Dirichlet<_,Traits>, // 0
@@ -92,20 +92,23 @@ namespace PHAL {
9292
PHAL::TimeDepDBC<_, Traits>, // 5
9393
PHAL::TimeDepSDBC<_, Traits>, // 6
9494
PHAL::SDirichlet<_, Traits>, // 7
95-
PHAL::ExprEvalSDBC<_, Traits>, // 8
96-
PHAL::SDirichletField<_, Traits> // 9
95+
PHAL::SDirichletField<_, Traits> // 8
9796
#if defined(ALBANY_LCM)
9897
,
99-
LCM::KfieldBC<_,Traits>, // 10
100-
LCM::EquilibriumConcentrationBC<_,Traits>, // 11
101-
LCM::Time<_, Traits>, // 12
102-
LCM::TorsionBC<_, Traits> // 13
98+
LCM::KfieldBC<_,Traits>, // 9
99+
LCM::EquilibriumConcentrationBC<_,Traits>, // 10
100+
LCM::Time<_, Traits>, // 11
101+
LCM::TorsionBC<_, Traits> // 12
103102
#endif
104103
#if defined(ALBANY_LCM) && defined(ALBANY_STK)
105104
,
106-
LCM::SchwarzBC<_, Traits>, // 14
107-
LCM::StrongSchwarzBC<_, Traits>, // 15
108-
LCM::PDNeighborFitBC<_, Traits> // 16
105+
LCM::SchwarzBC<_, Traits>, // 13
106+
LCM::StrongSchwarzBC<_, Traits>, // 14
107+
LCM::PDNeighborFitBC<_, Traits> // 15
108+
#endif
109+
#ifdef ALBANY_STK_EXPR_EVAL
110+
,
111+
PHAL::ExprEvalSDBC<_, Traits> // 16
109112
#endif
110113
> EvaluatorTypes;
111114
};

src/adapt/AAdapt_AnalyticFunction.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
#include "Teuchos_TestForException.hpp"
1313
#include "Teuchos_Exceptions.hpp"
1414
#include "Albany_Macros.hpp"
15+
#ifdef ALBANY_STK_EXPR_EVAL
1516
#include <stk_expreval/Evaluator.hpp>
17+
#endif
1618

1719
#include "Aeras_ShallowWaterConstants.hpp"
1820

@@ -2913,6 +2915,7 @@ void AAdapt::ExpressionParser::compute(double* solution, const double* X) {
29132915
return;
29142916
}
29152917

2918+
#ifdef ALBANY_STK_EXPR_EVAL
29162919
AAdapt::ExpressionParserAllDOFs::ExpressionParserAllDOFs(
29172920
int neq_,
29182921
int dim_,
@@ -2940,3 +2943,4 @@ AAdapt::ExpressionParserAllDOFs::compute(double* unknowns, double const* coords)
29402943
unknowns[eq] = expr_eval.evaluate();
29412944
}
29422945
}
2946+
#endif

src/adapt/AAdapt_AnalyticFunction.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,7 @@ class ExpressionParser : public AnalyticFunction {
636636
#endif
637637
};
638638

639+
#ifdef ALBANY_STK_EXPR_EVAL
639640
class ExpressionParserAllDOFs : public AnalyticFunction
640641
{
641642
public:
@@ -648,7 +649,7 @@ class ExpressionParserAllDOFs : public AnalyticFunction
648649
int neq; // size of solution vector x
649650
Teuchos::Array<std::string> expr;
650651
};
651-
652+
#endif
652653
}
653654

654655
#endif

src/adapt/AAdapt_InitialCondition.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,9 @@ void InitialConditions (const Teuchos::RCP<Thyra_Vector>& soln,
207207
}
208208
}
209209
}
210-
} else if (name == "Expression Parser All DOFs") {
210+
}
211+
#ifdef ALBANY_STK_EXPR_EVAL
212+
else if (name == "Expression Parser All DOFs") {
211213
Teuchos::Array<std::string> default_expr(neq);
212214
for (auto i = 0; i < default_expr.size(); ++i) { default_expr[i] = "0.0"; }
213215
Teuchos::Array<std::string> expr =
@@ -234,7 +236,9 @@ void InitialConditions (const Teuchos::RCP<Thyra_Vector>& soln,
234236
}
235237
}
236238
}
237-
} else {
239+
}
240+
#endif
241+
else {
238242
Teuchos::Array<double> defaultData(neq);
239243
Teuchos::Array<double> data = icParams.get("Function Data", defaultData);
240244

src/problems/Albany_BCUtils_Def.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,7 @@ Albany::BCUtils<Albany::DirichletTraits>::buildEvaluatorsList(
730730
}
731731
}
732732
}
733+
#ifdef ALBANY_STK_EXPR_EVAL
733734
///
734735
/// Expression Evaluated SDBC (S = "Symmetric", f.k.a. "Strong")
735736
///
@@ -757,7 +758,7 @@ Albany::BCUtils<Albany::DirichletTraits>::buildEvaluatorsList(
757758
}
758759
}
759760
}
760-
761+
#endif
761762
///
762763
///
763764
/// Scaled SDBC (S = "Symmetric", f.k.a. "Strong")

tests/small/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ ENDIF ()
2121
add_subdirectory(Heat2DTriangles)
2222
add_subdirectory(Heat1DWithSource)
2323
add_subdirectory(MPNIQuad2D)
24+
IF(ALBANY_EXPR_EVAL_SDBC)
2425
add_subdirectory(Thermal1D)
26+
ENDIF()
2527
add_subdirectory(TransientHeat1D)
2628
add_subdirectory(TransientHeat2D)
2729
add_subdirectory(HeatEigenvalues)

0 commit comments

Comments
 (0)