From: Guido Kanschat Date: Wed, 24 Jan 2001 20:52:14 +0000 (+0000) Subject: new test on internals of finite elements X-Git-Tag: v8.0.0~19785 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=23b98e0197f6e529a767e2761c7de34db4fd74d7;p=dealii.git new test on internals of finite elements git-svn-id: https://svn.dealii.org/trunk@3790 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/fe/Makefile.in b/tests/fe/Makefile.in index ba9c3dd571..b52405854f 100644 --- a/tests/fe/Makefile.in +++ b/tests/fe/Makefile.in @@ -23,7 +23,7 @@ debug-mode = on # Define library names ############################################################ -libs.g = $(lib-deal2-2d.g) \ +libs.g = $(lib-deal2-3d.g) $(lib-deal2-2d.g) \ $(lib-lac.g) \ $(lib-base.g) libs = $(lib-deal2-2d.o) \ @@ -100,6 +100,19 @@ endif show_transform: $(show_transform-o-files) $(libraries) @$(CXX) $(LDFLAGS) -g -o $@ $^ $(LIBS) +############################################################ + +internals-cc-files = internals.cc + +ifeq ($(debug-mode),on) +internals-o-files = $(internals-cc-files:.cc=.go) +else +internals-o-files = $(internals-cc-files:.cc=.o) +endif + +internals: $(internals-o-files) $(libraries) + @$(CXX) $(LDFLAGS) -g -o $@ $^ $(LIBS) + ############################################################ # Continue with other targets if needed ############################################################ diff --git a/tests/fe/internals.cc b/tests/fe/internals.cc new file mode 100644 index 0000000000..9dfa30358e --- /dev/null +++ b/tests/fe/internals.cc @@ -0,0 +1,92 @@ +// $Id$ +// (c) Guido Kanschat +// +// Compute support points + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template +inline void +check_support (FiniteElement& finel, const char* name) +{ + Triangulation tr; + GridGenerator::hyper_cube(tr, 0., 1.); + DoFHandler dof (tr); + dof.distribute_dofs (finel); + + vector > cell_points (finel.dofs_per_cell); + vector > face_points (finel.dofs_per_face); + + DoFHandler::active_cell_iterator cell = dof.begin_active(); + finel.get_support_points (cell, cell_points); + + cout << name << '<' << dim << '>' << " cell support points" << endl; + + for (unsigned int k=0;k::faces_per_cell;++i) + { + cout << name << '<' << dim << '>' << " face " << i << " support points" << endl; + DoFHandler::active_face_iterator face = cell->face(i); + finel.get_face_support_points (face, face_points); + + for (unsigned int k=0;k +inline void +check_matrices (FiniteElement& fe, const char* name) +{ + for (unsigned int i=0;i::children_per_cell;++i) + { + cout << name << '<' << dim << '>' << " restriction " << i << endl; + fe.restrict(i).print_formatted (cout, 3, false, 6, "~"); + cout << name << '<' << dim << '>' << " embedding " << i << endl; + fe.prolongate(i).print_formatted (cout, 3, false, 6, "~"); + } +} + + +#define CHECK_S(EL,dim) FE ## EL EL; check_support(EL, #EL); +#define CHECK_M(EL,dim) FE ## EL EL; check_matrices(EL, #EL); +#define CHECK_ALL(EL,dim) FE ## EL EL; check_support(EL, #EL); check_matrices(EL,#EL) + +int +main() +{ + if (true) + { + CHECK_ALL(Q1,2); + CHECK_ALL(Q2,2); + CHECK_ALL(Q3,2); + CHECK_ALL(Q4,2); + CHECK_ALL(DG_Q0,2); + CHECK_ALL(DG_Q1,2); + CHECK_ALL(DG_Q2,2); + CHECK_ALL(DG_Q3,2); + } + if (true) + { + CHECK_ALL(Q1,3); + CHECK_ALL(Q2,3); + CHECK_ALL(DG_Q0,3); + CHECK_ALL(DG_Q1,3); + } + + return 0; +}