Merge lp:~ldeo-magma/dolfin/devfixes into lp:dolfin/1.0.x

Proposed by Cian Wilson
Status: Merged
Merged at revision: 6351
Proposed branch: lp:~ldeo-magma/dolfin/devfixes
Merge into: lp:dolfin/1.0.x
Diff against target: 382 lines (+190/-128)
3 files modified
dolfin/common/defines.cpp (+170/-0)
dolfin/common/defines.h (+16/-124)
site-packages/dolfin_utils/meshconvert.py (+4/-4)
To merge this branch: bzr merge lp:~ldeo-magma/dolfin/devfixes
Reviewer Review Type Date Requested Status
Registry Administrators Pending
Review via email: mp+79484@code.launchpad.net

Description of the change

The following are so trivial they may not be worth your while merging from this branch but I thought I'd flag them anyway.

meshconvert.py still produces xml headers with 'meshfunction' in them, which produces a warning at runtime. Changing to 'mesh_function'.

defines.h was producing multiple definitions of its various subroutines during linking (I have multiple libraries which include dolfin.h). I've split it up into definitions and implementation now and this fixes my problem but don't know if you have a preferred solution.

This all appears to work for me but hasn't been thoroughly tested.

To post a comment you must log in.
Revision history for this message
Johan Hake (johan-hake) wrote :

Cian!

Thanks for the fixes. They all look good. Have you looked at the webpage for
contributing code?

http://fenicsproject.org/contributing/contributing_code.html

There are a copyright consent you need to sign (if you have not done it).
Basically giving the consent that FEniCS can be distributed with LGPL3.0 or
later.

Johan

On Saturday October 15 2011 17:47:29 Cian Wilson wrote:
> Cian Wilson has proposed merging lp:~ldeo-magma/dolfin/devfixes into
> lp:dolfin.
>
> Requested reviews:
> DOLFIN Core Team (dolfin-core)
>
> For more details, see:
> https://code.launchpad.net/~ldeo-magma/dolfin/devfixes/+merge/79484
>
> The following are so trivial they may not be worth your while merging from
> this branch but I thought I'd flag them anyway.
>
> meshconvert.py still produces xml headers with 'meshfunction' in them,
> which produces a warning at runtime. Changing to 'mesh_function'.
>
> defines.h was producing multiple definitions of its various subroutines
> during linking (I have multiple libraries which include dolfin.h). I've
> split it up into definitions and implementation now and this fixes my
> problem but don't know if you have a preferred solution.
>
> This all appears to work for me but hasn't been thoroughly tested.

Revision history for this message
Cian Wilson (cwilson) wrote :

Hi Johan,

I haven't signed the consent form no but am familiar with the procedure. Will get on it straight away - slow bit might be getting my employer to do it, though they've done it in the past.

Cheers,
Cian

Revision history for this message
Cian Wilson (cwilson) wrote :

Johan,

Forms are in the mail.

Cheers,
Cian

Revision history for this message
Johan Hake (johan-hake) wrote :

On Tuesday October 18 2011 12:48:41 Cian Wilson wrote:
> Johan,
>
> Forms are in the mail.

Execellent!

Johan

> Cheers,
> Cian

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'dolfin/common/defines.cpp'
--- dolfin/common/defines.cpp 1970-01-01 00:00:00 +0000
+++ dolfin/common/defines.cpp 2011-10-16 00:46:23 +0000
@@ -0,0 +1,170 @@
1// Copyright (C) 2009-2011 Johan Hake
2//
3// This file is part of DOLFIN.
4//
5// DOLFIN is free software: you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// DOLFIN is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU Lesser General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
17//
18// First added: 2011-10-15
19// Last changed: 2011-10-15
20
21#include <dolfin/common/defines.h>
22
23// Return true if DOLFIN is compiled with OpenMP
24bool has_openmp()
25{
26#ifdef HAS_OPENMP
27 return true;
28#else
29 return false;
30#endif
31}
32
33// Return true if DOLFIN is compiled with MPI
34bool has_mpi()
35{
36#ifdef HAS_MPI
37 return true;
38#else
39 return false;
40#endif
41}
42
43// Return true if DOLFIN is compiled with SLEPc
44bool has_slepc()
45{
46#ifdef HAS_SLEPC
47 return true;
48#else
49 return false;
50#endif
51}
52
53// Return true if DOLFIN is compiled with Trilinos
54bool has_trilinos()
55{
56#ifdef HAS_TRILINOS
57 return true;
58#else
59 return false;
60#endif
61}
62
63// Return true if DOLFIN is compiled with Scotch
64bool has_scotch()
65{
66#ifdef HAS_SCOTCH
67 return true;
68#else
69 return false;
70#endif
71}
72
73// Return true if DOLFIN is compiled with CGAL
74bool has_cgal()
75{
76#ifdef HAS_CGAL
77 return true;
78#else
79 return false;
80#endif
81}
82
83// Return true if DOLFIN is compiled with Umfpack
84bool has_umfpack()
85{
86#ifdef HAS_UMFPACK
87 return true;
88#else
89 return false;
90#endif
91}
92
93// Return true if DOLFIN is compiled with Cholmod
94bool has_cholmod()
95{
96#ifdef HAS_CHOLMOD
97 return true;
98#else
99 return false;
100#endif
101}
102
103// Return true if DOLFIN is compiled with parmetis
104bool has_parmetis()
105{
106#ifdef HAS_PARMETIS
107 return true;
108#else
109 return false;
110#endif
111}
112
113// Return true if DOLFIN is compiled with GMP
114bool has_gmp()
115{
116#ifdef HAS_GMP
117 return true;
118#else
119 return false;
120#endif
121}
122
123// Return true if DOLFIN is compiled with ZLIB
124bool has_zlib()
125{
126#ifdef HAS_ZLIB
127 return true;
128#else
129 return false;
130#endif
131}
132
133// Return true if a specific linear algebra backend is supported
134bool has_linear_algebra_backend(std::string backend)
135{
136 if (backend == "uBLAS")
137 {
138 return true;
139 }
140 else if (backend == "PETSc")
141 {
142#ifdef HAS_PETSC
143 return true;
144#else
145 return false;
146#endif
147 }
148 else if (backend == "Epetra")
149 {
150#ifdef HAS_TRILINOS
151 return true;
152#else
153 return false;
154#endif
155 }
156 else if (backend == "MTL4")
157 {
158#ifdef HAS_MTL4
159 return true;
160#else
161 return false;
162#endif
163 }
164 else if (backend == "STL")
165 {
166 return true;
167 }
168 return false;
169}
170
0171
=== modified file 'dolfin/common/defines.h'
--- dolfin/common/defines.h 2011-10-10 00:06:19 +0000
+++ dolfin/common/defines.h 2011-10-16 00:46:23 +0000
@@ -19,153 +19,45 @@
19// First added: 2009-09-0319// First added: 2009-09-03
20// Last changed: 2011-10-0920// Last changed: 2011-10-09
2121
22#ifndef __DOLFIN_DEFINES_H
23#define __DOLFIN_DEFINES_H
24
22#include <string>25#include <string>
2326
24// Return true if DOLFIN is compiled with OpenMP27// Return true if DOLFIN is compiled with OpenMP
25bool has_openmp()28bool has_openmp();
26{
27#ifdef HAS_OPENMP
28 return true;
29#else
30 return false;
31#endif
32}
3329
34// Return true if DOLFIN is compiled with MPI30// Return true if DOLFIN is compiled with MPI
35bool has_mpi()31bool has_mpi();
36{
37#ifdef HAS_MPI
38 return true;
39#else
40 return false;
41#endif
42}
4332
44// Return true if DOLFIN is compiled with SLEPc33// Return true if DOLFIN is compiled with SLEPc
45bool has_slepc()34bool has_slepc();
46{
47#ifdef HAS_SLEPC
48 return true;
49#else
50 return false;
51#endif
52}
5335
54// Return true if DOLFIN is compiled with Trilinos36// Return true if DOLFIN is compiled with Trilinos
55bool has_trilinos()37bool has_trilinos();
56{
57#ifdef HAS_TRILINOS
58 return true;
59#else
60 return false;
61#endif
62}
6338
64// Return true if DOLFIN is compiled with Scotch39// Return true if DOLFIN is compiled with Scotch
65bool has_scotch()40bool has_scotch();
66{
67#ifdef HAS_SCOTCH
68 return true;
69#else
70 return false;
71#endif
72}
7341
74// Return true if DOLFIN is compiled with CGAL42// Return true if DOLFIN is compiled with CGAL
75bool has_cgal()43bool has_cgal();
76{
77#ifdef HAS_CGAL
78 return true;
79#else
80 return false;
81#endif
82}
8344
84// Return true if DOLFIN is compiled with Umfpack45// Return true if DOLFIN is compiled with Umfpack
85bool has_umfpack()46bool has_umfpack();
86{
87#ifdef HAS_UMFPACK
88 return true;
89#else
90 return false;
91#endif
92}
9347
94// Return true if DOLFIN is compiled with Cholmod48// Return true if DOLFIN is compiled with Cholmod
95bool has_cholmod()49bool has_cholmod();
96{
97#ifdef HAS_CHOLMOD
98 return true;
99#else
100 return false;
101#endif
102}
10350
104// Return true if DOLFIN is compiled with parmetis51// Return true if DOLFIN is compiled with parmetis
105bool has_parmetis()52bool has_parmetis();
106{
107#ifdef HAS_PARMETIS
108 return true;
109#else
110 return false;
111#endif
112}
11353
114// Return true if DOLFIN is compiled with GMP54// Return true if DOLFIN is compiled with GMP
115bool has_gmp()55bool has_gmp();
116{
117#ifdef HAS_GMP
118 return true;
119#else
120 return false;
121#endif
122}
12356
124// Return true if DOLFIN is compiled with ZLIB57// Return true if DOLFIN is compiled with ZLIB
125bool has_zlib()58bool has_zlib();
126{
127#ifdef HAS_ZLIB
128 return true;
129#else
130 return false;
131#endif
132}
13359
134// Return true if a specific linear algebra backend is supported60// Return true if a specific linear algebra backend is supported
135bool has_linear_algebra_backend(std::string backend)61bool has_linear_algebra_backend(std::string backend);
136{
137 if (backend == "uBLAS")
138 {
139 return true;
140 }
141 else if (backend == "PETSc")
142 {
143#ifdef HAS_PETSC
144 return true;
145#else
146 return false;
147#endif
148 }
149 else if (backend == "Epetra")
150 {
151#ifdef HAS_TRILINOS
152 return true;
153#else
154 return false;
155#endif
156 }
157 else if (backend == "MTL4")
158 {
159#ifdef HAS_MTL4
160 return true;
161#else
162 return false;
163#endif
164 }
165 else if (backend == "STL")
166 {
167 return true;
168 }
169 return false;
170}
17162
63#endif
17264
=== modified file 'site-packages/dolfin_utils/meshconvert.py'
--- site-packages/dolfin_utils/meshconvert.py 2011-07-11 15:55:33 +0000
+++ site-packages/dolfin_utils/meshconvert.py 2011-10-16 00:46:23 +0000
@@ -742,7 +742,7 @@
742def write_header_meshfunction(ofile, dimensions, size):742def write_header_meshfunction(ofile, dimensions, size):
743 header = """<?xml version="1.0" encoding="UTF-8"?>743 header = """<?xml version="1.0" encoding="UTF-8"?>
744<dolfin xmlns:dolfin="http://www.fenics.org/dolfin/">744<dolfin xmlns:dolfin="http://www.fenics.org/dolfin/">
745 <meshfunction type="uint" dim="%d" size="%d">745 <mesh_function type="uint" dim="%d" size="%d">
746""" % (dimensions, size)746""" % (dimensions, size)
747 ofile.write(header)747 ofile.write(header)
748748
@@ -751,7 +751,7 @@
751""" % (index, value))751""" % (index, value))
752752
753def write_footer_meshfunction(ofile):753def write_footer_meshfunction(ofile):
754 ofile.write(""" </meshfunction>754 ofile.write(""" </mesh_function>
755</dolfin>""")755</dolfin>""")
756756
757def diffpack2xml(ifilename, ofilename):757def diffpack2xml(ifilename, ofilename):
@@ -763,9 +763,9 @@
763 meshfunction_header = """\763 meshfunction_header = """\
764<?xml version="1.0" encoding="UTF-8"?>\n764<?xml version="1.0" encoding="UTF-8"?>\n
765<dolfin xmlns:dolfin="http://www.fenics.org/dolfin/">765<dolfin xmlns:dolfin="http://www.fenics.org/dolfin/">
766 <meshfunction type="uint" dim="%d" size="%d">\n"""766 <mesh_function type="uint" dim="%d" size="%d">\n"""
767 meshfunction_entity = " <entity index=\"%d\" value=\"%d\"/>\n"767 meshfunction_entity = " <entity index=\"%d\" value=\"%d\"/>\n"
768 meshfunction_footer = " </meshfunction>\n</dolfin>"768 meshfunction_footer = " </mesh_function>\n</dolfin>"
769769
770 # Open files770 # Open files
771 ifile = open(ifilename, "r")771 ifile = open(ifilename, "r")

Subscribers

People subscribed via source and target branches