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