circle.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-2023 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 
27 // Generic oomph-lib headers
28 #include "generic.h"
29 
30 // Circle header
31 #include "circle.h"
32 
33 using namespace std;
34 
35 using namespace oomph;
36 
37 //========================================================================
38 /// Driver
39 //========================================================================
40 int main()
41 {
42 
43  // X-coordinate of the circle's centre
44  double x_c=0.5;
45 
46  // Y-coordinate of the circle's centre
47  double y_c=1.5;
48 
49  // Radius
50  double R=0.9;
51 
52  // Build circle object with specified (const) parameters
53  //-------------------------------------------------------
54  GeneralCircle circle0(x_c,y_c,R);
55 
56 
57  // Build circle object with Data -- the Data values might be determine
58  //--------------------------------------------------------------------
59  // "somewhere else", e.g. as part of the solution of another problem
60  //------------------------------------------------------------------
61 
62  // The circle's shape is determine by a single Data object whose
63  // three values specify x_c, y_c and R:
64  Data* circle_data_pt=new Data(3);
65 
66  // Set the values
67  circle_data_pt->set_value(0,x_c);
68  circle_data_pt->set_value(1,y_c);
69  circle_data_pt->set_value(2,R);
70 
71  // Build the object
72  GeneralCircle circle1(circle_data_pt);
73 
74  // Number of plot points
75  unsigned npts=100;
76 
77  // Lagrangian coordinate and position vector (both as vectors)
78  Vector<double> xi(1);
79  Vector<double> r(2);
80 
81  // Output circles
82  ofstream some_file0, some_file1;
83  some_file0.open("circle0.dat");
84  some_file1.open("circle1.dat");
85 
86  for (unsigned i=0;i<npts;i++)
87  {
88  xi[0]=2.0*MathematicalConstants::Pi*double(i)/double(npts-1);
89  circle0.position(xi,r);
90  some_file0 << r[0] << " " << r[1] << std::endl;
91  circle1.position(xi,r);
92  some_file1 << r[0] << " " << r[1] << std::endl;
93  }
94  some_file0.close();
95  some_file1.close();
96 
97 
98 }
99 
100 
int main()
Driver.
Definition: circle.cc:40
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
Definition: circle.h:96
void position(const Vector< double > &zeta, Vector< double > &r) const
Position Vector at Lagrangian coordinate zeta.
Definition: circle.h:183
Definition: circle.h:34