The Conley-Morse Graphs Software
m_periodic.h
Go to the documentation of this file.
1/////////////////////////////////////////////////////////////////////////////
2///
3/// @file m_periodic.h
4///
5/// A sample silly periodic map.
6///
7/// This is a sample periodic map on a multi-dimensional torus
8/// which may be used for testing the capability of the software
9/// to deal with periodic boundary conditions.
10///
11/// @author Pawel Pilarczyk
12///
13/////////////////////////////////////////////////////////////////////////////
14
15// Copyright (C) 1997-2014 by Pawel Pilarczyk.
16//
17// This file is part of my research software package. This is free software:
18// you can redistribute it and/or modify it under the terms of the GNU
19// General Public License as published by the Free Software Foundation,
20// either version 3 of the License, or (at your option) any later version.
21//
22// This software is distributed in the hope that it will be useful,
23// but WITHOUT ANY WARRANTY; without even the implied warranty of
24// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25// GNU General Public License for more details.
26//
27// You should have received a copy of the GNU General Public License
28// along with this software; see the file "license.txt". If not,
29// please, see <https://www.gnu.org/licenses/>.
30
31// Started on October 3, 2008. Last revision: October 3, 2008.
32
33
34#ifndef _CMGRAPHS_PERIODIC_H_
35#define _CMGRAPHS_PERIODIC_H_
36
37
38// include local header files
39#include "maptype.h"
40#include "typeintv.h"
41
42
43// --------------------------------------------------
44// ---------- a sample silly periodic map -----------
45// --------------------------------------------------
46
47/// This class defines a sample periodic map on a multi-dimensional torus
48/// which may be used for testing the capability of the software
49/// to deal with periodic boundary conditions.
50/// The map is defined on the interval [0,1].
51class MapPeriodic: public MapType
52{
53public:
54 /// The default constructor.
55 MapPeriodic ();
56
57 /// Computes the image of a box whose left and right coordinates
58 /// are given. Fills in the images with the left and right
59 /// coordinates of the image box.
60 void compute (const double *xleft, const double *xright,
61 double *yleft, double *yright, int dim,
62 const spcCoord *coord, int subdiv) const;
63
64}; /* class MapPeriodic */
65
66// --------------------------------------------------
67
69{
71 return;
72} /* MapPeriodic::MapPeriodic */
73
74inline void MapPeriodic::compute (const double *xleft, const double *xright,
75 double *yleft, double *yright, int dim, const spcCoord *, int) const
76{
77 for (int i = 0; i < dim; ++ i)
78 {
79 if (xleft [i] < 0)
80 {
81 ERRORMSG << "Wrong left value: " << xleft [i] <<
82 ", should be 0.\n" << THROW
83 }
84 if (xright [i] > 1)
85 {
86 ERRORMSG << "Wrong right value: " << xright [i] <<
87 ", should be 1.\n" << THROW
88 }
89 const double shift = 0.3;
90 interval x = interval (xleft [i], xright [i]) + shift;
91 if (x. leftBound () >= 1)
92 x -= 1;
93 interval fx = 0.5 + 5 * x * (2 * x - 1) * (x - 1) - shift;
94 yleft [i] = fx. leftBound ();
95 yright [i] = fx. rightBound ();
96 }
97
98 // swich the rounding direction to the neutral one
100 return;
101} /* MapPeriodic::compute */
102
103
104#endif // _CMGRAPHS_PERIODIC_H_
105
This class defines a sample periodic map on a multi-dimensional torus which may be used for testing t...
Definition: m_periodic.h:52
void compute(const double *xleft, const double *xright, double *yleft, double *yright, int dim, const spcCoord *coord, int subdiv) const
Computes the image of a box whose left and right coordinates are given.
Definition: m_periodic.h:74
MapPeriodic()
The default constructor.
Definition: m_periodic.h:68
This is an abstract class which defines the interface to other classes that describe maps for the use...
Definition: maptype.h:59
An abstract map type.
Data types for interval arithmetic.
void resetRounding()
This function resets rounding switches of the processor and sets rounding to the nearest.
Definition: typeintv.h:65
bool testIntervals(bool throwException=false)
Testing interval arithmetic.
Definition: typeintv.h:82
int spcCoord
The type of coordinates of cubes in the phase space.
Definition: typespace.h:50