[cig-commits] r13858 - cs/cigma/trunk/examples/laplace2
luis at geodynamics.org
luis at geodynamics.org
Tue Jan 13 03:12:01 PST 2009
Author: luis
Date: 2009-01-13 03:12:01 -0800 (Tue, 13 Jan 2009)
New Revision: 13858
Modified:
cs/cigma/trunk/examples/laplace2/Makefile
cs/cigma/trunk/examples/laplace2/laplace.C
Log:
Compile laplace.C using libmesh-dev debian package
Also, changed output to use parallel VTU files.
Modified: cs/cigma/trunk/examples/laplace2/Makefile
===================================================================
--- cs/cigma/trunk/examples/laplace2/Makefile 2009-01-13 11:11:59 UTC (rev 13857)
+++ cs/cigma/trunk/examples/laplace2/Makefile 2009-01-13 11:12:01 UTC (rev 13858)
@@ -1,61 +1,35 @@
###############################################################################
# -*- Makefile -*-
-# The location of the mesh library
-meshdir := $(HOME)/dev/libmesh
+INCLUDES = \
+ -I/usr/include/mpi \
+ -I/usr/include/petsc \
+ -I/usr/include/libmesh
-# Include the library options determined by configure.
-# This will set the variables INCLUDE and LIBS that we
-# will need to build and link with the library
-include $(meshdir)/Make.common
+LIBS = -lmesh
-target := ./laplace-$(METHOD)
+CXX = g++
+CXXFLAGS = $(INCLUDES)
-# source files
-srcfiles := $(wildcard *.cpp)
+TARGETS = \
+ solution-2d.pvtu \
+ solution-3d.pvtu
-# object files
-objects := $(patsubst %.cpp, %.$(obj-suffix), $(srcfiles))
+all: $(TARGETS)
+solution-2d.pvtu: laplace
+ ./laplace -d 2 -n 15 -t pvtu
-all:: $(target)
+solution-3d.pvtu: laplace
+ ./laplace -d 3 -n 6 -t pvtu
-# Production rules
-$(target): $(objects)
- @echo Linking "$@"...
- $(libmesh_CXX) $(libmesh_CXXFLAGS) $(objects) -o $@ $(libmesh_LIBS) $(libmesh_LDFLAGS)
+laplace: laplace.o exact_solution.o
+ $(CXX) $^ $(LIBS) -o $@
-# Rules for running examples
-run: run1 run2 run3
+.C.o:
+ $(CXX) $< $(CXXFLAGS) -c -o $@
-run1: $(target)
- $(LIBMESHRUN) $(target) -d 1 -n 20 $(LIBMESHOPTIONS)
-
-run2: $(target)
- $(LIBMESHRUN) $(target) -d 1 -n 15 $(LIBMESHOPTIONS)
-
-run3: $(target)
- $(LIBMESHRUN) $(target) -d 1 -n 6 $(LIBMESHOPTIONS)
-
-# Useful rules
clean:
- rm -f $(objects) *~
+ rm -f *.o laplace *~ solution-*.*
-clobber:
- @$(MAKE) clean
- rm -f $(target) out_*
-
-distclean:
- @$(MAKE) clobber
- rm -f *.o *.g.o *.pg.o
-
-.PHONY: clean clobber distclean
-
-
-# include the dependency list
-include Makefile.dep
-
-Makefile.dep:
- @$(perl) $(meshdir)/contrib/bin/make_dependencies.pl -I. $(foreach i, $(wildcard $(meshdir)/include/*), -I$(i)) "-S\$$(obj-suffix)" $(srcfiles) > $@
- @echo Updated .depend
-
+.PHONY: clean
Modified: cs/cigma/trunk/examples/laplace2/laplace.C
===================================================================
--- cs/cigma/trunk/examples/laplace2/laplace.C 2009-01-13 11:11:59 UTC (rev 13857)
+++ cs/cigma/trunk/examples/laplace2/laplace.C 2009-01-13 11:12:01 UTC (rev 13858)
@@ -37,7 +37,7 @@
#include "getpot.h"
// Exact solution
-#include "exact_solution.h"
+#include "exact_solution.H"
// Assemble the linear system for Poisson problem
void assemble_poisson(EquationSystems& es, const std::string& system_name)
@@ -243,15 +243,15 @@
{
cout << "Running " << argv[0];
for (int i = 1; i < argc; i++)
- cout << " " argv[i];
+ cout << " " << argv[i];
cout << endl << endl;
}
// Read output filename from command line
- string outfile = "solution.pvtu";
+ string ext = "ucd";
if (command_line.search(1, "-t"))
{
- outfile = command_line.next(outfile);
+ ext = command_line.next(ext);
}
// Read problem dimension from command line
@@ -284,10 +284,10 @@
}
// Don't use a discontinuous basis
- if ((family == "MONOMIAL") || (family = "XYZ"))
+ if ((family == "MONOMIAL") || (family == "XYZ"))
{
cout << "This example currently requires a C^0 (or higher) FE basis." << endl;
- lib_mesh_error();
+ libmesh_error();
}
// Create a mesh with user-defined dimension
@@ -343,22 +343,20 @@
}
else
{
- string ext = ".vtk";
-
ostringstream stream;
- stream << "solution-" << dim << ext << std::ends;
+ stream << "solution-" << dim << "d." << ext << std::ends;
const char *filename = stream.str().c_str();
- if (ext == ".vtk")
+ if (ext == "pvtu")
{
VTKIO(mesh).write_equation_systems(filename, equation_systems);
}
- else if (ext == ".gmv")
+ else if (ext == "gmv")
{
GMVIO(mesh).write_equation_systems(filename, equation_systems);
}
- else if (ext == ".ucd")
+ else if (ext == "ucd")
{
UCDIO(mesh).write_equation_systems(filename, equation_systems);
}
More information about the CIG-COMMITS
mailing list