Skip to content

Commit

Permalink
Merge pull request #1 from firedrakeproject/travis
Browse files Browse the repository at this point in the history
Travis for ufl
  • Loading branch information
dham committed Apr 4, 2016
2 parents a00374b + 651458e commit cc9e78a
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 15 deletions.
21 changes: 21 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
notifications:
irc:
channels: "chat.freenode.net#firedrake"
skip_join: true
on_success: change
on_failure: always
template: "%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message} | %{build_url}"

language: python
python:
- "2.7"
- "3.4"

before_install:
- pip install pytest

install:
- pip install .

script:
- py.test test/
35 changes: 20 additions & 15 deletions ufl/finiteelement/finiteelement.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@
from ufl.assertions import ufl_assert
from ufl.utils.formatting import istr
from ufl.cell import as_cell
from ufl.log import info_blue, warning, warning_blue, error

from ufl.cell import TensorProductCell
from ufl.finiteelement.elementlist import canonical_element_description, simplices
from ufl.finiteelement.finiteelementbase import FiniteElementBase


class FiniteElement(FiniteElementBase):
"The basic finite element class for all simple finite elements"
# TODO: Move these to base?
__slots__ = ("_short_name",
"_sobolev_space",
"_mapping",
)
)

def __new__(cls,
family,
Expand All @@ -52,7 +52,7 @@ def __new__(cls,
cell = as_cell(cell)

family, short_name, degree, value_shape, reference_value_shape, sobolev_space, mapping = \
canonical_element_description(family, cell, degree, form_degree)
canonical_element_description(family, cell, degree, form_degree)

if isinstance(cell, TensorProductCell):
# Delay import to avoid circular dependency at module load time
Expand Down Expand Up @@ -103,22 +103,17 @@ def __new__(cls,

elif family == "Q":
return TensorProductElement(FiniteElement("CG", cell._cells[0], degree, 0, quad_scheme),
FiniteElement("CG", cell._cells[1], degree, 0, quad_scheme),
cell)
FiniteElement("CG", cell._cells[1], degree, 0, quad_scheme),
cell)

elif family == "DQ":
family_A = "DG" if cell._cells[0].cellname() in simplices else "DQ"
family_B = "DG" if cell._cells[1].cellname() in simplices else "DQ"
return TensorProductElement(FiniteElement(family_A, cell._cells[0], degree, cell._cells[0].topological_dimension(), quad_scheme),
FiniteElement(family_B, cell._cells[1], degree, cell._cells[1].topological_dimension(), quad_scheme),
cell)
FiniteElement(family_B, cell._cells[1], degree, cell._cells[1].topological_dimension(), quad_scheme),
cell)

return super(FiniteElement, cls).__new__(cls,
family,
cell,
degree,
form_degree,
quad_scheme)
return super(FiniteElement, cls).__new__(cls)

def __init__(self,
family,
Expand Down Expand Up @@ -146,7 +141,7 @@ def __init__(self,
cell = as_cell(cell)

family, short_name, degree, value_shape, reference_value_shape, sobolev_space, mapping = \
canonical_element_description(family, cell, degree, form_degree)
canonical_element_description(family, cell, degree, form_degree)

# TODO: Move these to base? Might be better to instead simplify base though.
self._sobolev_space = sobolev_space
Expand Down Expand Up @@ -180,9 +175,19 @@ def __str__(self):
qs = self.quadrature_scheme()
qs = "" if qs is None else "(%s)" % qs
return "<%s%s%s on a %s>" % (self._short_name, istr(self.degree()),
qs, self.cell())
qs, self.cell())

def shortstr(self):
"Format as string for pretty printing."
return "%s%s(%s)" % (self._short_name, istr(self.degree()),
istr(self.quadrature_scheme()))

def __getnewargs__(self):
"""Return the arguments which pickle needs to recreate the object."""
return (
self.family(),
self.cell(),
self.degree(),
None,
self.quadrature_scheme()
)

0 comments on commit cc9e78a

Please sign in to comment.