<commit_before>/*
 * lens_halos.h
 *
 *  Created on: 06.05.2013
 */

#ifndef LENS_HALOS_H_
#define LENS_HALOS_H_

//#include "standard.h"
#include "InputParams.h"
//#include "source.h"
//#include "point.h"
#include "quadTree.h"
#include "particle_types.h"
#include "image_processing.h"


/**
 * \brief A base class for all types of lensing "halos" which are any mass distribution that cause lensing.
 *
 * It contains the mass, maximum radius (Rsize), and scale radius (rscale) of the halo,
 * as well as the redshift (zlens).
 *
 * It has get and set functions for the members as well as virtual functions like:
 * force_halo
 * that compute the lensing properties -- deflection, convergence, and shear.
 *
 * Along with the simple set function, there are two general initialization functions,
 * that calculate the rest of the properties based on some input lens halo parameter
 * (e.g. mass).
 *
 * initFromFile
 * is intended to be used when the halo data is read in from a simulation
 * file. In this case the general halo is assumed to be an NFW halo and therefore the
 * maximum velocity and the half-mass radius need to be set. This function is overridden
 * in derived classes and in cases where it is not applicable only the mass is taken
 * into initializing the lensing halo.
 *
 * initFromMassFunc
 * is intended for the cases where the simulation is populated by lensing halos from
 * a mass function. Then one needs all parameters of the halo -- mass, Rsize, and rscale.
 */

class LensHalo{
public:
	LensHalo();
  LensHalo(PosType z,const COSMOLOGY &cosmo);
  //LensHalo(InputParams& params,COSMOLOGY &cosmo,bool needRsize = true);
  //LensHalo(InputParams& params,bool needRsize = true);
  LensHalo(const LensHalo &h);
  
  LensHalo(LensHalo &&h):star_tree(nullptr){
    *this = std::move(h);
  }

	virtual ~LensHalo();
  
  LensHalo & operator=(const LensHalo &h);
  LensHalo & operator=(LensHalo &&h);

  
  /** get the Rmax which is larger than Rsize in Mpc.  This is the region exterior to which the
   halo will be considered a point mass.  Between Rsize and Rmax the deflection and shear are interpolated.
   */
  inline float get_Rmax() const { return Rmax; }
  /// get the Rsize which is the size of the halo in Mpc
  inline float getRsize() const { return Rsize; }
	/// get the mass solar units
  inline float get_mass() const { return mass; }
  /// get the scale radius in Mpc
	inline float get_rscale() const { return rscale; }
	/// get the redshift
	inline PosType getZlens() const { return zlens; }
    
  // set the position of the Halo in physical Mpc on the lens plane
  //void setX(PosType PosX, PosType PosY) { posHalo[0] = PosX ; posHalo[1] = PosY ; }
  // set the position of the Halo in physical Mpc on the lens plane
  //void setX(PosType *PosXY) { posHalo[0] = PosXY[0] ; posHalo[1] = PosXY[1] ; }
  
  /// get the position of the Halo in physical Mpc on the lens plane
  void getX(PosType * MyPosHalo) const {
    assert(Dist != -1);
    MyPosHalo[0] = posHalo[0]*Dist;
    MyPosHalo[1] = posHalo[1]*Dist;
  }

  /// returns position of the Halo in physical Mpc on the lens plane
  PosType operator[](int i) const{return posHalo[0]*Dist;}
  
  /// set the position of the Halo in radians
  void setTheta(PosType PosX, PosType PosY) { posHalo[0] = PosX ; posHalo[1] = PosY ; }
  /// set the position of the Halo in radians
  void setTheta(PosType *PosXY) { posHalo[0] = PosXY[0] ; posHalo[1] = PosXY[1] ; }
  /// set the position of the Halo in radians
  void setTheta(const Point_2d &p) { posHalo[0] = p[0] ; posHalo[1] = p[1] ; }
  /// get the position of the Halo in radians
  void getTheta(PosType * MyPosHalo) const { MyPosHalo[0] = posHalo[0] ; MyPosHalo[1] = posHalo[1]; }
  
  /// Set the angular size distance to the halo.  This should be the distance to the lens plane.
  void setDist(COSMOLOGY &co){Dist = co.angDist(zlens);}
  /// return current angular size distance, ie conversion between angular and special coordinates.  This may not agree with
  /// the getZ() value because of the projection onto the lens plane.
  PosType getDist() const {return Dist;}

  /// get the position of the Halo in physical Mpc
  /// display the position of the halo
  void displayPos() { std::cout << "Halo PosX = " << posHalo[0] << " ; Halo PosY = " << posHalo[1] << std::endl; }<commit_msg>Bug fix.<commit_after>/*
 * lens_halos.h
 *
 *  Created on: 06.05.2013
 */

#ifndef LENS_HALOS_H_
#define LENS_HALOS_H_

//#include "standard.h"
#include "InputParams.h"
//#include "source.h"
//#include "point.h"
#include "quadTree.h"
#include "particle_types.h"
#include "image_processing.h"


/**
 * \brief A base class for all types of lensing "halos" which are any mass distribution that cause lensing.
 *
 * It contains the mass, maximum radius (Rsize), and scale radius (rscale) of the halo,
 * as well as the redshift (zlens).
 *
 * It has get and set functions for the members as well as virtual functions like:
 * force_halo
 * that compute the lensing properties -- deflection, convergence, and shear.
 *
 * Along with the simple set function, there are two general initialization functions,
 * that calculate the rest of the properties based on some input lens halo parameter
 * (e.g. mass).
 *
 * initFromFile
 * is intended to be used when the halo data is read in from a simulation
 * file. In this case the general halo is assumed to be an NFW halo and therefore the
 * maximum velocity and the half-mass radius need to be set. This function is overridden
 * in derived classes and in cases where it is not applicable only the mass is taken
 * into initializing the lensing halo.
 *
 * initFromMassFunc
 * is intended for the cases where the simulation is populated by lensing halos from
 * a mass function. Then one needs all parameters of the halo -- mass, Rsize, and rscale.
 */

class LensHalo{
public:
	LensHalo();
  LensHalo(PosType z,const COSMOLOGY &cosmo);
  //LensHalo(InputParams& params,COSMOLOGY &cosmo,bool needRsize = true);
  //LensHalo(InputParams& params,bool needRsize = true);
  LensHalo(const LensHalo &h);
  
  LensHalo(LensHalo &&h):star_tree(nullptr){
    *this = std::move(h);
  }

	virtual ~LensHalo();
  
  LensHalo & operator=(const LensHalo &h);
  LensHalo & operator=(LensHalo &&h);

  
  /** get the Rmax which is larger than Rsize in Mpc.  This is the region exterior to which the
   halo will be considered a point mass.  Between Rsize and Rmax the deflection and shear are interpolated.
   */
  inline float get_Rmax() const { return Rmax; }
  /// get the Rsize which is the size of the halo in Mpc
  inline float getRsize() const { return Rsize; }
	/// get the mass solar units
  inline float get_mass() const { return mass; }
  /// get the scale radius in Mpc
	inline float get_rscale() const { return rscale; }
	/// get the redshift
	inline PosType getZlens() const { return zlens; }
    
  // set the position of the Halo in physical Mpc on the lens plane
  //void setX(PosType PosX, PosType PosY) { posHalo[0] = PosX ; posHalo[1] = PosY ; }
  // set the position of the Halo in physical Mpc on the lens plane
  //void setX(PosType *PosXY) { posHalo[0] = PosXY[0] ; posHalo[1] = PosXY[1] ; }
  
  /// get the position of the Halo in physical Mpc on the lens plane
  void getX(PosType * MyPosHalo) const {
    assert(Dist != -1);
    MyPosHalo[0] = posHalo[0]*Dist;
    MyPosHalo[1] = posHalo[1]*Dist;
  }

  /// returns position of the Halo in physical Mpc on the lens plane
  PosType operator[](int i) const{return posHalo[i]*Dist;}
  
  /// set the position of the Halo in radians
  void setTheta(PosType PosX, PosType PosY) { posHalo[0] = PosX ; posHalo[1] = PosY ; }
  /// set the position of the Halo in radians
  void setTheta(PosType *PosXY) { posHalo[0] = PosXY[0] ; posHalo[1] = PosXY[1] ; }
  /// set the position of the Halo in radians
  void setTheta(const Point_2d &p) { posHalo[0] = p[0] ; posHalo[1] = p[1] ; }
  /// get the position of the Halo in radians
  void getTheta(PosType * MyPosHalo) const { MyPosHalo[0] = posHalo[0] ; MyPosHalo[1] = posHalo[1]; }
  
  /// Set the angular size distance to the halo.  This should be the distance to the lens plane.
  void setDist(COSMOLOGY &co){Dist = co.angDist(zlens);}
  /// return current angular size distance, ie conversion between angular and special coordinates.  This may not agree with
  /// the getZ() value because of the projection onto the lens plane.
  PosType getDist() const {return Dist;}

  /// get the position of the Halo in physical Mpc
  /// display the position of the halo
  void displayPos() { std::cout << "Halo PosX = " << posHalo[0] << " ; Halo PosY = " << posHalo[1] << std::endl; }
{'fraction_non_alphanumeric': 0.10343233560614816, 'fraction_numerical': 0.008436380446088063, 'mean_word_length': 3.5096404377279833, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '311620', 'n_tokens_mistral': 2885, 'n_tokens_neox': 2793, 'n_words': 1123}