From: bangerth Date: Mon, 27 Sep 2010 20:10:46 +0000 (+0000) Subject: Add a new directory. It isn't currently used but will be soon. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7bb1effd9cda36f8f5325aa258d7d7fddbeafcd7;p=dealii-svn.git Add a new directory. It isn't currently used but will be soon. git-svn-id: https://svn.dealii.org/trunk@22177 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/serialization/Makefile b/tests/serialization/Makefile new file mode 100644 index 0000000000..664c5c9509 --- /dev/null +++ b/tests/serialization/Makefile @@ -0,0 +1,80 @@ +############################################################ +# $Id$ +# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +############################################################ + +############################################################ +# Include general settings for including DEAL libraries +############################################################ + +include ../Makefile.paths +include $D/common/Make.global_options + + +default: run-tests + +############################################################ +# rules to generate the threading tests. the .cc files are +# automatically generated; note that for the output generation, we +# have to sort the output since otherwise in MT mode things would come +# out in a random order. the same holds for a few other tests +threads_01.cc : threads.pl + @echo =====regenerating== $@ + @$(PERL) $^ > $@ + +threads_02.cc : threads_01.cc + @echo =====regenerating== $@ + @cat $^ \ + | $(PERL) -pi -e 's/spawn \((.*), (.*)\) \(/new_thread (\2, \1, /g;' \ + | $(PERL) -pi -e 's/(new_thread.*), \)/\1)/g;' \ + | $(PERL) -pi -e 's/threads_01/threads_02/g;' \ + > $@ + +threads_%/output : threads_%/exe + @echo =====Running======= $< + @echo Running > $(dir $@)/status + @$(ULIMIT) -t 2400 ; ./$< ; \ + if test ! $$? = 0 ; then rm $@ ; false ; fi + @perl -pi $(normalize) $@ + @sort $@ -o $@ + +thread_validity_07/output : thread_validity_07/exe + @echo =====Running======= $< + @echo Running > $(dir $@)/status + @$(ULIMIT) -t 2400 ; ./$< ; \ + if test ! $$? = 0 ; then rm $@ ; false ; fi + @perl -pi $(normalize) $@ + @sort $@ -o $@ + +task_%/output : task_%/exe + @echo =====Running======= $< + @echo Running > $(dir $@)/status + @$(ULIMIT) -t 2400 ; ./$< ; \ + if test ! $$? = 0 ; then rm $@ ; false ; fi + @perl -pi $(normalize) $@ + @sort $@ -o $@ + + +############################################################ + +# all .cc-files are tests, though the test bdm.cc appears to be dysfunctional +# and we don't want the data_out_base_tecplot_bin test if we haven't found the +# corresponding libraries: +ifeq (, $(findstring tecio, $LIBS)) + tests = $(filter-out data_out_base_tecplot_bin, $(basename $(wildcard *.cc))) +else + tests = $(basename $(wildcard *.cc)) +endif + +# add threading tests. note that we have +# to list them individually, without wildcards, because the .cc files are +# generated and don't exist yet (so wildcard expansion will fail) +tests += threads_01 threads_02 + + +############################################################ + + +include ../Makefile.rules +include Makefile.depend +include Makefile.tests diff --git a/tests/serialization/tensor_base.cc b/tests/serialization/tensor_base.cc new file mode 100644 index 0000000000..2a00d316a0 --- /dev/null +++ b/tests/serialization/tensor_base.cc @@ -0,0 +1,79 @@ +//---------------------------- tensor_base.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2010 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------- tensor_base.cc --------------------------- + +// check serialization for Tensor<1,dim> + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include + + +template +void verify (const T &t1, + const T &t2) +{ + // save data to archive + std::ostringstream oss; + { + boost::archive::text_oarchive oa(oss); + oa << t1; + // archive and stream closed when + // destructors are called + } + deallog << oss.str() << std::endl; + + // verify correctness of the + // serialization + { + std::istringstream iss(oss.str()); + boost::archive::text_iarchive ia(iss); + + + ia >> t2; + + Assert (t1 == t2, ExcInternalError()); + } +} + + +void test () +{ + const unsigned int dim=3; + + double a1[3] = {1, 2, 3}; + Tensor<1,dim> t1(a1); + + double a2[3] = {3, 6, 9}; + Tensor<1,dim> t2 (a2); + + verify (t1, t2); +} + + +int main () +{ + std::ofstream logfile("tensor_base/output"); + deallog << std::setprecision(3); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + test (); + + deallog << "OK" << std::endl; +} diff --git a/tests/serialization/tensor_base/cmp/generic b/tests/serialization/tensor_base/cmp/generic new file mode 100644 index 0000000000..4931f44c9b --- /dev/null +++ b/tests/serialization/tensor_base/cmp/generic @@ -0,0 +1,4 @@ + +DEAL::14.6 +DEAL::0 +DEAL::OK