From: Guido Kanschat Date: Mon, 5 Mar 2001 11:52:43 +0000 (+0000) Subject: Output of first and second derivatives X-Git-Tag: v8.0.0~19660 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e164afba5ad5540ab732d2795e823c4d917b00ce;p=dealii.git Output of first and second derivatives git-svn-id: https://svn.dealii.org/trunk@4099 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/fe/Makefile.in b/tests/fe/Makefile.in index 6b8c025437..7b7fc6b688 100644 --- a/tests/fe/Makefile.in +++ b/tests/fe/Makefile.in @@ -23,10 +23,10 @@ debug-mode = on # Define library names ############################################################ -libs.g = $(lib-deal2-3d.g) $(lib-deal2-2d.g) \ +libs.g = $(lib-deal2-3d.g) $(lib-deal2-2d.g) $(lib-deal2-1d.g) \ $(lib-lac.g) \ $(lib-base.g) -libs = $(lib-deal2-2d.o) \ +libs = $(lib-deal2-3d.o) $(lib-deal2-2d.o) $(lib-deal2-1d.o) \ $(lib-lac.o) \ $(lib-base.o) @@ -115,6 +115,19 @@ performance: $(performance-o-files) $(libraries) ############################################################ +derivatives-cc-files = derivatives.cc + +ifeq ($(debug-mode),on) +derivatives-o-files = $(derivatives-cc-files:.cc=.go) +else +derivatives-o-files = $(derivatives-cc-files:.cc=.o) +endif + +derivatives: $(derivatives-o-files) $(libraries) + @$(CXX) $(LDFLAGS) -g -o $@ $^ $(LIBS) + +############################################################ + internals-cc-files = internals.cc ifeq ($(debug-mode),on) diff --git a/tests/fe/derivatives.cc b/tests/fe/derivatives.cc new file mode 100644 index 0000000000..d5b56c3bc9 --- /dev/null +++ b/tests/fe/derivatives.cc @@ -0,0 +1,151 @@ +// $Id$ +// (c) Guido Kanschat +// +// Show the shape functions implemented. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +char fname[50]; + +template +inline void +plot_derivatives(FiniteElement& finel, + const char* name) +{ + deallog.push (name); + + Triangulation tr; + DoFHandler dof(tr); + GridGenerator::hyper_cube(tr, 2., 5.); + DoFHandler::cell_iterator c = dof.begin(); + dof.distribute_dofs(finel); + + const unsigned int div = 1; + + QTrapez q; +// QIterated q(q_trapez, div); + FEValues fe(finel, q, UpdateFlags(update_gradients + | update_second_derivatives)); + fe.reinit(c); + + unsigned int k=0; + for (unsigned int mz=0;mz<=((dim>2) ? div : 0) ;++mz) + { + for (unsigned int my=0;my<=((dim>1) ? div : 0) ;++my) + { + for (unsigned int mx=0;mx<=div;++mx) + { + deallog << q.point(k) << endl; + + for (unsigned int i=0;i +void plot_FE_Q_shape_functions() +{ + FEQ1 q1; + plot_derivatives(q1, "Q1"); +// plot_face_shape_functions(m, q1, "Q1"); + FEQ2 q2; + plot_derivatives(q2, "Q2"); +// plot_face_shape_functions(m, q2, "Q2"); + FEQ3 q3; + plot_derivatives(q3, "Q3"); +// plot_face_shape_functions(m, q3, "Q3"); + FEQ4 q4; + plot_derivatives(q4, "Q4"); +// plot_face_shape_functions(m, q4, "Q4"); +// FE_Q q5(5); +// plot_derivatives(m, q5, "Q5"); +// FE_Q q6(6); +// plot_derivatives(m, q6, "Q6"); +// FE_Q q7(7); +// plot_derivatives(m, q7, "Q7"); +// FE_Q q8(8); +// plot_derivatives(m, q8, "Q8"); +// FE_Q q9(9); +// plot_derivatives(m, q9, "Q9"); +// FE_Q q10(10); +// plot_derivatives(m, q10, "Q10"); +} + + +template +void plot_FE_DGQ_shape_functions() +{ + FEDG_Q1 q1; + plot_derivatives(q1, "DGQ1"); +// plot_face_shape_functions(m, q1, "DGQ1"); + FEDG_Q2 q2; + plot_derivatives(q2, "DGQ2"); +// plot_face_shape_functions(m, q2, "DGQ2"); + FEDG_Q3 q3; + plot_derivatives(q3, "DGQ3"); +// plot_face_shape_functions(m, q3, "DGQ3"); + FEDG_Q4 q4; + plot_derivatives(q4, "DGQ4"); +// plot_face_shape_functions(m, q4, "DGQ4"); +// FE_DGQ q5(5); +// plot_derivatives(m, q5, "DGQ5"); +// FE_DGQ q6(6); +// plot_derivatives(m, q6, "DGQ6"); +// FE_DGQ q7(7); +// plot_derivatives(m, q7, "DGQ7"); +// FE_DGQ q8(8); +// plot_derivatives(m, q8, "DGQ8"); +// FE_DGQ q9(9); +// plot_derivatives(m, q9, "DGQ9"); +// FE_DGQ q10(10); +// plot_derivatives(m, q10, "DGQ10"); +} + + +int +main() +{ + ofstream logfile ("derivatives.log"); + deallog.attach (logfile); + logfile.precision(3); + + deallog.push ("1d"); + plot_FE_Q_shape_functions<1>(); + deallog.pop (); + + deallog.push ("2d"); + plot_FE_Q_shape_functions<2>(); + plot_FE_DGQ_shape_functions<2>(); + deallog.pop (); + + deallog.push ("3d"); +// plot_FE_Q_shape_functions<3>(); + deallog.pop (); + return 0; +} + + +