~njansson/dolfin/hpc

2632 by Kent-Andre Mardal
merge
1
// Copyright (C) 2008 Solveig Bruvoll and Anders Logg.
2
// Licensed under the GNU LGPL Version 2.1.
3
//
4
// First added:  2008-05-02
2668.1.33 by Anders Logg
ALE mesh smoothing updates
5
// Last changed: 2008-05-28
2632 by Kent-Andre Mardal
merge
6
//
7
// This demo demonstrates how to move the vertex coordinates
8
// of a boundary mesh and then updating the interior vertex
9
// coordinates of the original mesh by suitably interpolating
10
// the vertex coordinates (useful for implementation of ALE
11
// methods).
12
13
#include <dolfin.h>
14
15
using namespace dolfin;
16
17
int main()
18
{
19
  // Create mesh
2668.1.32 by Anders Logg
Remove vertex_map and cell_map from BoundaryMesh interface.
20
  UnitSquare mesh(20, 20);
2632 by Kent-Andre Mardal
merge
21
22
  // Create boundary mesh
2668.1.33 by Anders Logg
ALE mesh smoothing updates
23
  BoundaryMesh boundary(mesh);
2632 by Kent-Andre Mardal
merge
24
25
  // Move vertices in boundary
26
  for (VertexIterator v(boundary); !v.end(); ++v)
27
  {
28
    real* x = v->x();
2635.1.3 by Anders Logg
Add patch from Solveig for 2D ALE mesh movement.
29
    x[0] *= 3.0;
2668.1.32 by Anders Logg
Remove vertex_map and cell_map from BoundaryMesh interface.
30
    x[1] += 0.1*sin(5.0*x[0]);
2632 by Kent-Andre Mardal
merge
31
  }
2668.1.30 by Anders Logg
Add first version of Hermite interpolation for ALE smoothing from Solveig
32
 
2632 by Kent-Andre Mardal
merge
33
  // Move mesh
2668.1.33 by Anders Logg
ALE mesh smoothing updates
34
  mesh.move(boundary);
35
36
  // Plot mesh
2632 by Kent-Andre Mardal
merge
37
  plot(mesh);
38
39
  return 0;
40
}