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