--- Begin Message ---
------------------------------------------------------------
revno: 5688
committer: Garth N. Wells <gnw20@xxxxxxxxx>
branch nick: dolfin-all
timestamp: Wed 2011-02-23 16:14:43 +0000
message:
Rename and remove some functions in GenericDofMap.
modified:
demo/undocumented/spatial-coordinates/python/demo.py
dolfin/adaptivity/Extrapolation.cpp
dolfin/fem/BoundaryCondition.cpp
dolfin/fem/DirichletBC.cpp
dolfin/fem/DofMap.cpp
dolfin/fem/DofMap.h
dolfin/fem/DofMapBuilder.cpp
dolfin/fem/GenericDofMap.h
dolfin/fem/OpenMpAssembler.cpp
dolfin/fem/SystemAssembler.cpp
dolfin/fem/UFC.cpp
dolfin/fem/UFC.h
dolfin/function/Function.cpp
dolfin/function/FunctionSpace.cpp
dolfin/io/RAWFile.cpp
dolfin/io/VTKFile.cpp
dolfin/io/VTKWriter.cpp
dolfin/la/GenericTensor.h
--
lp:dolfin
https://code.launchpad.net/~dolfin-core/dolfin/main
Your team DOLFIN Core Team is subscribed to branch lp:dolfin.
To unsubscribe from this branch go to https://code.launchpad.net/~dolfin-core/dolfin/main/+edit-subscription
=== modified file 'demo/undocumented/spatial-coordinates/python/demo.py'
--- demo/undocumented/spatial-coordinates/python/demo.py 2010-07-16 20:12:16 +0000
+++ demo/undocumented/spatial-coordinates/python/demo.py 2011-02-23 16:14:43 +0000
@@ -23,6 +23,10 @@
from dolfin import *
+# Form compiler options
+parameters["form_compiler"]["optimize"] = True
+parameters["form_compiler"]["cpp_optimize"] = True
+
# Create mesh and define function space
mesh = UnitSquare(32, 32)
V = FunctionSpace(mesh, "CG", 1)
=== modified file 'dolfin/adaptivity/Extrapolation.cpp'
--- dolfin/adaptivity/Extrapolation.cpp 2010-12-31 01:43:55 +0000
+++ dolfin/adaptivity/Extrapolation.cpp 2011-02-23 16:14:43 +0000
@@ -59,7 +59,7 @@
coefficients.resize(W.dim());
// Local array for dof indices
- std::vector<uint> dofs(W.dofmap().max_local_dimension());
+ std::vector<uint> dofs(W.dofmap().max_cell_dimension());
// Iterate over cells in mesh
for (CellIterator cell0(mesh); !cell0.end(); ++cell0)
@@ -124,11 +124,11 @@
arma::Col<double> x = arma::solve(A, b);
// Insert resulting coefficients into global coefficient vector
- for (uint i = 0; i < W.dofmap().dimension(cell0.index()); ++i)
+ for (uint i = 0; i < W.dofmap().cell_dimension(cell0.index()); ++i)
coefficients[dofs[i + offset]].push_back(x[i]);
// Increase offset
- offset += W.dofmap().dimension(cell0.index());
+ offset += W.dofmap().cell_dimension(cell0.index());
}
//-----------------------------------------------------------------------------
void Extrapolation::build_unique_dofs(std::set<uint>& unique_dofs,
@@ -198,13 +198,13 @@
uint& row,
std::set<uint>& unique_dofs)
{
- std::vector<uint> dofs(V.dofmap().dimension(cell.index()));
+ std::vector<uint> dofs(V.dofmap().cell_dimension(cell.index()));
V.dofmap().tabulate_dofs(&dofs[0], cell);
// Data structure for current cell
std::map<uint, uint> dof2row;
- for (uint i = 0; i < V.dofmap().dimension(cell.index()); ++i)
+ for (uint i = 0; i < V.dofmap().cell_dimension(cell.index()); ++i)
{
// Ignore if this degree of freedom is already considered
if (unique_dofs.find(dofs[i]) != unique_dofs.end())
=== modified file 'dolfin/fem/BoundaryCondition.cpp'
--- dolfin/fem/BoundaryCondition.cpp 2010-12-28 21:46:26 +0000
+++ dolfin/fem/BoundaryCondition.cpp 2011-02-23 16:14:43 +0000
@@ -80,10 +80,10 @@
//-----------------------------------------------------------------------------
BoundaryCondition::LocalData::LocalData(const FunctionSpace& V)
: n(0), w(0), cell_dofs(0), facet_dofs(0),
- array_coordinates(V.dofmap().max_local_dimension())
+ array_coordinates(V.dofmap().max_cell_dimension())
{
// Create array for coefficients
- n = V.dofmap().max_local_dimension();
+ n = V.dofmap().max_cell_dimension();
w = new double[n];
for (uint i = 0; i < n; i++)
w[i] = 0.0;
=== modified file 'dolfin/fem/DirichletBC.cpp'
--- dolfin/fem/DirichletBC.cpp 2011-02-17 08:50:35 +0000
+++ dolfin/fem/DirichletBC.cpp 2011-02-23 16:14:43 +0000
@@ -747,7 +747,7 @@
dofmap.tabulate_coordinates(data.coordinates, ufc_cell);
// Loop over all dofs on cell
- for (uint i = 0; i < dofmap.dimension(c->index()); ++i)
+ for (uint i = 0; i < dofmap.cell_dimension(c->index()); ++i)
{
// Check if the coordinates are on current facet and thus on boundary
if (!on_facet(data.coordinates[i], facet))
@@ -800,7 +800,7 @@
bool already_interpolated = false;
// Loop all dofs on cell
- for (uint i = 0; i < dofmap.dimension(cell->index()); ++i)
+ for (uint i = 0; i < dofmap.cell_dimension(cell->index()); ++i)
{
// Check if the coordinates are part of the sub domain (calls user-defined 'indside' function)
if (!user_sub_domain->inside(data.array_coordinates[i], false))
=== modified file 'dolfin/fem/DofMap.cpp'
--- dolfin/fem/DofMap.cpp 2011-02-23 12:46:02 +0000
+++ dolfin/fem/DofMap.cpp 2011-02-23 16:14:43 +0000
@@ -7,7 +7,7 @@
// Modified by Niclas Jansson, 2009
//
// First added: 2007-03-01
-// Last changed: 2011-02-21
+// Last changed: 2011-02-23
#include <dolfin/common/NoDeleter.h>
#include <dolfin/common/Set.h>
@@ -93,12 +93,6 @@
// Do nothing
}
//-----------------------------------------------------------------------------
-std::string DofMap::signature() const
-{
- error("DofMap has been re-ordered. Cannot return signature string.");
- return _ufc_dofmap->signature();
-}
-//-----------------------------------------------------------------------------
bool DofMap::needs_mesh_entities(unsigned int d) const
{
assert(_ufc_dofmap);
@@ -112,22 +106,13 @@
return _ufc_dofmap->global_dimension();
}
//-----------------------------------------------------------------------------
-unsigned int DofMap::local_dimension() const
-{
- //return (_ownership_range.second - _ownership_range.first) + _off_process_owner.size();
-
- // FIXME: This is inelgant and expensize. Need to use _local_dimension and
- // make sure that it's handled correctly with sub-dofmaps
-
- return this->dofs().size();
-}
-//-----------------------------------------------------------------------------
-unsigned int DofMap::dimension(uint cell_index) const
-{
+unsigned int DofMap::cell_dimension(uint cell_index) const
+{
+ assert(cell_index < dofmap.size());
return dofmap[cell_index].size();
}
//-----------------------------------------------------------------------------
-unsigned int DofMap::max_local_dimension() const
+unsigned int DofMap::max_cell_dimension() const
{
assert( _ufc_dofmap);
return _ufc_dofmap->max_local_dimension();
@@ -278,7 +263,7 @@
UFCCell ufc_cell(dolfin_mesh);
// Build UFC-to-actual-dofs map
- std::vector<uint> ufc_dofs(collapsed_dofmap->max_local_dimension());
+ std::vector<uint> ufc_dofs(collapsed_dofmap->max_cell_dimension());
for (CellIterator cell(dolfin_mesh); !cell.end(); ++cell)
{
ufc_cell.update(*cell);
=== modified file 'dolfin/fem/DofMap.h'
--- dolfin/fem/DofMap.h 2011-02-23 12:46:02 +0000
+++ dolfin/fem/DofMap.h 2011-02-23 16:14:43 +0000
@@ -6,7 +6,7 @@
// Modified by Ola Skavhaug, 2009
//
// First added: 2007-03-01
-// Last changed: 2011-02-21
+// Last changed: 2011-02-23
#ifndef __DOF_MAP_H
#define __DOF_MAP_H
@@ -63,25 +63,18 @@
bool is_view() const
{ return _is_view; }
- /// Return a string identifying the dof map
- std::string signature() const;
-
/// Return true iff mesh entities of topological dimension d are needed
bool needs_mesh_entities(unsigned int d) const;
/// Return the dimension of the global finite element function space
unsigned int global_dimension() const;
- /// Return the dimension of the local (process) finite element function
- // space
- unsigned int local_dimension() const;
-
/// Return the dimension of the local finite element function space on a
// cell
- unsigned int dimension(uint cell_index) const;
+ unsigned int cell_dimension(uint cell_index) const;
/// Return the maximum dimension of the local finite element function space
- unsigned int max_local_dimension() const;
+ unsigned int max_cell_dimension() const;
// Return the geometric dimension of the coordinates this dof map provides
unsigned int geometric_dimension() const;
@@ -126,7 +119,7 @@
DofMap* extract_sub_dofmap(const std::vector<uint>& component,
const Mesh& dolfin_mesh) const;
- /// "Collapse" a sub dofmap
+ /// Create a "collapsed" dofmap (collapses a sub-dofmap)
DofMap* collapse(std::map<uint, uint>& collapsed_map,
const Mesh& dolfin_mesh) const;
@@ -163,7 +156,7 @@
const ufc::mesh ufc_mesh,
const Mesh& dolfin_mesh);
- // Dof map (dofs for cell dofmap[i])
+ // Local-to-global dof map (dofs for cell dofmap[i])
std::vector<std::vector<dolfin::uint> > dofmap;
// Map from UFC dof numbering to renumbered dof (ufc_dof, actual_dof)
=== modified file 'dolfin/fem/DofMapBuilder.cpp'
--- dolfin/fem/DofMapBuilder.cpp 2011-01-03 18:37:41 +0000
+++ dolfin/fem/DofMapBuilder.cpp 2011-02-23 16:14:43 +0000
@@ -138,7 +138,7 @@
for (CellIterator cell(mesh); !cell.end(); ++cell)
{
const std::vector<uint>& cell_dofs = dofmap.cell_dofs(cell->index());
- const uint cell_dimension = dofmap.dimension(cell->index());
+ const uint cell_dimension = dofmap.cell_dimension(cell->index());
for (uint i = 0; i < cell_dimension; ++i)
{
// Mark dof as owned if in unowned set
@@ -238,7 +238,7 @@
for (CellIterator cell(mesh); !cell.end(); ++cell)
{
const uint cell_index = cell->index();
- const uint cell_dimension = dofmap.dimension(cell_index);
+ const uint cell_dimension = dofmap.cell_dimension(cell_index);
// Resize cell map and insert dofs
new_dofmap[cell_index].resize(cell_dimension);
=== modified file 'dolfin/fem/GenericDofMap.h'
--- dolfin/fem/GenericDofMap.h 2011-02-23 12:46:02 +0000
+++ dolfin/fem/GenericDofMap.h 2011-02-23 16:14:43 +0000
@@ -1,8 +1,8 @@
-// Copyright (C) 2010 Anders Logg and Garth N. Wells.
+// Copyright (C) 2010-2011 Anders Logg and Garth N. Wells.
// Licensed under the GNU LGPL Version 2.1.
//
// First added: 2010-05-26
-// Last changed:
+// Last changed: 2011-02-23
#ifndef __GENERIC_DOF_MAP_H
#define __GENERIC_DOF_MAP_H
@@ -37,24 +37,18 @@
/// True if dof map is a view into another map (is a sub-dofmap)
virtual bool is_view() const = 0;
- /// Return a string identifying the dof map
- virtual std::string signature() const = 0;
-
/// Return true iff mesh entities of topological dimension d are needed
virtual bool needs_mesh_entities(unsigned int d) const = 0;
/// Return the dimension of the global finite element function space
virtual unsigned int global_dimension() const = 0;
- /// Return the dimension of the local (process) finite element function space
- virtual unsigned int local_dimension() const = 0;
-
/// Return the dimension of the local finite element function space on a
/// cell
- virtual unsigned int dimension(uint index) const = 0;
+ virtual unsigned int cell_dimension(uint index) const = 0;
/// Return the maximum dimension of the local finite element function space
- virtual unsigned int max_local_dimension() const = 0;
+ virtual unsigned int max_cell_dimension() const = 0;
// Return the geometric dimension of the coordinates this dof map provides
virtual unsigned int geometric_dimension() const = 0;
@@ -89,7 +83,7 @@
virtual GenericDofMap* extract_sub_dofmap(const std::vector<uint>& component,
const Mesh& dolfin_mesh) const = 0;
- /// "Collapse" a sub dofmap
+ /// Create a "collapsed" a dofmap (collapses a sub-dofmap)
virtual GenericDofMap* collapse(std::map<uint, uint>& collapsed_map,
const Mesh& dolfin_mesh) const = 0;
=== modified file 'dolfin/fem/OpenMpAssembler.cpp'
--- dolfin/fem/OpenMpAssembler.cpp 2011-02-21 14:13:16 +0000
+++ dolfin/fem/OpenMpAssembler.cpp 2011-02-23 16:14:43 +0000
@@ -320,7 +320,7 @@
}
// Update to current cell
- ufc.update_new(cell);
+ ufc.update(cell);
// Get local-to-global dof maps for cell
for (uint i = 0; i < form_rank; ++i)
=== modified file 'dolfin/fem/SystemAssembler.cpp'
--- dolfin/fem/SystemAssembler.cpp 2011-02-21 14:13:16 +0000
+++ dolfin/fem/SystemAssembler.cpp 2011-02-23 16:14:43 +0000
@@ -631,11 +631,11 @@
//-----------------------------------------------------------------------------
SystemAssembler::Scratch::Scratch(const Form& a, const Form& L)
{
- uint A_num_entries = a.function_space(0)->dofmap().max_local_dimension();
- A_num_entries *= a.function_space(1)->dofmap().max_local_dimension();
+ uint A_num_entries = a.function_space(0)->dofmap().max_cell_dimension();
+ A_num_entries *= a.function_space(1)->dofmap().max_cell_dimension();
Ae.resize(A_num_entries);
- be.resize(L.function_space(0)->dofmap().max_local_dimension());
+ be.resize(L.function_space(0)->dofmap().max_cell_dimension());
}
//-----------------------------------------------------------------------------
SystemAssembler::Scratch::~Scratch()
=== modified file 'dolfin/fem/UFC.cpp'
--- dolfin/fem/UFC.cpp 2011-02-21 14:13:16 +0000
+++ dolfin/fem/UFC.cpp 2011-02-23 16:14:43 +0000
@@ -61,28 +61,28 @@
for (uint i = 0; i < this->form.num_coefficients(); i++)
{
boost::shared_ptr<ufc::finite_element> element(this->form.create_finite_element(this->form.rank() + i));
- coefficient_elements.push_back( FiniteElement(element) );
+ coefficient_elements.push_back(FiniteElement(element));
}
// Create cell integrals
for (uint i = 0; i < this->form.num_cell_domains(); i++)
- cell_integrals.push_back( boost::shared_ptr<ufc::cell_integral>(this->form.create_cell_integral(i)) );
+ cell_integrals.push_back(boost::shared_ptr<ufc::cell_integral>(this->form.create_cell_integral(i)));
// Create exterior facet integrals
for (uint i = 0; i < this->form.num_exterior_facet_domains(); i++)
- exterior_facet_integrals.push_back( boost::shared_ptr<ufc::exterior_facet_integral>(this->form.create_exterior_facet_integral(i)) );
+ exterior_facet_integrals.push_back(boost::shared_ptr<ufc::exterior_facet_integral>(this->form.create_exterior_facet_integral(i)));
// Create interior facet integrals
for (uint i = 0; i < this->form.num_interior_facet_domains(); i++)
- interior_facet_integrals.push_back( boost::shared_ptr<ufc::interior_facet_integral>(this->form.create_interior_facet_integral(i)) );
+ interior_facet_integrals.push_back(boost::shared_ptr<ufc::interior_facet_integral>(this->form.create_interior_facet_integral(i)));
// Get maximum local dimensions
std::vector<uint> max_local_dimension;
std::vector<uint> max_macro_local_dimension;
for (uint i = 0; i < this->form.rank(); i++)
{
- max_local_dimension.push_back(V[i]->dofmap().max_local_dimension());
- max_macro_local_dimension.push_back(2*V[i]->dofmap().max_local_dimension());
+ max_local_dimension.push_back(V[i]->dofmap().max_cell_dimension());
+ max_macro_local_dimension.push_back(2*V[i]->dofmap().max_cell_dimension());
}
// Initialize local tensor
@@ -112,16 +112,6 @@
}
}
//-----------------------------------------------------------------------------
-void UFC::update_new(const Cell& cell)
-{
- // Update UFC cell
- this->cell.update(cell);
-
- // Restrict coefficients to cell
- for (uint i = 0; i < coefficients.size(); ++i)
- coefficients[i]->restrict(w[i], coefficient_elements[i], cell, this->cell);
-}
-//-----------------------------------------------------------------------------
void UFC::update(const Cell& cell)
{
// Update UFC cell
=== modified file 'dolfin/fem/UFC.h'
--- dolfin/fem/UFC.h 2011-01-31 17:42:02 +0000
+++ dolfin/fem/UFC.h 2011-02-23 16:14:43 +0000
@@ -48,9 +48,6 @@
void init(const Form& form);
/// Update current cell
- void update_new(const Cell& cell);
-
- /// Update current cell
void update(const Cell& cell);
/// Update current cell and facet
=== modified file 'dolfin/function/Function.cpp'
--- dolfin/function/Function.cpp 2011-02-23 13:04:03 +0000
+++ dolfin/function/Function.cpp 2011-02-23 16:14:43 +0000
@@ -164,9 +164,11 @@
}
else
{
+
// Create collapsed dof map
+ const GenericDofMap& v_dofmap = v._function_space->dofmap();
std::map<uint, uint> collapsed_map;
- boost::shared_ptr<GenericDofMap> collapsed_dofmap(v._function_space->dofmap().collapse(collapsed_map, v._function_space->mesh()));
+ boost::shared_ptr<GenericDofMap> collapsed_dofmap(v_dofmap.collapse(collapsed_map, v._function_space->mesh()));
// Create new FunctionsSpapce
_function_space = v._function_space->collapse_sub_space(collapsed_dofmap);
=== modified file 'dolfin/function/FunctionSpace.cpp'
--- dolfin/function/FunctionSpace.cpp 2011-02-03 22:29:02 +0000
+++ dolfin/function/FunctionSpace.cpp 2011-02-23 16:14:43 +0000
@@ -11,7 +11,6 @@
// Last changed: 2011-02-03
#include <iostream>
-#include <boost/scoped_array.hpp>
#include <dolfin/common/utils.h>
#include <dolfin/common/MPI.h>
@@ -129,9 +128,7 @@
expansion_coefficients.zero();
// Initialize local arrays
- const uint max_local_dimension = _dofmap->max_local_dimension();
- boost::scoped_array<double> cell_coefficients(new double[max_local_dimension]);
- boost::scoped_array<uint> cell_dofs(new uint[max_local_dimension]);
+ std::vector<double> cell_coefficients(_dofmap->max_cell_dimension());
// Iterate over mesh and interpolate on each cell
UFCCell ufc_cell(*_mesh);
@@ -141,15 +138,15 @@
ufc_cell.update(*cell);
// Restrict function to cell
- v.restrict(cell_coefficients.get(), this->element(), *cell, ufc_cell);
+ v.restrict(&cell_coefficients[0], this->element(), *cell, ufc_cell);
// Tabulate dofs
- _dofmap->tabulate_dofs(cell_dofs.get(), *cell);
+ const std::vector<uint>& cell_dofs = _dofmap->cell_dofs(cell->index());
// Copy dofs to vector
- expansion_coefficients.set(cell_coefficients.get(),
- _dofmap->dimension(cell->index()),
- cell_dofs.get());
+ expansion_coefficients.set(&cell_coefficients[0],
+ _dofmap->cell_dimension(cell->index()),
+ &cell_dofs[0]);
}
// Finalise changes
@@ -235,7 +232,7 @@
{
for (CellIterator cell(*_mesh); !cell.end(); ++cell)
{
- const uint n = _dofmap->dimension(cell->index());
+ const uint n = _dofmap->cell_dimension(cell->index());
std::vector<uint> dofs(n);
_dofmap->tabulate_dofs(&dofs[0], *cell);
=== modified file 'dolfin/io/RAWFile.cpp'
--- dolfin/io/RAWFile.cpp 2010-09-03 20:14:27 +0000
+++ dolfin/io/RAWFile.cpp 2011-02-23 16:14:43 +0000
@@ -88,7 +88,7 @@
uint cell_based_dim = 1;
for (uint i = 0; i < rank; i++)
cell_based_dim *= mesh.topology().dim();
- if (dofmap.max_local_dimension() == cell_based_dim)
+ if (dofmap.max_cell_dimension() == cell_based_dim)
data_type = "cell";
// Open file
=== modified file 'dolfin/io/VTKFile.cpp'
--- dolfin/io/VTKFile.cpp 2011-01-02 21:33:14 +0000
+++ dolfin/io/VTKFile.cpp 2011-02-23 16:14:43 +0000
@@ -220,7 +220,7 @@
cell_based_dim *= mesh.topology().dim();
const GenericDofMap& dofmap(u.function_space().dofmap());
- if (dofmap.max_local_dimension() == cell_based_dim)
+ if (dofmap.max_cell_dimension() == cell_based_dim)
VTKWriter::write_cell_data(u, vtu_filename, binary, compress);
else
write_point_data(u, mesh, vtu_filename);
@@ -442,7 +442,7 @@
uint cell_based_dim = 1;
for (uint i = 0; i < rank; i++)
cell_based_dim *= mesh.topology().dim();
- if (dofmap.max_local_dimension() == cell_based_dim)
+ if (dofmap.max_cell_dimension() == cell_based_dim)
data_type = "cell";
// Write file
=== modified file 'dolfin/io/VTKWriter.cpp'
--- dolfin/io/VTKWriter.cpp 2010-12-31 01:43:55 +0000
+++ dolfin/io/VTKWriter.cpp 2011-02-23 16:14:43 +0000
@@ -82,7 +82,7 @@
// Allocate memory for function values at cell centres
const uint size = mesh.num_cells()*dim;
- std::vector<uint> dofs(dofmap.max_local_dimension());
+ std::vector<uint> dofs(dofmap.max_cell_dimension());
// Build lists of dofs and create map
std::vector<uint> dof_set;
@@ -92,11 +92,11 @@
{
// Tabulate dofs
dofmap.tabulate_dofs(&dofs[0], *cell);
- for(uint i = 0; i < dofmap.dimension(cell->index()); ++i)
+ for(uint i = 0; i < dofmap.cell_dimension(cell->index()); ++i)
dof_set.push_back(dofs[i]);
// Add local dimension to cell offset and increment
- *(cell_offset + 1) = *(cell_offset) + dofmap.dimension(cell->index());
+ *(cell_offset + 1) = *(cell_offset) + dofmap.cell_dimension(cell->index());
++cell_offset;
}
=== modified file 'dolfin/la/GenericTensor.h'
--- dolfin/la/GenericTensor.h 2011-01-02 21:33:14 +0000
+++ dolfin/la/GenericTensor.h 2011-02-23 16:14:43 +0000
@@ -65,14 +65,6 @@
virtual void add(const double* block,
const std::vector<std::vector<uint> >& rows) = 0;
- /// Get block of values
- //virtual void get(double* block, const uint* num_rows,
- // const uint * const * rows) const = 0;
-
- /// Set block of values
- //virtual void set(const double* block, const uint* num_rows,
- // const uint * const * rows) = 0;
-
/// Add block of values
virtual void add(const double* block, const uint* num_rows,
const uint * const * rows) = 0;
--- End Message ---