From 359bd0a88d71f40d223af05fa0f7ebcb9b297558 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 18 Mar 1998 15:43:57 +0000 Subject: [PATCH] Update to new library call syntax. git-svn-id: https://svn.dealii.org/trunk@80 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/Attic/examples/Makefile | 12 ++++--- .../deal.II/Attic/examples/poisson/poisson.cc | 36 +++++++++++-------- tests/big-tests/Makefile | 12 ++++--- tests/big-tests/poisson/poisson.cc | 36 +++++++++++-------- 4 files changed, 58 insertions(+), 38 deletions(-) diff --git a/deal.II/deal.II/Attic/examples/Makefile b/deal.II/deal.II/Attic/examples/Makefile index f40c158b70..6c77979105 100644 --- a/deal.II/deal.II/Attic/examples/Makefile +++ b/deal.II/deal.II/Attic/examples/Makefile @@ -6,8 +6,12 @@ CXXFLAGS.g= -DDEBUG -g -Wall $(INCPATH) CXXFLAGS = -O3 $(INCPATH) LIBPATH = -L../lib -L../../lac/lib +LIBFILES.g= ../lib/libbasic.g.a ../lib/libgrid.g.a \ + ../lib/libfe.g.a ../lib/libnumerics.g.a \ + ../../lac/lib/liblac.g.a +LIBFILES = $(LIBFILES.g:.g.a=.a) LIBS.g = $(LIBPATH) -lbasic.g -lgrid.g -lfe.g -lnumerics.g -llac.g -LIBS = $(LIBPATH) -lbasic -lgrid -lfe -lnumerics +LIBS = $(LIBS.g:.g=) ifeq ($(shell uname),SunOS) CXXFLAGS := -V2.7.2.3 $(CXXFLAGS) @@ -25,15 +29,15 @@ examples: $(cc-files:.cc=) @echo ================= Compiling $< @$(CXX) $(CXXFLAGS.g) -o $@ -g -c $< -grid/grid_test: grid/grid_test.o +grid/grid_test: grid/grid_test.o $(LIBFILES) @echo ================= Linking $@ @$(CXX) $(CXXFLAGS) -o $@ $< $(LIBS) -dof/dof_test: dof/dof_test.o +dof/dof_test: dof/dof_test.o $(LIBFILES.g) @echo ================= Linking $@ @$(CXX) $(CXXFLAGS.g) -o $@ $< $(LIBS.g) -lg++ -poisson/poisson: poisson/poisson.o +poisson/poisson: poisson/poisson.o $(LIBFILES.g) @echo ================= Linking $@ @$(CXX) $(CXXFLAGS.g) -g -o $@ $< ../../mia/control.o $(LIBS.g) -lg++ diff --git a/deal.II/deal.II/Attic/examples/poisson/poisson.cc b/deal.II/deal.II/Attic/examples/poisson/poisson.cc index 9c4c8b9151..d7761bbc59 100644 --- a/deal.II/deal.II/Attic/examples/poisson/poisson.cc +++ b/deal.II/deal.II/Attic/examples/poisson/poisson.cc @@ -34,7 +34,7 @@ class PoissonEquation : public Equation { Equation(1) {}; virtual void assemble (dFMatrix &cell_matrix, - vector &rhs, + dVector &rhs, const FEValues &fe_values, const Triangulation::cell_iterator &cell) const; double right_hand_side (const Point &) const; @@ -59,6 +59,8 @@ double PoissonEquation::right_hand_side (const Point &p) const { - 3./2.*(p(0)*p(0)+p(1)*p(1)) - 6*(p(0)+p(1)) + 6); +// return 1.; + default: return 0; }; @@ -67,7 +69,7 @@ double PoissonEquation::right_hand_side (const Point &p) const { void PoissonEquation<1>::assemble (dFMatrix &cell_matrix, - vector &rhs, + dVector &rhs, const FEValues<1> &fe_values, const Triangulation<1>::cell_iterator &) const { for (unsigned int point=0; point::assemble (dFMatrix &cell_matrix, fe_values.shape_value(i,point) * fe_values.shape_value(j,point)) * fe_values.JxW(point); - rhs[0](i) += fe_values.shape_value(i,point) * - right_hand_side(fe_values.quadrature_point(point)) * - fe_values.JxW(point); + rhs(i) += fe_values.shape_value(i,point) * + right_hand_side(fe_values.quadrature_point(point)) * + fe_values.JxW(point); }; }; void PoissonEquation<2>::assemble (dFMatrix &cell_matrix, - vector &rhs, + dVector &rhs, const FEValues<2> &fe_values, const Triangulation<2>::cell_iterator &) const { for (unsigned int point=0; point::assemble (dFMatrix &cell_matrix, fe_values.shape_value(i,point) * fe_values.shape_value(j,point)) * fe_values.JxW(point); - rhs[0](i) += fe_values.shape_value(i,point) * - right_hand_side(fe_values.quadrature_point(point)) * - fe_values.JxW(point); + rhs(i) += fe_values.shape_value(i,point) * + right_hand_side(fe_values.quadrature_point(point)) * + fe_values.JxW(point); }; }; @@ -120,23 +122,25 @@ int main () { // HyperBallBoundary<2> boundary(Point<2>(2,3), 4); + cout << "Making grid..." << endl; + tria.create_hypercube (); // tria.create_hyper_ball(Point<2>(2,3),4); // tria.set_boundary (&boundary); /* tria.refine_global (1); - tria.begin_active()->set_refine_flag(); + (--tria.last_active())->set_refine_flag(); + tria.execute_refinement (); + tria.begin_active(2)->set_refine_flag(); tria.execute_refinement (); - tria.refine_global (3); + tria.refine_global (2); */ - cout << "Making grid..." << endl; - const unsigned int dim=2; tria.refine_global (1); Triangulation::active_cell_iterator cell, endc; - for (int i=0; i<8; ++i) + for (int i=0; i<12; ++i) { int n_levels = tria.n_levels(); cell = tria.begin_active(); @@ -157,8 +161,10 @@ int main () { }; tria.refine_global (1); - cout << "Distributing dofs..." << endl; + + cout << "Distributing dofs... "; dof.distribute_dofs (fe); + cout << dof.n_dofs() << " degrees of freedom." << endl; cout << "Assembling matrices..." << endl; problem.assemble (equation, quadrature, fe); diff --git a/tests/big-tests/Makefile b/tests/big-tests/Makefile index f40c158b70..6c77979105 100644 --- a/tests/big-tests/Makefile +++ b/tests/big-tests/Makefile @@ -6,8 +6,12 @@ CXXFLAGS.g= -DDEBUG -g -Wall $(INCPATH) CXXFLAGS = -O3 $(INCPATH) LIBPATH = -L../lib -L../../lac/lib +LIBFILES.g= ../lib/libbasic.g.a ../lib/libgrid.g.a \ + ../lib/libfe.g.a ../lib/libnumerics.g.a \ + ../../lac/lib/liblac.g.a +LIBFILES = $(LIBFILES.g:.g.a=.a) LIBS.g = $(LIBPATH) -lbasic.g -lgrid.g -lfe.g -lnumerics.g -llac.g -LIBS = $(LIBPATH) -lbasic -lgrid -lfe -lnumerics +LIBS = $(LIBS.g:.g=) ifeq ($(shell uname),SunOS) CXXFLAGS := -V2.7.2.3 $(CXXFLAGS) @@ -25,15 +29,15 @@ examples: $(cc-files:.cc=) @echo ================= Compiling $< @$(CXX) $(CXXFLAGS.g) -o $@ -g -c $< -grid/grid_test: grid/grid_test.o +grid/grid_test: grid/grid_test.o $(LIBFILES) @echo ================= Linking $@ @$(CXX) $(CXXFLAGS) -o $@ $< $(LIBS) -dof/dof_test: dof/dof_test.o +dof/dof_test: dof/dof_test.o $(LIBFILES.g) @echo ================= Linking $@ @$(CXX) $(CXXFLAGS.g) -o $@ $< $(LIBS.g) -lg++ -poisson/poisson: poisson/poisson.o +poisson/poisson: poisson/poisson.o $(LIBFILES.g) @echo ================= Linking $@ @$(CXX) $(CXXFLAGS.g) -g -o $@ $< ../../mia/control.o $(LIBS.g) -lg++ diff --git a/tests/big-tests/poisson/poisson.cc b/tests/big-tests/poisson/poisson.cc index 9c4c8b9151..d7761bbc59 100644 --- a/tests/big-tests/poisson/poisson.cc +++ b/tests/big-tests/poisson/poisson.cc @@ -34,7 +34,7 @@ class PoissonEquation : public Equation { Equation(1) {}; virtual void assemble (dFMatrix &cell_matrix, - vector &rhs, + dVector &rhs, const FEValues &fe_values, const Triangulation::cell_iterator &cell) const; double right_hand_side (const Point &) const; @@ -59,6 +59,8 @@ double PoissonEquation::right_hand_side (const Point &p) const { - 3./2.*(p(0)*p(0)+p(1)*p(1)) - 6*(p(0)+p(1)) + 6); +// return 1.; + default: return 0; }; @@ -67,7 +69,7 @@ double PoissonEquation::right_hand_side (const Point &p) const { void PoissonEquation<1>::assemble (dFMatrix &cell_matrix, - vector &rhs, + dVector &rhs, const FEValues<1> &fe_values, const Triangulation<1>::cell_iterator &) const { for (unsigned int point=0; point::assemble (dFMatrix &cell_matrix, fe_values.shape_value(i,point) * fe_values.shape_value(j,point)) * fe_values.JxW(point); - rhs[0](i) += fe_values.shape_value(i,point) * - right_hand_side(fe_values.quadrature_point(point)) * - fe_values.JxW(point); + rhs(i) += fe_values.shape_value(i,point) * + right_hand_side(fe_values.quadrature_point(point)) * + fe_values.JxW(point); }; }; void PoissonEquation<2>::assemble (dFMatrix &cell_matrix, - vector &rhs, + dVector &rhs, const FEValues<2> &fe_values, const Triangulation<2>::cell_iterator &) const { for (unsigned int point=0; point::assemble (dFMatrix &cell_matrix, fe_values.shape_value(i,point) * fe_values.shape_value(j,point)) * fe_values.JxW(point); - rhs[0](i) += fe_values.shape_value(i,point) * - right_hand_side(fe_values.quadrature_point(point)) * - fe_values.JxW(point); + rhs(i) += fe_values.shape_value(i,point) * + right_hand_side(fe_values.quadrature_point(point)) * + fe_values.JxW(point); }; }; @@ -120,23 +122,25 @@ int main () { // HyperBallBoundary<2> boundary(Point<2>(2,3), 4); + cout << "Making grid..." << endl; + tria.create_hypercube (); // tria.create_hyper_ball(Point<2>(2,3),4); // tria.set_boundary (&boundary); /* tria.refine_global (1); - tria.begin_active()->set_refine_flag(); + (--tria.last_active())->set_refine_flag(); + tria.execute_refinement (); + tria.begin_active(2)->set_refine_flag(); tria.execute_refinement (); - tria.refine_global (3); + tria.refine_global (2); */ - cout << "Making grid..." << endl; - const unsigned int dim=2; tria.refine_global (1); Triangulation::active_cell_iterator cell, endc; - for (int i=0; i<8; ++i) + for (int i=0; i<12; ++i) { int n_levels = tria.n_levels(); cell = tria.begin_active(); @@ -157,8 +161,10 @@ int main () { }; tria.refine_global (1); - cout << "Distributing dofs..." << endl; + + cout << "Distributing dofs... "; dof.distribute_dofs (fe); + cout << dof.n_dofs() << " degrees of freedom." << endl; cout << "Assembling matrices..." << endl; problem.assemble (equation, quadrature, fe); -- 2.39.5