Skip to content

Commit

Permalink
user-facing equations.cc
Browse files Browse the repository at this point in the history
  • Loading branch information
landinjm committed Jan 16, 2025
1 parent f648b24 commit 01989d4
Show file tree
Hide file tree
Showing 22 changed files with 116 additions and 357 deletions.
2 changes: 1 addition & 1 deletion applications/multigrid_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ include_directories(${CMAKE_SOURCE_DIR}/../../src)
include_directories(${CMAKE_SOURCE_DIR})

# Set the location of the main.cc file
set(TARGET_SRC "${CMAKE_SOURCE_DIR}/main.cc")
set(TARGET_SRC "${CMAKE_SOURCE_DIR}/main.cc" "${CMAKE_SOURCE_DIR}/equations.cc")

# Check if there has been updates to main library
set(dir ${PROJECT_SOURCE_DIR}/../..)
Expand Down
30 changes: 4 additions & 26 deletions applications/multigrid_test/custom_PDE.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifndef CUSTOM_PDE_H_
#define CUSTOM_PDE_H_

#include <core/matrix_free_operator.h>

using namespace dealii;
Expand Down Expand Up @@ -51,29 +54,4 @@ class customPDE : public matrixFreeOperator<dim, degree, number>
&q_point_loc) const override;
};

template <int dim, int degree, typename number>
void
customPDE<dim, degree, number>::compute_explicit_RHS(
variableContainer<dim, degree, number> &variable_list,
const Point<dim, VectorizedArray<number>> &q_point_loc) const
{}

template <int dim, int degree, typename number>
void
customPDE<dim, degree, number>::compute_nonexplicit_RHS(
variableContainer<dim, degree, number> &variable_list,
const Point<dim, VectorizedArray<number>> &q_point_loc) const
{
scalarGrad phi = variable_list.get_scalar_gradient(0);

scalarValue coefficient = 1.0 / (0.05 + 2.0 * q_point_loc.square());

variable_list.set_scalar_gradient_term(0, phi * coefficient);
}

template <int dim, int degree, typename number>
void
customPDE<dim, degree, number>::compute_nonexplicit_LHS(
variableContainer<dim, degree, number> &variable_list,
const Point<dim, VectorizedArray<number>> &q_point_loc) const
{}
#endif
32 changes: 32 additions & 0 deletions applications/multigrid_test/equations.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include "custom_PDE.h"

#include <config.h>

template <int dim, int degree, typename number>
void
customPDE<dim, degree, number>::compute_explicit_RHS(
variableContainer<dim, degree, number> &variable_list,
const Point<dim, VectorizedArray<number>> &q_point_loc) const
{}

template <int dim, int degree, typename number>
void
customPDE<dim, degree, number>::compute_nonexplicit_RHS(
variableContainer<dim, degree, number> &variable_list,
const Point<dim, VectorizedArray<number>> &q_point_loc) const
{
scalarGrad phi = variable_list.get_scalar_gradient(0);

scalarValue coefficient = 1.0 / (0.05 + 2.0 * q_point_loc.square());

variable_list.set_scalar_gradient_term(0, phi * coefficient);
}

template <int dim, int degree, typename number>
void
customPDE<dim, degree, number>::compute_nonexplicit_LHS(
variableContainer<dim, degree, number> &variable_list,
const Point<dim, VectorizedArray<number>> &q_point_loc) const
{}

INSTANTIATE_TRI_TEMPLATE(customPDE)
42 changes: 42 additions & 0 deletions include/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,46 @@

#cmakedefine PRISMS_PF_WITH_CALIPER

// Macro for template instantations with <dim, degree, number>
#define INSTANTIATE_TRI_TEMPLATE(class_name) \
template class class_name<2, 1, float>; \
template class class_name<2, 2, float>; \
template class class_name<2, 3, float>; \
template class class_name<2, 4, float>; \
template class class_name<2, 5, float>; \
template class class_name<2, 6, float>; \
template class class_name<2, 1, double>; \
template class class_name<2, 2, double>; \
template class class_name<2, 3, double>; \
template class class_name<2, 4, double>; \
template class class_name<2, 5, double>; \
template class class_name<2, 6, double>; \
template class class_name<3, 1, float>; \
template class class_name<3, 2, float>; \
template class class_name<3, 3, float>; \
template class class_name<3, 4, float>; \
template class class_name<3, 5, float>; \
template class class_name<3, 6, float>; \
template class class_name<3, 1, double>; \
template class class_name<3, 2, double>; \
template class class_name<3, 3, double>; \
template class class_name<3, 4, double>; \
template class class_name<3, 5, double>; \
template class class_name<3, 6, double>;

// Macro for template instantations with <dim, degree>
#define INSTANTIATE_BI_TEMPLATE(class_name) \
template class class_name<2, 1>; \
template class class_name<2, 2>; \
template class class_name<2, 3>; \
template class class_name<2, 4>; \
template class class_name<2, 5>; \
template class class_name<2, 6>; \
template class class_name<3, 1>; \
template class class_name<3, 2>; \
template class class_name<3, 3>; \
template class class_name<3, 4>; \
template class class_name<3, 5>; \
template class class_name<3, 6>;

#endif
19 changes: 2 additions & 17 deletions src/core/boundary_conditions/boundaryConditions.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <config.h>
#include <core/boundary_conditions/nonUniformDirichletBC.h>
#include <core/boundary_conditions/varBCs.h>
#include <core/boundary_conditions/vectorBCFunction.h>
Expand Down Expand Up @@ -313,20 +314,4 @@ MatrixFreePDE<dim, degree>::set_rigid_body_mode_constraints(
}
}

template class MatrixFreePDE<2, 1>;
template class MatrixFreePDE<3, 1>;

template class MatrixFreePDE<2, 2>;
template class MatrixFreePDE<3, 2>;

template class MatrixFreePDE<3, 3>;
template class MatrixFreePDE<2, 3>;

template class MatrixFreePDE<3, 4>;
template class MatrixFreePDE<2, 4>;

template class MatrixFreePDE<3, 5>;
template class MatrixFreePDE<2, 5>;

template class MatrixFreePDE<3, 6>;
template class MatrixFreePDE<2, 6>;
INSTANTIATE_BI_TEMPLATE(MatrixFreePDE)
21 changes: 2 additions & 19 deletions src/core/boundary_conditions/markBoundaries.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// methods to mark boundaries

#include <config.h>
#include <core/initial_conditions/initialConditions.h>
#include <core/matrixFreePDE.h>

Expand Down Expand Up @@ -32,20 +31,4 @@ MatrixFreePDE<dim, degree>::markBoundaries(
}
}

template class MatrixFreePDE<2, 1>;
template class MatrixFreePDE<3, 1>;

template class MatrixFreePDE<2, 2>;
template class MatrixFreePDE<3, 2>;

template class MatrixFreePDE<3, 3>;
template class MatrixFreePDE<2, 3>;

template class MatrixFreePDE<3, 4>;
template class MatrixFreePDE<2, 4>;

template class MatrixFreePDE<3, 5>;
template class MatrixFreePDE<2, 5>;

template class MatrixFreePDE<3, 6>;
template class MatrixFreePDE<2, 6>;
INSTANTIATE_BI_TEMPLATE(MatrixFreePDE)
28 changes: 3 additions & 25 deletions src/core/buildFields.cc
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
/*
* buildFields.cc
*
* Created on: Feb 22, 2017
* Author: stephendewitt
*/

// =====================================================================
//================================================================
// FUNCTION TO BUILD THE VECTOR OF FIELDS
// =====================================================================

#include <config.h>
#include <core/matrixFreePDE.h>

template <int dim, int degree>
Expand All @@ -22,20 +16,4 @@ MatrixFreePDE<dim, degree>::buildFields()
}
}

template class MatrixFreePDE<2, 1>;
template class MatrixFreePDE<3, 1>;

template class MatrixFreePDE<2, 2>;
template class MatrixFreePDE<3, 2>;

template class MatrixFreePDE<3, 3>;
template class MatrixFreePDE<2, 3>;

template class MatrixFreePDE<3, 4>;
template class MatrixFreePDE<2, 4>;

template class MatrixFreePDE<3, 5>;
template class MatrixFreePDE<2, 5>;

template class MatrixFreePDE<3, 6>;
template class MatrixFreePDE<2, 6>;
INSTANTIATE_BI_TEMPLATE(MatrixFreePDE)
19 changes: 2 additions & 17 deletions src/core/checkpoint.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <boost/archive/binary_iarchive.hpp>
#include <boost/archive/binary_oarchive.hpp>

#include <config.h>
#include <core/conditional_ostreams.h>
#include <core/exceptions.h>
#include <core/matrixFreePDE.h>
Expand Down Expand Up @@ -273,20 +274,4 @@ MatrixFreePDE<dim, degree>::verify_checkpoint_file_exists(const std::string &fil
}
}

template class MatrixFreePDE<2, 1>;
template class MatrixFreePDE<3, 1>;

template class MatrixFreePDE<2, 2>;
template class MatrixFreePDE<3, 2>;

template class MatrixFreePDE<3, 3>;
template class MatrixFreePDE<2, 3>;

template class MatrixFreePDE<3, 4>;
template class MatrixFreePDE<2, 4>;

template class MatrixFreePDE<3, 5>;
template class MatrixFreePDE<2, 5>;

template class MatrixFreePDE<3, 6>;
template class MatrixFreePDE<2, 6>;
INSTANTIATE_BI_TEMPLATE(MatrixFreePDE)
19 changes: 2 additions & 17 deletions src/core/init.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <deal.II/grid/grid_generator.h>

#include <config.h>
#include <core/boundary_conditions/varBCs.h>
#include <core/conditional_ostreams.h>
#include <core/matrixFreePDE.h>
Expand Down Expand Up @@ -439,20 +440,4 @@ MatrixFreePDE<dim, degree>::compute_element_volume()
}
}

template class MatrixFreePDE<2, 1>;
template class MatrixFreePDE<3, 1>;

template class MatrixFreePDE<2, 2>;
template class MatrixFreePDE<3, 2>;

template class MatrixFreePDE<3, 3>;
template class MatrixFreePDE<2, 3>;

template class MatrixFreePDE<3, 4>;
template class MatrixFreePDE<2, 4>;

template class MatrixFreePDE<3, 5>;
template class MatrixFreePDE<2, 5>;

template class MatrixFreePDE<3, 6>;
template class MatrixFreePDE<2, 6>;
INSTANTIATE_BI_TEMPLATE(MatrixFreePDE)
19 changes: 2 additions & 17 deletions src/core/initial_conditions/initialConditions.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <cmath>
#include <config.h>
#include <core/conditional_ostreams.h>
#include <core/exceptions.h>
#include <core/initial_conditions/initialConditions.h>
Expand Down Expand Up @@ -434,20 +435,4 @@ MatrixFreePDE<dim, degree>::applyInitialConditions()
}
}

template class MatrixFreePDE<2, 1>;
template class MatrixFreePDE<3, 1>;

template class MatrixFreePDE<2, 2>;
template class MatrixFreePDE<3, 2>;

template class MatrixFreePDE<3, 3>;
template class MatrixFreePDE<2, 3>;

template class MatrixFreePDE<3, 4>;
template class MatrixFreePDE<2, 4>;

template class MatrixFreePDE<3, 5>;
template class MatrixFreePDE<2, 5>;

template class MatrixFreePDE<3, 6>;
template class MatrixFreePDE<2, 6>;
INSTANTIATE_BI_TEMPLATE(MatrixFreePDE)
19 changes: 2 additions & 17 deletions src/core/invM.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <deal.II/matrix_free/evaluation_flags.h>

#include <config.h>
#include <core/conditional_ostreams.h>
#include <core/matrixFreePDE.h>

Expand Down Expand Up @@ -146,20 +147,4 @@ MatrixFreePDE<dim, degree>::computeInvM()
<< parabolicVectorFieldIndex << ")\n";
}

template class MatrixFreePDE<2, 1>;
template class MatrixFreePDE<3, 1>;

template class MatrixFreePDE<2, 2>;
template class MatrixFreePDE<3, 2>;

template class MatrixFreePDE<3, 3>;
template class MatrixFreePDE<2, 3>;

template class MatrixFreePDE<3, 4>;
template class MatrixFreePDE<2, 4>;

template class MatrixFreePDE<3, 5>;
template class MatrixFreePDE<2, 5>;

template class MatrixFreePDE<3, 6>;
template class MatrixFreePDE<2, 6>;
INSTANTIATE_BI_TEMPLATE(MatrixFreePDE)
19 changes: 2 additions & 17 deletions src/core/matrixFreePDE.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <config.h>
#include <core/conditional_ostreams.h>
#include <core/matrixFreePDE.h>

Expand Down Expand Up @@ -70,20 +71,4 @@ MatrixFreePDE<dim, degree>::~MatrixFreePDE()
}
}

template class MatrixFreePDE<2, 1>;
template class MatrixFreePDE<3, 1>;

template class MatrixFreePDE<2, 2>;
template class MatrixFreePDE<3, 2>;

template class MatrixFreePDE<3, 3>;
template class MatrixFreePDE<2, 3>;

template class MatrixFreePDE<3, 4>;
template class MatrixFreePDE<2, 4>;

template class MatrixFreePDE<3, 5>;
template class MatrixFreePDE<2, 5>;

template class MatrixFreePDE<3, 6>;
template class MatrixFreePDE<2, 6>;
INSTANTIATE_BI_TEMPLATE(MatrixFreePDE)
Loading

0 comments on commit 01989d4

Please sign in to comment.