Newer
Older
// ============================================================================
// == ==
// == AMDiS - Adaptive multidimensional simulations ==
// == ==

Thomas Witkowski
committed
// == http://www.amdis-fem.org ==
// == ==
// ============================================================================

Thomas Witkowski
committed
//
// Software License for AMDiS
//
// Copyright (c) 2010 Dresden University of Technology
// All rights reserved.
// Authors: Simon Vey, Thomas Witkowski et al.
//
// This file is part of AMDiS
//
// See also license.opensource.txt in the distribution.
/** \file BallProject.h */
#ifndef AMDIS_BALLPROJECT_H
#define AMDIS_BALLPROJECT_H
namespace AMDiS {
/** \brief
* Projects world coordinates to the surface of a ball with given center and
* radius. Can be used as boundary or volume projection.
*/
class BallProject : public Projection
{
public:
/// Constructor.
BallProject(int id,
ProjectionType type,
WorldVector<double> ¢er,
double radius)
: Projection(id, type),
center_(center),
radius_(radius)
/// Destructor.
virtual ~BallProject() {}
/// Implementation of Projection::project();
x -= center_;
double norm = sqrt(x*x);
TEST_EXIT(norm != 0.0)("can't project vector x\n");
x *= radius_ / norm;
/// Center of the ball.
WorldVector<double> center_;
/// Radius of the ball.
double radius_;
};
}
#endif