/mass_matrix_2d/ufl_rules.mk
/mass_matrix_2d/benchmark_f?_p?_q?
/mass_matrix_2d/benchmark_f?_p?_q?.cpp
-/mass_matrix_2d/mass_matrix_f?_p?_q?.cpp
/mass_matrix_2d/mass_matrix_f?_p?_q?.ufl
/mass_matrix_2d/mass_matrix_f?_p?_q?_tensor.ufl
/mass_matrix_2d/mass_matrix_f?_p?_q?_quadrature.ufl
/laplacian_2d/ufl_rules.mk
/laplacian_2d/benchmark_f?_p?_q?
/laplacian_2d/benchmark_f?_p?_q?.cpp
-/laplacian_2d/laplacian_f?_p?_q?.cpp
/laplacian_2d/laplacian_f?_p?_q?.ufl
/laplacian_2d/laplacian_f?_p?_q?_tensor.ufl
/laplacian_2d/laplacian_f?_p?_q?_quadrature.ufl
/laplacian_2d/laplacian_f?_p?_q?_tensor.h
/laplacian_2d/laplacian_f?_p?_q?_quadrature.h
/laplacian_2d/laplacian_f?_p?_q?_excafe.h
+/vector_laplacian_2d/ufl_rules.mk
+/vector_laplacian_2d/benchmark_f?_p?_q?
+/vector_laplacian_2d/benchmark_f?_p?_q?.cpp
+/vector_laplacian_2d/vector_laplacian_f?_p?_q?.ufl
+/vector_laplacian_2d/vector_laplacian_f?_p?_q?_tensor.ufl
+/vector_laplacian_2d/vector_laplacian_f?_p?_q?_quadrature.ufl
+/vector_laplacian_2d/vector_laplacian_f?_p?_q?_tensor.h
+/vector_laplacian_2d/vector_laplacian_f?_p?_q?_quadrature.h
+/vector_laplacian_2d/vector_laplacian_f?_p?_q?_excafe.h
include ./ufl_rules.mk
ufl_rules.mk: ../common/generate_ufl_rules.sh
- ./$^ ${MAT_TYPE} > $@
+ ./$^ ${MAT_TYPE} ${FIELD_RANK} > $@
EXCAFE_LOCATION=${HOME}/excafe
MASS_MATRIX_2D_GENERATOR=${EXCAFE_LOCATION}/mass_matrix_generator_2d/generator
#include HEADER_EXCAFE
static const ufc::shape CELL_SHAPE = ufc::triangle;
-static const int CELL_VERTICES = 3;
-int dofsPerField(const int degree)
+int getTopologicalDimension(const ufc::shape shape)
{
- assert(degree >= 1);
+ switch(shape)
+ {
+ case ufc::triangle: return 2;
+ case ufc::tetrahedron: return 3;
+ default:
+ {
+ assert(false && "Unsupported shape.");
+ }
+ }
+}
+
+int numVertices(const ufc::shape shape)
+{
+ switch(shape)
+ {
+ case ufc::triangle: return 3;
+ case ufc::tetrahedron: return 4;
+ default:
+ {
+ assert(false && "Unsupported shape.");
+ }
+ }
+}
+
+int power(const int x, const int y)
+{
+ assert(y >= 0);
+
+ int result = 1;
+ for(int i=0; i<y; ++i)
+ result *= x;
+
+ return result;
+}
+
+int getSpaceDimension(const int n)
+{
+ assert(n >= 1);
int dofs = 0;
- for(int m=0; m<degree+1; ++m)
- for(int n=0; m+n<degree+1; ++n)
- ++dofs;
+ if (CELL_SHAPE == ufc::triangle)
+ {
+ dofs = (n*n + 3*n + 2)/2;
+ }
+ else if (CELL_SHAPE == ufc::tetrahedron)
+ {
+ dofs = (n*n*n + 6*n*n + 11*n + 6)/6;
+ }
+ else
+ {
+ assert(false && "Unsupported element shape.");
+ }
- return dofs;
+ return dofs * power(getTopologicalDimension(CELL_SHAPE), FIELD_RANK);
}
void checkPAPI(const int value)
void initCellData(const ufc::shape shape)
{
- switch(shape)
- {
- case ufc::triangle:
- {
- dimension = 2;
- vertices = 3;
- break;
- }
- default:
- {
- std::cerr << "Unimplemented cell shape." << std::endl;
- exit(EXIT_FAILURE);
- }
- }
+ vertices = numVertices(shape);
+ dimension = getTopologicalDimension(shape);
vertexData.reset(new double[dimension * vertices]);
vertexPointers.reset(new double*[vertices]);
static const char* const childOption = "--child";
const bool isChild = argc == 3 && strcmp(argv[1], childOption) == 0;
- static const int pDofs = dofsPerField(P_VALUE);
- static const int qDofs = dofsPerField(Q_VALUE);
+ static const int pDofs = getSpaceDimension(P_VALUE);
+ static const int qDofs = getSpaceDimension(Q_VALUE);
static const int numProcs = 100;
const std::size_t batchSize = 10 * 1000;
const long operations = (1000 * 1000 * 1000)/numProcs;
INTERMEDIATES=""
ECHO="/bin/echo"
MAT_TYPE=${1:?}
+FIELD_RANK=${2:?}
for NF in 1 2 3 4; do
for P in 1 2 3; do
# Generate dependencies for benchmark executable
${ECHO} "${BENCHMARK_SOURCE}: ${BENCHMARK_TEMPLATE}"
- ${ECHO} -e "\tm4 -DMAT_TYPE=${MAT_TYPE} -DNF_VALUE=${NF} -DP_VALUE=${P} -DQ_VALUE=${Q} \$^ > \$@"
+ ${ECHO} -e "\tm4 -DMAT_TYPE=${MAT_TYPE} -DNF_VALUE=${NF} -DP_VALUE=${P} -DQ_VALUE=${Q} -DFIELD_RANK=${FIELD_RANK} \$^ > \$@"
${ECHO} "${BENCHMARK_EXECUTABLE}: ${BENCHMARK_SOURCE} ${FFC_BUILT_SOURCES} ${EXCAFE_BUILT_SOURCES}"
${ECHO} -e '\t${CXX} ${CXXFLAGS} ${LDFLAGS} $< -o $@'
MAT_TYPE="laplacian"
+FIELD_RANK="0"
+
include ../benchmark.mk
tractable-benchmarks: benchmark_f1_p1_q1 benchmark_f1_p2_q3 \
--- /dev/null
+MAT_TYPE="vector_laplacian"
+FIELD_RANK="1"
+
+include ../benchmark.mk
+
+tractable-benchmarks: benchmark_f1_p1_q1 benchmark_f1_p2_q3 \
+benchmark_f2_p1_q1 benchmark_f2_p2_q3 benchmark_f3_p1_q1 \
+benchmark_f1_p1_q2 benchmark_f1_p2_q4 \
+benchmark_f2_p1_q2 benchmark_f2_p2_q4 benchmark_f3_p1_q2 \
+benchmark_f4_p1_q1 benchmark_f1_p1_q3 benchmark_f1_p3_q1 \
+benchmark_f2_p1_q3 benchmark_f2_p3_q1 benchmark_f3_p1_q3 \
+benchmark_f4_p1_q2 benchmark_f1_p1_q4 benchmark_f1_p3_q2 \
+benchmark_f2_p1_q4 benchmark_f2_p3_q2 benchmark_f3_p1_q4 \
+benchmark_f4_p1_q3 benchmark_f1_p2_q1 benchmark_f1_p3_q3 \
+benchmark_f2_p2_q1 benchmark_f2_p3_q3 benchmark_f3_p2_q1 \
+benchmark_f4_p1_q4 benchmark_f1_p2_q2 benchmark_f1_p3_q4 \
+benchmark_f2_p2_q2 benchmark_f2_p3_q4 benchmark_f3_p2_q2 \
+benchmark_f4_p2_q1
--- /dev/null
+element = VectorElement("Lagrange", "triangle", Q_VALUE)
+
+v = TestFunction(element)
+u = TrialFunction(element)
+
+a = inner(grad(v), grad(u))*dx
--- /dev/null
+element = VectorElement("Lagrange", "triangle", Q_VALUE)
+element_f = VectorElement("Lagrange", "triangle", P_VALUE)
+
+v = TestFunction(element)
+u = TrialFunction(element)
+
+f = Coefficient(element_f)
+
+a = div(f)*inner(grad(v), grad(u))*dx
--- /dev/null
+element = VectorElement("Lagrange", "triangle", Q_VALUE)
+element_f = VectorElement("Lagrange", "triangle", P_VALUE)
+
+v = TestFunction(element)
+u = TrialFunction(element)
+
+f = Coefficient(element_f)
+g = Coefficient(element_f)
+
+a = div(f)*div(g)*inner(grad(v), grad(u))*dx
--- /dev/null
+element = VectorElement("Lagrange", "triangle", Q_VALUE)
+element_f = VectorElement("Lagrange", "triangle", P_VALUE)
+
+v = TestFunction(element)
+u = TrialFunction(element)
+
+f = Coefficient(element_f)
+g = Coefficient(element_f)
+h = Coefficient(element_f)
+
+a = div(f)*div(g)*div(h)*inner(grad(v), grad(u))*dx
--- /dev/null
+element = VectorElement("Lagrange", "triangle", Q_VALUE)
+element_f = VectorElement("Lagrange", "triangle", P_VALUE)
+
+v = TestFunction(element)
+u = TrialFunction(element)
+
+f = Coefficient(element_f)
+g = Coefficient(element_f)
+h = Coefficient(element_f)
+i = Coefficient(element_f)
+
+a = div(f)*div(g)*div(h)*div(i)*inner(grad(v), grad(u))*dx