doc_sparse_macro_node_update.cc
Go to the documentation of this file.
1 //LIC// ====================================================================
2 //LIC// This file forms part of oomph-lib, the object-oriented,
3 //LIC// multi-physics finite-element library, available
4 //LIC// at http://www.oomph-lib.org.
5 //LIC//
6 //LIC// Version 1.0; svn revision $LastChangedRevision$
7 //LIC//
8 //LIC// $LastChangedDate$
9 //LIC//
10 //LIC// Copyright (C) 2006-2016 Matthias Heil and Andrew Hazel
11 //LIC//
12 //LIC// This library is free software; you can redistribute it and/or
13 //LIC// modify it under the terms of the GNU Lesser General Public
14 //LIC// License as published by the Free Software Foundation; either
15 //LIC// version 2.1 of the License, or (at your option) any later version.
16 //LIC//
17 //LIC// This library is distributed in the hope that it will be useful,
18 //LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
19 //LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 //LIC// Lesser General Public License for more details.
21 //LIC//
22 //LIC// You should have received a copy of the GNU Lesser General Public
23 //LIC// License along with this library; if not, write to the Free Software
24 //LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 //LIC// 02110-1301 USA.
26 //LIC//
27 //LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
28 //LIC//
29 //LIC//====================================================================
30 // Doc sparse MacroElement-based node update
31 
32 
33 // Generic oomph-lib headers
34 #include "generic.h"
35 
36 // The Poisson equations
37 #include "poisson.h"
38 
39 // The fish mesh
40 #include "meshes/fish_mesh.h"
41 
42 // Circle as generalised element:
44 
45 using namespace std;
46 
47 using namespace oomph;
48 
49 //==================start_of_main=========================================
50 /// Driver to document sparse MacroElement-based node update.
51 //========================================================================
52 int main()
53 {
54 
55  // Shorthand for element type
56  typedef MacroElementNodeUpdateElement<RefineableQPoissonElement<2,3> >
57  ELEMENT;
58 
59  // Set coordinates and radius for the circle that will become the fish back
60  double x_c=0.5;
61  double y_c=-0.2;
62  double r_back=1.0;
63 
64  // Build geometric object that will become the fish back
65  ElasticallySupportedRingElement* Fish_back_pt=
66  new ElasticallySupportedRingElement(x_c,y_c,r_back);
67 
68  // Build fish mesh with geometric object that specifies the fish back
69  MacroElementNodeUpdateRefineableFishMesh<ELEMENT>* Fish_mesh_pt=new
70  MacroElementNodeUpdateRefineableFishMesh<ELEMENT>(Fish_back_pt);
71 
72 
73 
74  // Number of plot points in each coordinate direction.
75  unsigned npts=11;
76 
77  ofstream some_file;
78  char filename[100];
79 
80  // Output initial mesh
81  unsigned count=0;
82  sprintf(filename,"RESLT/soln%i.dat",count);
83  some_file.open(filename);
84  Fish_mesh_pt->output(some_file,npts);
85  some_file.close();
86  count++;
87 
88 
89 
90  // Increment y_c
91  Fish_back_pt->y_c()+=0.2;
92 
93 
94 
95  // Adjust each node in turn and doc
96  unsigned nnod=Fish_mesh_pt->nnode();
97  for (unsigned i=0;i<nnod;i++)
98  {
99  // Update individual nodal position
100  Fish_mesh_pt->node_pt(i)->node_update();
101 
102  // Doc mesh
103  sprintf(filename,"RESLT/soln%i.dat",count);
104  some_file.open(filename);
105  Fish_mesh_pt->output(some_file,npts);
106  some_file.close();
107  count++;
108  }
109 
110 } // end of main
111 
112 
int main()
Driver to document sparse MacroElement-based node update.
Definition: circle.h:37
double & y_c()
Access function to y-coordinate of centre of circle.
Definition: circle.h:212
GeneralCircle "upgraded" to a GeneralisedElement: Circular ring whose position is given by The ring...