~corrado-maurini/dolfin/tao

« back to all changes in this revision

Viewing changes to demo/undocumented/lift-drag/cpp/Drag.h

  • Committer: corrado maurini
  • Date: 2012-12-18 12:16:08 UTC
  • mfrom: (6685.78.207 trunk)
  • Revision ID: corrado.maurini@upmc.fr-20121218121608-nk82ly9jgsld9u84
updating with trunk, fix uint in TAO solver and hacking the check for tao FindTAO.cmake

Show diffs side-by-side

added added

removed removed

Lines of Context:
1397
1397
  /// Return a string identifying the form
1398
1398
  virtual const char* signature() const
1399
1399
  {
1400
 
    return "b11880762fe9ba0b869c8ba8bd3bbd78006b1a55a28e47666f01447ae1caabf6a4d966f9cf6305d62d9682c9b0dc1bcd7fc886e006829b8c3014f3d7fbaa62bb";
 
1400
    return "4b4142331df1e8998a3ccf552934c272015baeac44faaed738afdfb7d0561f2f988d1b337586394104296e8d3fa2ab16da3b17ce21b9fb421a8b2f7710c62c08";
1401
1401
  }
1402
1402
 
1403
1403
  /// Return the rank of the global tensor (r)
1496
1496
 
1497
1497
// DOLFIN includes
1498
1498
#include <dolfin/common/NoDeleter.h>
 
1499
#include <dolfin/mesh/Restriction.h>
1499
1500
#include <dolfin/fem/FiniteElement.h>
1500
1501
#include <dolfin/fem/DofMap.h>
1501
1502
#include <dolfin/fem/Form.h>
1512
1513
{
1513
1514
public:
1514
1515
 
 
1516
  //--- Constructors for standard function space, 2 different versions ---
 
1517
 
 
1518
  // Create standard function space (reference version)
1515
1519
  CoefficientSpace_p(const dolfin::Mesh& mesh):
1516
1520
    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
1517
1521
                          boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new drag_finite_element_0()))),
1520
1524
    // Do nothing
1521
1525
  }
1522
1526
 
1523
 
  CoefficientSpace_p(dolfin::Mesh& mesh):
1524
 
    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
1525
 
                          boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new drag_finite_element_0()))),
1526
 
                          boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dofmap>(new drag_dofmap_0()), mesh)))
1527
 
  {
1528
 
    // Do nothing
1529
 
  }
1530
 
 
1531
 
  CoefficientSpace_p(boost::shared_ptr<dolfin::Mesh> mesh):
1532
 
    dolfin::FunctionSpace(mesh,
1533
 
                          boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new drag_finite_element_0()))),
1534
 
                          boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dofmap>(new drag_dofmap_0()), *mesh)))
1535
 
  {
1536
 
      // Do nothing
1537
 
  }
1538
 
 
 
1527
  // Create standard function space (shared pointer version)
1539
1528
  CoefficientSpace_p(boost::shared_ptr<const dolfin::Mesh> mesh):
1540
1529
    dolfin::FunctionSpace(mesh,
1541
1530
                          boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new drag_finite_element_0()))),
1542
1531
                          boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dofmap>(new drag_dofmap_0()), *mesh)))
1543
1532
  {
1544
 
      // Do nothing
1545
 
  }
1546
 
 
 
1533
    // Do nothing
 
1534
  }
 
1535
 
 
1536
  //--- Constructors for restricted function space, 2 different versions ---
 
1537
 
 
1538
  // Create restricted function space (reference version)
 
1539
  CoefficientSpace_p(const dolfin::Restriction& restriction):
 
1540
    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(restriction.mesh()),
 
1541
                          boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new drag_finite_element_0()))),
 
1542
                          boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dofmap>(new drag_dofmap_0()),
 
1543
                                                                                     reference_to_no_delete_pointer(restriction))))
 
1544
  {
 
1545
    // Do nothing
 
1546
  }
 
1547
 
 
1548
  // Create restricted function space (shared pointer version)
 
1549
  CoefficientSpace_p(boost::shared_ptr<const dolfin::Restriction> restriction):
 
1550
    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(restriction->mesh()),
 
1551
                          boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new drag_finite_element_0()))),
 
1552
                          boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dofmap>(new drag_dofmap_0()),
 
1553
                                                                                     restriction)))
 
1554
  {
 
1555
    // Do nothing
 
1556
  }
 
1557
 
 
1558
  // Copy constructor
1547
1559
  ~CoefficientSpace_p()
1548
1560
  {
1549
1561
  }
1550
1562
 
1551
1563
};
1552
1564
 
1553
 
typedef CoefficientSpace_p Form_0_FunctionSpace_0;
 
1565
typedef CoefficientSpace_p Form_M_FunctionSpace_0;
1554
1566
 
1555
 
class Form_0: public dolfin::Form
 
1567
class Form_M: public dolfin::Form
1556
1568
{
1557
1569
public:
1558
1570
 
1559
1571
  // Constructor
1560
 
  Form_0(const dolfin::Mesh& mesh):
 
1572
  Form_M(const dolfin::Mesh& mesh):
1561
1573
    dolfin::Form(0, 1), p(*this, 0)
1562
1574
  {
1563
1575
    _mesh = reference_to_no_delete_pointer(mesh);
1565
1577
  }
1566
1578
 
1567
1579
  // Constructor
1568
 
  Form_0(const dolfin::Mesh& mesh, const dolfin::GenericFunction& p):
 
1580
  Form_M(const dolfin::Mesh& mesh, const dolfin::GenericFunction& p):
1569
1581
    dolfin::Form(0, 1), p(*this, 0)
1570
1582
  {
1571
1583
    _mesh = reference_to_no_delete_pointer(mesh);
1575
1587
  }
1576
1588
 
1577
1589
  // Constructor
1578
 
  Form_0(const dolfin::Mesh& mesh, boost::shared_ptr<const dolfin::GenericFunction> p):
 
1590
  Form_M(const dolfin::Mesh& mesh, boost::shared_ptr<const dolfin::GenericFunction> p):
1579
1591
    dolfin::Form(0, 1), p(*this, 0)
1580
1592
  {
1581
1593
    _mesh = reference_to_no_delete_pointer(mesh);
1585
1597
  }
1586
1598
 
1587
1599
  // Constructor
1588
 
  Form_0(boost::shared_ptr<const dolfin::Mesh> mesh):
 
1600
  Form_M(boost::shared_ptr<const dolfin::Mesh> mesh):
1589
1601
    dolfin::Form(0, 1), p(*this, 0)
1590
1602
  {
1591
1603
    _mesh = mesh;
1593
1605
  }
1594
1606
 
1595
1607
  // Constructor
1596
 
  Form_0(boost::shared_ptr<const dolfin::Mesh> mesh, const dolfin::GenericFunction& p):
 
1608
  Form_M(boost::shared_ptr<const dolfin::Mesh> mesh, const dolfin::GenericFunction& p):
1597
1609
    dolfin::Form(0, 1), p(*this, 0)
1598
1610
  {
1599
1611
    _mesh = mesh;
1603
1615
  }
1604
1616
 
1605
1617
  // Constructor
1606
 
  Form_0(boost::shared_ptr<const dolfin::Mesh> mesh, boost::shared_ptr<const dolfin::GenericFunction> p):
 
1618
  Form_M(boost::shared_ptr<const dolfin::Mesh> mesh, boost::shared_ptr<const dolfin::GenericFunction> p):
1607
1619
    dolfin::Form(0, 1), p(*this, 0)
1608
1620
  {
1609
1621
    _mesh = mesh;
1613
1625
  }
1614
1626
 
1615
1627
  // Destructor
1616
 
  ~Form_0()
 
1628
  ~Form_M()
1617
1629
  {}
1618
1630
 
1619
1631
  /// Return the number of the coefficient with this name
1620
 
  virtual dolfin::uint coefficient_number(const std::string& name) const
 
1632
  virtual std::size_t coefficient_number(const std::string& name) const
1621
1633
  {
1622
1634
    if (name == "p")
1623
1635
      return 0;
1629
1641
  }
1630
1642
 
1631
1643
  /// Return the name of the coefficient with this number
1632
 
  virtual std::string coefficient_name(dolfin::uint i) const
 
1644
  virtual std::string coefficient_name(std::size_t i) const
1633
1645
  {
1634
1646
    switch (i)
1635
1647
    {
1644
1656
  }
1645
1657
 
1646
1658
  // Typedefs
1647
 
  typedef Form_0_FunctionSpace_0 CoefficientSpace_p;
 
1659
  typedef Form_M_FunctionSpace_0 CoefficientSpace_p;
1648
1660
 
1649
1661
  // Coefficients
1650
1662
  dolfin::CoefficientAssigner p;
1651
1663
};
1652
1664
 
1653
1665
// Class typedefs
1654
 
typedef Form_0 Functional;
 
1666
typedef Form_M Functional;
1655
1667
 
1656
1668
}
1657
1669