Re-inserted some changes to pixelized.cpp that had been mistakenly discarded during a merge.

--- ImageProcessing/pixelize.cpp
+++ ImageProcessing/pixelize.cpp
@@ -24,77 +24,77 @@
 template<typename T>
 void swap(std::valarray<T>& x, std::valarray<T>& y)
 {
-	std::valarray<T> z(x);
-
-	x.resize(y.size());
-	x = y;
-
-	y.resize(z.size());
-	y = z;
+  std::valarray<T> z(x);
+
+  x.resize(y.size());
+  x = y;
+
+  y.resize(z.size());
+  y = z;
 }
 #endif

 void swap(PixelMap& x, PixelMap& y)
 {
-	using std::swap;
-
-	swap(x.map,y.map);
-
-	swap(x.Nx, y.Nx);
-	swap(x.Ny, y.Ny);
-	swap(x.resolution, y.resolution);
-	swap(x.rangeX, y.rangeX);
-	swap(x.rangeY, y.rangeY);
-
-	swap(x.center[0], y.center[0]);
-	swap(x.center[1], y.center[1]);
-
-	swap(x.map_boundary_p1[0], y.map_boundary_p1[0]);
-	swap(x.map_boundary_p1[1], y.map_boundary_p1[1]);
-	swap(x.map_boundary_p2[0], y.map_boundary_p2[0]);
-	swap(x.map_boundary_p2[1], y.map_boundary_p2[1]);
+  using std::swap;
+
+  swap(x.map,y.map);
+
+  swap(x.Nx, y.Nx);
+  swap(x.Ny, y.Ny);
+  swap(x.resolution, y.resolution);
+  swap(x.rangeX, y.rangeX);
+  swap(x.rangeY, y.rangeY);
+
+  swap(x.center[0], y.center[0]);
+  swap(x.center[1], y.center[1]);
+
+  swap(x.map_boundary_p1[0], y.map_boundary_p1[0]);
+  swap(x.map_boundary_p1[1], y.map_boundary_p1[1]);
+  swap(x.map_boundary_p2[0], y.map_boundary_p2[0]);
+  swap(x.map_boundary_p2[1], y.map_boundary_p2[1]);
 }

 PixelMap::PixelMap()
 : map(), Nx(0), Ny(0), resolution(0), rangeX(0), rangeY(0)
 {
-	center[0] = 0;
-	center[1] = 0;
-
-	map_boundary_p1[0] = 0;
-	map_boundary_p1[1] = 0;
-	map_boundary_p2[0] = 0;
-	map_boundary_p2[1] = 0;
+  center[0] = 0;
+  center[1] = 0;
+
+  map_boundary_p1[0] = 0;
+  map_boundary_p1[1] = 0;
+  map_boundary_p2[0] = 0;
+  map_boundary_p2[1] = 0;
 }

 PixelMap::PixelMap(const PixelMap& other)
 : map(other.map),
-  Nx(other.Nx), Ny(other.Ny), resolution(other.resolution), rangeX(other.rangeX), rangeY(other.rangeY)
-{
-	std::copy(other.center, other.center + 2, center);
-
-	std::copy(other.map_boundary_p1, other.map_boundary_p1 + 2, map_boundary_p1);
-	std::copy(other.map_boundary_p2, other.map_boundary_p2 + 2, map_boundary_p2);
+Nx(other.Nx), Ny(other.Ny), resolution(other.resolution), rangeX(other.rangeX), rangeY(other.rangeY)
+{
+  std::copy(other.center, other.center + 2, center);
+
+  std::copy(other.map_boundary_p1, other.map_boundary_p1 + 2, map_boundary_p1);
+  std::copy(other.map_boundary_p2, other.map_boundary_p2 + 2, map_boundary_p2);
 }

 /// make square PixelMap
 PixelMap::PixelMap(
-		const PosType* center,  /// The location of the center of the map
-		std::size_t Npixels,  /// Number of pixels in one dimension of map.
-		PosType resolution        /// One dimensional range of map in whatever units the point positions are in
-		)
+                   const PosType* center,  /// The location of the center of the map
+                   std::size_t Npixels,  /// Number of pixels in one dimension of map.
+                   PosType resolution        /// One dimensional range of map in whatever units the point positions are in
+)
 : map(0.0, Npixels*Npixels),
-  Nx(Npixels), Ny(Npixels), resolution(resolution)
+Nx(Npixels), Ny(Npixels), resolution(resolution)
 {
   if(Npixels == 0 || resolution <=0) throw std::invalid_argument("invalid arguments");
-	std::copy(center, center + 2, this->center);
-	rangeX = resolution*Nx;
-	rangeY = resolution*Ny;
-
-	map_boundary_p1[0] = center[0]-(Npixels*resolution)/2.;
-	map_boundary_p1[1] = center[1]-(Npixels*resolution)/2.;
-	map_boundary_p2[0] = center[0]+(Npixels*resolution)/2.;
-	map_boundary_p2[1] = center[1]+(Npixels*resolution)/2.;
+  std::copy(center, center + 2, this->center);
+  rangeX = resolution*Nx;
+  rangeY = resolution*Ny;
+
+  map_boundary_p1[0] = center[0]-(Npixels*resolution)/2.;
+  map_boundary_p1[1] = center[1]-(Npixels*resolution)/2.;
+  map_boundary_p2[0] = center[0]+(Npixels*resolution)/2.;
+  map_boundary_p2[1] = center[1]+(Npixels*resolution)/2.;
 }

 /// make rectangular PixelMap with square pixels
@@ -103,54 +103,54 @@
                    std::size_t Nx,  /// Number of pixels in x dimension of map.
                    std::size_t Ny,  /// Number of pixels in y dimension of map.
                    PosType resolution        /// One dimensional range of map in whatever units the point positions are in
-                   )
+)
 : map(0.0, Nx*Ny),
 Nx(Nx), Ny(Ny), resolution(resolution)
 {
-	std::copy(center, center + 2, this->center);
-	rangeX = resolution*Nx;
-	rangeY = resolution*Ny;
-
-	map_boundary_p1[0] = center[0]-(Nx*resolution)/2.;
-	map_boundary_p1[1] = center[1]-(Ny*resolution)/2.;
-	map_boundary_p2[0] = center[0]+(Nx*resolution)/2.;
-	map_boundary_p2[1] = center[1]+(Ny*resolution)/2.;
+  std::copy(center, center + 2, this->center);
+  rangeX = resolution*Nx;
+  rangeY = resolution*Ny;
+
+  map_boundary_p1[0] = center[0]-(Nx*resolution)/2.;
+  map_boundary_p1[1] = center[1]-(Ny*resolution)/2.;
+  map_boundary_p2[0] = center[0]+(Nx*resolution)/2.;
+  map_boundary_p2[1] = center[1]+(Ny*resolution)/2.;
 }

 /** \brief Constructs a PixelMap reading in a fits file
-* Infos about resolution, Npixels and center are read from the header.
+ * Infos about resolution, Npixels and center are read from the header.
  */
 PixelMap::PixelMap(
                    std::string fitsfilename   /// file name of fits file to be read
                    ,double my_res         /// resolution (rad) of fits image if not given in fits file, use default or -1 otherwise
-                   )
+)
 {
 #ifdef ENABLE_FITS
-	if(fitsfilename.empty())
-		throw std::invalid_argument("Please enter a valid filename for the FITS file input");
-
-	std::auto_ptr<CCfits::FITS> fp(new CCfits::FITS(fitsfilename, CCfits::Read));
-
-	CCfits::PHDU& h0 = fp->pHDU();
-
-	//const CCfits::ExtMap *h1=&fp->extension();
-
-	Nx = h0.axis(0);
+  if(fitsfilename.empty())
+    throw std::invalid_argument("Please enter a valid filename for the FITS file input");
+
+  std::auto_ptr<CCfits::FITS> fp(new CCfits::FITS(fitsfilename, CCfits::Read));
+
+  CCfits::PHDU& h0 = fp->pHDU();
+
+  //const CCfits::ExtMap *h1=&fp->extension();
+
+  Nx = h0.axis(0);
   Ny = h0.axis(1);
-
+
   try
-	{
+  {
     h0.readKey("CRVAL1", center[0]);
     h0.readKey("CRVAL2", center[1]);
-	}
+  }
   catch(CCfits::HDU::NoSuchKeyword&)
-	{
+  {
     center[0] = 0.0;
     center[1] = 0.0;
   }

   if(my_res == -1){
-	// read the resolution
+    // read the resolution
     try
     {
       double cdelt2;
@@ -180,18 +180,18 @@
     }
     resolution = fabs(my_res)*pi/180.;
   }
-
-	rangeX = resolution*Nx;
-	rangeY = resolution*Ny;
-	map_boundary_p1[0] = center[0] - (Nx*resolution)/2.;
-	map_boundary_p1[1] = center[1] - (Ny*resolution)/2.;
-	map_boundary_p2[0] = center[0] + (Nx*resolution)/2.;
-	map_boundary_p2[1] = center[1] + (Ny*resolution)/2.;
-
-	h0.read(map);
+
+  rangeX = resolution*Nx;
+  rangeY = resolution*Ny;
+  map_boundary_p1[0] = center[0] - (Nx*resolution)/2.;
+  map_boundary_p1[1] = center[1] - (Ny*resolution)/2.;
+  map_boundary_p2[0] = center[0] + (Nx*resolution)/2.;
+  map_boundary_p2[1] = center[1] + (Ny*resolution)/2.;
+
+  h0.read(map);
 #else
-	std::cerr << "Please enable the preprocessor flag ENABLE_FITS !" << std::endl;
-	exit(1);
+  std::cerr << "Please enable the preprocessor flag ENABLE_FITS !" << std::endl;
+  exit(1);
 #endif
 }

@@ -199,89 +199,89 @@
  * If the region exceeds the boundaries of the original map, the new map is completed with zeros.
  */
 PixelMap::PixelMap(const PixelMap& pmap,  /// Input PixelMap (from which the stamp is taken)
-		const PosType* center, /// center of the region to be duplicated (in rads)
-		std::size_t my_Npixels /// size of the region to be duplicated (in pixels)
-		)
+                   const PosType* center, /// center of the region to be duplicated (in rads)
+                   std::size_t my_Npixels /// size of the region to be duplicated (in pixels)
+)
 : map(0.0, my_Npixels*my_Npixels),
-  Nx(my_Npixels), Ny(my_Npixels), resolution(pmap.resolution)
-	{
+Nx(my_Npixels), Ny(my_Npixels), resolution(pmap.resolution)
+{
 		std::copy(center, center + 2, this->center);
 		rangeX = resolution*Nx;
 		rangeY = resolution*Ny;
-
+
 		map_boundary_p1[0] = center[0]-(Nx*resolution)/2.;
 		map_boundary_p1[1] = center[1]-(Ny*resolution)/2.;
 		map_boundary_p2[0] = center[0]+(Nx*resolution)/2.;
 		map_boundary_p2[1] = center[1]+(Ny*resolution)/2.;
-
+
 		int edge[2];
 		edge[0] = (center[0]-pmap.map_boundary_p1[0])/resolution - Nx/2;
 		edge[1] = (center[1]-pmap.map_boundary_p1[1])/resolution - Ny/2;
 		if (edge[0] > int(pmap.Nx) || edge[1] > int(pmap.Ny) || edge[0]+int(Nx) < 0 || edge[1]+int(Ny) < 0)
-		{
-			std::cout << "The region you selected is completely outside PixelMap!" << std::endl;
-			throw std::runtime_error("Attempting to make Sub-PixelMap outside of parent PixelMap!");
-		}
+    {
+      std::cout << "The region you selected is completely outside PixelMap!" << std::endl;
+      throw std::runtime_error("Attempting to make Sub-PixelMap outside of parent PixelMap!");
+    }
 		for (unsigned long i=0; i < map.size(); ++i)
-		{
-			int ix = i%Nx;
-			int iy = i/Nx;
-			map[i] = 0;
-			if (ix+edge[0] > 0 && ix+edge[0] < pmap.Nx && iy+edge[1] > 0 && iy+edge[1] < pmap.Ny)
-				map[i] = pmap.map[ix+edge[0]+(iy+edge[1])*pmap.Nx];
-		}
-	}
+    {
+      int ix = i%Nx;
+      int iy = i/Nx;
+      map[i] = 0;
+      if (ix+edge[0] > 0 && ix+edge[0] < pmap.Nx && iy+edge[1] > 0 && iy+edge[1] < pmap.Ny)
+        map[i] = pmap.map[ix+edge[0]+(iy+edge[1])*pmap.Nx];
+    }
+}

 /** \brief Creates a PixelMap at a different resolution.
-* The new counts are calculated integrating over the input pixels.
-* No interpolation or smoothing is performed.
+ * The new counts are calculated integrating over the input pixels.
+ * No interpolation or smoothing is performed.
  */
 PixelMap::PixelMap(
                    const PixelMap& pmap
                    , PosType res_ratio     /// resolution of map is res_ratio times the resolution of the input map
-                   )
-{
-	resolution = res_ratio*pmap.resolution;
-	Nx = pmap.Nx/res_ratio + .5;
-	Ny = pmap.Ny/res_ratio + .5;
-	rangeX = resolution*Nx;
-	rangeY = resolution*Ny;
-	center[0] = pmap.center[0];
-	center[1] = pmap.center[1];
-	map_boundary_p1[0] = center[0] - (Nx*resolution)/2.;
-	map_boundary_p1[1] = center[1] - (Ny*resolution)/2.;
-	map_boundary_p2[0] = center[0] + (Nx*resolution)/2.;
-	map_boundary_p2[1] = center[1] + (Ny*resolution)/2.;
-
-	map.resize(Nx*Ny);
-
-	int old_Nx = pmap.Nx;
-	int old_Ny = pmap.Ny;
-	int ix, iy;
-	PosType area;
-	PosType old_p1[2];
-	PosType old_p2[2];
-
-	for(unsigned long i=0;i < map.size(); ++i)
-	{
-		ix = i%Nx;
-		iy = i/Nx;
-		map[ix+Nx*iy] = 0.;
-		old_p1[0] = std::max(0,int(ix*res_ratio));
-		old_p1[1] = std::max(0,int(iy*res_ratio));
-
-		old_p2[0] = std::min(old_Nx-1,int((ix+1.)*res_ratio));
-		old_p2[1] = std::min(old_Ny-1,int((iy+1.)*res_ratio));
-
-		for (int old_iy = old_p1[1]; old_iy <= old_p2[1]; ++old_iy)
-		{
-			for (int old_ix = old_p1[0]; old_ix<= old_p2[0]; ++old_ix)
-				{
-					area = MIN(old_ix+0.5,(ix+1.)*res_ratio-0.5) - MAX(old_ix-0.5,ix*res_ratio-0.5);
-					area *= MIN(old_iy+0.5,(iy+1.)*res_ratio-0.5) - MAX(old_iy-0.5,iy*res_ratio-0.5);
-					map[ix+Nx*iy] += area*pmap.map[old_ix+old_Nx*old_iy];
-				}
-			}
+)
+{
+  resolution = res_ratio*pmap.resolution;
+  Nx = pmap.Nx/res_ratio + .5;
+  Ny = pmap.Ny/res_ratio + .5;
+  rangeX = resolution*Nx;
+  rangeY = resolution*Ny;
+  center[0] = pmap.center[0];
+  center[1] = pmap.center[1];
+  map_boundary_p1[0] = center[0] - (Nx*resolution)/2.;
+  map_boundary_p1[1] = center[1] - (Ny*resolution)/2.;
+  map_boundary_p2[0] = center[0] + (Nx*resolution)/2.;
+  map_boundary_p2[1] = center[1] + (Ny*resolution)/2.;
+
+  map.resize(Nx*Ny);
+
+  int old_Nx = pmap.Nx;
+  int old_Ny = pmap.Ny;
+  int ix, iy;
+  PosType area;
+  PosType old_p1[2];
+  PosType old_p2[2];
+
+  for(unsigned long i=0;i < map.size(); ++i)
+  {
+    ix = i%Nx;
+    iy = i/Nx;
+    map[ix+Nx*iy] = 0.;
+    old_p1[0] = std::max(0,int(ix*res_ratio));
+    old_p1[1] = std::max(0,int(iy*res_ratio));
+
+    old_p2[0] = std::min(old_Nx-1,int((ix+1.)*res_ratio));
+    old_p2[1] = std::min(old_Ny-1,int((iy+1.)*res_ratio));
+
+    for (int old_iy = old_p1[1]; old_iy <= old_p2[1]; ++old_iy)
+    {
+      for (int old_ix = old_p1[0]; old_ix<= old_p2[0]; ++old_ix)
+      {
+        area = MIN(old_ix+0.5,(ix+1.)*res_ratio-0.5) - MAX(old_ix-0.5,ix*res_ratio-0.5);
+        area *= MIN(old_iy+0.5,(iy+1.)*res_ratio-0.5) - MAX(old_iy-0.5,iy*res_ratio-0.5);
+        map[ix+Nx*iy] += area*pmap.map[old_ix+old_Nx*old_iy];
+      }
+    }
 		}
 }

@@ -292,38 +292,38 @@

 PixelMap& PixelMap::operator=(PixelMap other)
 {
-	swap(*this, other);
-	return *this;
+  swap(*this, other);
+  return *this;
 }

 /// Zero the whole map
 void PixelMap::Clean()
 {
-	map = 0;
+  map = 0;
 }

 /// Multiplies the whole map by a scalar factor
 void PixelMap::Renormalize(PosType factor)
 {
-	map *= factor;
+  map *= factor;
 }

 /// Adds a value to the i-th pixel
 void PixelMap::AddValue(std::size_t i, PosType value)
 {
-	map[i] += value;
+  map[i] += value;
 }

 /// Assigns a value to the i-th pixel
 void PixelMap::AssignValue(std::size_t i, PosType value)
 {
-	map[i] = value;
+  map[i] = value;
 }

 /// Check whether two PixelMaps agree in their physical dimensions.
 bool PixelMap::agrees(const PixelMap& other) const
 {
-	return
+  return
   (Nx == other.Nx) &&
   (Ny == other.Ny) &&
   (resolution == other.resolution) &&
@@ -334,37 +334,37 @@
 /// Add the values of another PixelMap to this one.
 PixelMap& PixelMap::operator+=(const PixelMap& rhs)
 {
-	// TODO: maybe check if PixelMaps agree, but is slower
+  // TODO: maybe check if PixelMaps agree, but is slower
   if(Nx != rhs.getNx() || Ny != rhs.getNy())
     throw std::runtime_error("Dimensions of maps are not compatible");
-	for(size_t i=0;i<map.size();++i) map[i] += rhs.map[i];
-	return *this;
+  for(size_t i=0;i<map.size();++i) map[i] += rhs.map[i];
+  return *this;
 }

 /// Add two PixelMaps.
 PixelMap operator+(const PixelMap& a, const PixelMap& b)
 {
-	PixelMap sum(a);
-	sum += b;
-	return sum;
+  PixelMap sum(a);
+  sum += b;
+  return sum;
 }

 /// Subtract the values of another PixelMap from this one.
 PixelMap& PixelMap::operator-=(const PixelMap& rhs)
 {
-	// TODO: maybe check if PixelMaps agree, but is slower
+  // TODO: maybe check if PixelMaps agree, but is slower
   if(Nx != rhs.getNx() || Ny != rhs.getNy())
     throw std::runtime_error("Dimensions of maps are not compatible");
-	for(size_t i=0;i<map.size();++i) map[i] -= rhs.map[i];
-	return *this;
+  for(size_t i=0;i<map.size();++i) map[i] -= rhs.map[i];
+  return *this;
 }

 /// Subtract two PixelMaps.
 PixelMap operator-(const PixelMap& a, const PixelMap& b)
 {
-	PixelMap diff(a);
-	diff -= b;
-	return diff;
+  PixelMap diff(a);
+  diff -= b;
+  return diff;
 }

 /// Multiply the values of another PixelMap by this one.
@@ -372,40 +372,40 @@
 {
   if(Nx != rhs.getNx() || Ny != rhs.getNy())
     throw std::runtime_error("Dimensions of maps are not compatible");
-	for(size_t i=0;i<map.size();++i) map[i] *= rhs.map[i];
-    //map *= rhs.map;
-	return *this;
+  for(size_t i=0;i<map.size();++i) map[i] *= rhs.map[i];
+  //map *= rhs.map;
+  return *this;
 }

 PixelMap& PixelMap::operator*=(PosType b)
 {
-    for(size_t i=0;i<map.size();++i) map[i] *= b;
-    //map *= rhs.map;
-	return *this;
+  for(size_t i=0;i<map.size();++i) map[i] *= b;
+  //map *= rhs.map;
+  return *this;
 }

 /// Multiply two PixelMaps.
 PixelMap operator*(const PixelMap& a, const PixelMap& b)
 {
-	PixelMap diff(a);
-	diff *= b;
-	return diff;
+  PixelMap diff(a);
+  diff *= b;
+  return diff;
 }

 /// Multiply two PixelMaps.
 PixelMap operator*(const PixelMap& a, PosType b)
 {
-	PixelMap diff(a);
-	diff *= b;
-	return diff;
+  PixelMap diff(a);
+  diff *= b;
+  return diff;
 }

 PosType PixelMap::ave() const{
-    PosType tmp=0;
-    for(size_t i=0;i<map.size();++i){
-        tmp += map[i];
-    }
-    return tmp/map.size();
+  PosType tmp=0;
+  for(size_t i=0;i<map.size();++i){
+    tmp += map[i];
+  }
+  return tmp/map.size();
 }

@@ -416,44 +416,44 @@
  *  Negative values are good for mapping some quantity independant of the pixel size
  */
 void PixelMap::AddImages(
-		ImageInfo *imageinfo   /// An array of ImageInfo-s.  There is no reason to separate images for this routine
-		,int Nimages           /// Number of images on input.
-		,float rescale         /// rescales the surface brightness while leaving the image unchanged,
-                               ///  see full notes
-		){
-
-	if(Nimages <= 0) return;
-	if(imageinfo->imagekist->Nunits() == 0) return;
-
-	PosType sb = 1;
+                         ImageInfo *imageinfo   /// An array of ImageInfo-s.  There is no reason to separate images for this routine
+                         ,int Nimages           /// Number of images on input.
+                         ,float rescale         /// rescales the surface brightness while leaving the image unchanged,
+///  see full notes
+){
+
+  if(Nimages <= 0) return;
+  if(imageinfo->imagekist->Nunits() == 0) return;
+
+  PosType sb = 1;
   float area = 1;
-	std::list <unsigned long> neighborlist;
-	std::list<unsigned long>::iterator it;
-	for(long ii=0;ii<Nimages;++ii){
-
-		if(imageinfo->imagekist->Nunits() > 0){
-			imageinfo[ii].imagekist->MoveToTop();
-			do{
-				if(rescale != 0.0) sb = fabs(rescale)*imageinfo[ii].imagekist->getCurrent()->surface_brightness;
+  std::list <unsigned long> neighborlist;
+  std::list<unsigned long>::iterator it;
+  for(long ii=0;ii<Nimages;++ii){
+
+    if(imageinfo->imagekist->Nunits() > 0){
+      imageinfo[ii].imagekist->MoveToTop();
+      do{
+        if(rescale != 0.0) sb = fabs(rescale)*imageinfo[ii].imagekist->getCurrent()->surface_brightness;

-				assert(imageinfo[ii].imagekist->getCurrent()->leaf);
+        assert(imageinfo[ii].imagekist->getCurrent()->leaf);

-				if ((inMapBox(imageinfo[ii].imagekist->getCurrent()->leaf)) == true){
-					PointsWithinLeaf(imageinfo[ii].imagekist->getCurrent()->leaf,neighborlist);
-					for(it = neighborlist.begin();it != neighborlist.end();it++){
-						area = LeafPixelArea(*it,imageinfo[ii].imagekist->getCurrent()->leaf);
+        if ((inMapBox(imageinfo[ii].imagekist->getCurrent()->leaf)) == true){
+          PointsWithinLeaf(imageinfo[ii].imagekist->getCurrent()->leaf,neighborlist);
+          for(it = neighborlist.begin();it != neighborlist.end();it++){
+            area = LeafPixelArea(*it,imageinfo[ii].imagekist->getCurrent()->leaf);
             map[*it] += sb*area;
-					}
-				}
-			}while(imageinfo[ii].imagekist->Down());
-		}
-	}
+          }
+        }
+      }while(imageinfo[ii].imagekist->Down());
+    }
+  }

   if(rescale < 0){
     for(size_t i=0; i< Nx*Ny ;++i) map[i] /= resolution*resolution;
   }

-	return;
+  return;
 }

 void PixelMap::AddImages(
@@ -467,148 +467,148 @@

 /// returns the grid points within the branch
 void PixelMap::PointsWithinLeaf(Branch * branch1, std::list <unsigned long> &neighborlist){
-
-	neighborlist.clear();
-
-	long line_s,line_e,col_s,col_e;
-
+
+  neighborlist.clear();
+
+  long line_s,line_e,col_s,col_e;
+
   find_index(branch1->boundary_p1,line_s,col_s);
   find_index(branch1->boundary_p2,line_e,col_e);

   if(line_s < 0) line_s = 0;
   if(col_s < 0) col_s = 0;

-	//line_s = std::max(0,int(Utilities::IndexFromPosition(branch1->boundary_p1[0],Nx,range,center[0])));
-	//col_s = std::max(0,int(Utilities::IndexFromPosition(branch1->boundary_p1[1],Ny,range*Ny/Nx,center[1])));
-
-	//line_e = Utilities::IndexFromPosition(branch1->boundary_p2[0],Nx,range,center[0]);
-	//col_e = Utilities::IndexFromPosition(branch1->boundary_p2[1],Ny,range*Ny/Nx,center[1]);
-
-	if (line_e < 0) line_e = Nx-1;
-	if (col_e < 0) col_e = Ny-1;
-
-	for (int iy = col_s; iy<= col_e; ++iy)
-	{
-		for (int ix = line_s; ix <= line_e; ++ix)
-			{
-				neighborlist.push_back(ix+Nx*iy);
-			}
+  //line_s = std::max(0,int(Utilities::IndexFromPosition(branch1->boundary_p1[0],Nx,range,center[0])));
+  //col_s = std::max(0,int(Utilities::IndexFromPosition(branch1->boundary_p1[1],Ny,range*Ny/Nx,center[1])));
+
+  //line_e = Utilities::IndexFromPosition(branch1->boundary_p2[0],Nx,range,center[0]);
+  //col_e = Utilities::IndexFromPosition(branch1->boundary_p2[1],Ny,range*Ny/Nx,center[1]);
+
+  if (line_e < 0) line_e = Nx-1;
+  if (col_e < 0) col_e = Ny-1;
+
+  for (int iy = col_s; iy<= col_e; ++iy)
+  {
+    for (int ix = line_s; ix <= line_e; ++ix)
+    {
+      neighborlist.push_back(ix+Nx*iy);
+    }
 		}
 }
 /// checks if the branch is within map boundaries
 bool PixelMap::inMapBox(Branch * branch1) const{
-	if (branch1->boundary_p1[0] > map_boundary_p2[0] || branch1->boundary_p2[0] < map_boundary_p1[0]) return false;
-	if (branch1->boundary_p1[1] > map_boundary_p2[1] || branch1->boundary_p2[1] < map_boundary_p1[1]) return false;
-	return true;
+  if (branch1->boundary_p1[0] > map_boundary_p2[0] || branch1->boundary_p2[0] < map_boundary_p1[0]) return false;
+  if (branch1->boundary_p1[1] > map_boundary_p2[1] || branch1->boundary_p2[1] < map_boundary_p1[1]) return false;
+  return true;
 }
 /// checks if point is within map boundaries
 bool PixelMap::inMapBox(PosType * x) const{
-	if (x[0] > map_boundary_p2[0] || x[0] < map_boundary_p1[0]) return false;
-	if (x[1] > map_boundary_p2[1] || x[1] < map_boundary_p1[1]) return false;
-	return true;
+  if (x[0] > map_boundary_p2[0] || x[0] < map_boundary_p1[0]) return false;
+  if (x[1] > map_boundary_p2[1] || x[1] < map_boundary_p1[1]) return false;
+  return true;
 }

 //// Finds the area of the intersection between pixel i and branch1
 PosType PixelMap::LeafPixelArea(IndexType i,Branch * branch1){
-	PosType area=0;
-	PosType p[2],p1[2],p2[2];
-
-	//Utilities::PositionFromIndex(i,p,Nx,range,center);
+  PosType area=0;
+  PosType p[2],p1[2],p2[2];
+
+  //Utilities::PositionFromIndex(i,p,Nx,range,center);
   find_position(p,i);
-	p1[0] = p[0] - .5*resolution;
-	p1[1] = p[1] - .5*resolution;
-	p2[0] = p[0] + .5*resolution;
-	p2[1] = p[1] + .5*resolution;
-	area = MIN(p2[0],branch1->boundary_p2[0])
-	     - MAX(p1[0],branch1->boundary_p1[0]);
-	if(area < 0) return 0.0;
-
-	area *= MIN(p2[1],branch1->boundary_p2[1])
-	      - MAX(p1[1],branch1->boundary_p1[1]);
-	if(area < 0) return 0.0;
-
-	return area;
+  p1[0] = p[0] - .5*resolution;
+  p1[1] = p[1] - .5*resolution;
+  p2[0] = p[0] + .5*resolution;
+  p2[1] = p[1] + .5*resolution;
+  area = MIN(p2[0],branch1->boundary_p2[0])
+  - MAX(p1[0],branch1->boundary_p1[0]);
+  if(area < 0) return 0.0;
+
+  area *= MIN(p2[1],branch1->boundary_p2[1])
+  - MAX(p1[1],branch1->boundary_p1[1]);
+  if(area < 0) return 0.0;
+
+  return area;
 }

 /// Print an ASCII table of all the pixel values.
 void PixelMap::printASCII() const
 {
-	std::cout << Nx << " " << Ny << "  " << rangeX << std::endl;
-	for(std::size_t i=0;i < map.size(); ++i) std::cout << map[i] << std::endl;
-	std::cout << Nx << " " << Ny << "  " << rangeX << std::endl;
-
-	//map.resize(0);
-	return;
+  std::cout << Nx << " " << Ny << "  " << rangeX << std::endl;
+  for(std::size_t i=0;i < map.size(); ++i) std::cout << map[i] << std::endl;
+  std::cout << Nx << " " << Ny << "  " << rangeX << std::endl;
+
+  //map.resize(0);
+  return;
 }
 /// Print an ASCII table of all the pixel values.
 void PixelMap::printASCIItoFile(std::string filename) const
 {
-	std::ofstream file_map(filename.c_str());
-
-	if(!file_map){
-		std::cout << "unable to open file " << filename << std::endl;
-		exit(0);
-	}
-
-	std::cout << Nx << " " << Ny << "  " << rangeX << std::endl;
-	for(std::size_t i=0;i < map.size(); ++i) file_map << std::scientific << map[i] << std::endl;
-	std::cout << Nx << " " << Ny << "  " << rangeX << std::endl;
-
-	//map.resize(0);
-
-	file_map.close();
-
-	return;
+  std::ofstream file_map(filename.c_str());
+
+  if(!file_map){
+    std::cout << "unable to open file " << filename << std::endl;
+    exit(0);
+  }
+
+  std::cout << Nx << " " << Ny << "  " << rangeX << std::endl;
+  for(std::size_t i=0;i < map.size(); ++i) file_map << std::scientific << map[i] << std::endl;
+  std::cout << Nx << " " << Ny << "  " << rangeX << std::endl;
+
+  //map.resize(0);
+
+  file_map.close();
+
+  return;
 }
 /// Output the pixel map as a fits file.
 void PixelMap::printFITS(std::string filename, bool verbose) const
 {
 #ifdef ENABLE_FITS
-	if(filename.empty())
-		throw std::invalid_argument("Please enter a valid filename for the FITS file output");
-
-	long naxis = 2;
-	long naxes[2] = {(long)Nx, (long)Ny};
-
-	// might throw CCfits::FITS::CantCreate
-	std::auto_ptr<CCfits::FITS> fout(new CCfits::FITS(filename, FLOAT_IMG, naxis, naxes));
-
-	std::vector<long> naxex(2);
-	naxex[0] = Nx;
-	naxex[1] = Ny;
-
-	CCfits::PHDU& phout = fout->pHDU();
-
-	phout.write(1, map.size(), map);
-
-	phout.addKey("WCSAXES", 2, "number of World Coordinate System axes");
-	phout.addKey("CRPIX1", 0.5*(naxex[0]+1), "x-coordinate of reference pixel");
-	phout.addKey("CRPIX2", 0.5*(naxex[1]+1), "y-coordinate of reference pixel");
-	phout.addKey("CRVAL1", 0.0, "first axis value at reference pixel");
-	phout.addKey("CRVAL2", 0.0, "second axis value at reference pixel");
-	phout.addKey("CTYPE1", "RA---TAN", "the coordinate type for the first axis");
-	phout.addKey("CTYPE2", "DEC--TAN", "the coordinate type for the second axis");
-	phout.addKey("CUNIT1", "deg     ", "the coordinate unit for the first axis");
-	phout.addKey("CUNIT2", "deg     ", "the coordinate unit for the second axis");
-	phout.addKey("CDELT1", -180*resolution/pi, "partial of first axis coordinate w.r.t. x");
-	phout.addKey("CDELT2", 180*resolution/pi, "partial of second axis coordinate w.r.t. y");
-	phout.addKey("CROTA2", 0.0, "");
-	phout.addKey("CD1_1", -180*resolution/pi, "partial of first axis coordinate w.r.t. x");
-	phout.addKey("CD1_2", 0.0, "partial of first axis coordinate w.r.t. y");
-	phout.addKey("CD2_1", 0.0, "partial of second axis coordinate w.r.t. x");
-	phout.addKey("CD2_2", 180*resolution/pi, "partial of second axis coordinate w.r.t. y");
-
-	phout.addKey("Nx", Nx, "");
-	phout.addKey("Ny", Ny, "");
-	phout.addKey("range x", map_boundary_p2[0]-map_boundary_p1[0], "radians");
-	phout.addKey("RA", center[0], "radians");
-	phout.addKey("DEC", center[1], "radians");
-
-	if(verbose)
-		std::cout << phout << std::endl;
+  if(filename.empty())
+    throw std::invalid_argument("Please enter a valid filename for the FITS file output");
+
+  long naxis = 2;
+  long naxes[2] = {(long)Nx, (long)Ny};
+
+  // might throw CCfits::FITS::CantCreate
+  std::auto_ptr<CCfits::FITS> fout(new CCfits::FITS(filename, FLOAT_IMG, naxis, naxes));
+
+  std::vector<long> naxex(2);
+  naxex[0] = Nx;
+  naxex[1] = Ny;
+
+  CCfits::PHDU& phout = fout->pHDU();
+
+  phout.write(1, map.size(), map);
+
+  phout.addKey("WCSAXES", 2, "number of World Coordinate System axes");
+  phout.addKey("CRPIX1", 0.5*(naxex[0]+1), "x-coordinate of reference pixel");
+  phout.addKey("CRPIX2", 0.5*(naxex[1]+1), "y-coordinate of reference pixel");
+  phout.addKey("CRVAL1", 0.0, "first axis value at reference pixel");
+  phout.addKey("CRVAL2", 0.0, "second axis value at reference pixel");
+  phout.addKey("CTYPE1", "RA---TAN", "the coordinate type for the first axis");
+  phout.addKey("CTYPE2", "DEC--TAN", "the coordinate type for the second axis");
+  phout.addKey("CUNIT1", "deg     ", "the coordinate unit for the first axis");
+  phout.addKey("CUNIT2", "deg     ", "the coordinate unit for the second axis");
+  phout.addKey("CDELT1", -180*resolution/pi, "partial of first axis coordinate w.r.t. x");
+  phout.addKey("CDELT2", 180*resolution/pi, "partial of second axis coordinate w.r.t. y");
+  phout.addKey("CROTA2", 0.0, "");
+  phout.addKey("CD1_1", -180*resolution/pi, "partial of first axis coordinate w.r.t. x");
+  phout.addKey("CD1_2", 0.0, "partial of first axis coordinate w.r.t. y");
+  phout.addKey("CD2_1", 0.0, "partial of second axis coordinate w.r.t. x");
+  phout.addKey("CD2_2", 180*resolution/pi, "partial of second axis coordinate w.r.t. y");
+
+  phout.addKey("Nx", Nx, "");
+  phout.addKey("Ny", Ny, "");
+  phout.addKey("range x", map_boundary_p2[0]-map_boundary_p1[0], "radians");
+  phout.addKey("RA", center[0], "radians");
+  phout.addKey("DEC", center[1], "radians");
+
+  if(verbose)
+    std::cout << phout << std::endl;
 #else
-	std::cerr << "Please enable the preprocessor flag ENABLE_FITS !" << std::endl;
-	exit(1);
+  std::cerr << "Please enable the preprocessor flag ENABLE_FITS !" << std::endl;
+  exit(1);
 #endif
 }

@@ -617,61 +617,61 @@
  * \brief Smoothes a map with a Gaussian kernel of width sigma (in arcseconds)
  */
 void PixelMap::smooth(PosType sigma){
-	PosType sum=0,**mask;
-	int ix,iy;
-	int Nmask,Nmask_half;
-	int j_cen, k_cen;
-
-	sigma /= 3600.*180/pi;
-	Nmask=2*(int)(3*sigma/resolution + 1);
-	std::cout << Nmask << std::endl;
-	if(Nmask < 4 ) std::cout << "WARNING: pixels are large compare to psf Nmask=" << Nmask << std::endl;
-
-	Nmask_half = int(Nmask/2);
-	mask = new PosType*[Nmask];
-	for (int j = 0; j <Nmask; j++)
-		mask[j] = new PosType[Nmask];
-
-	for(int j=0;j<Nmask;j++)
-	{
-		for(int k=0;k<Nmask;k++)
-		{
-			j_cen = j - Nmask_half;
-			k_cen = k - Nmask_half;
-			mask[j][k]= exp(-(pow(j_cen*resolution,2) + pow(k_cen*resolution,2))/2/pow(sigma,2) );
-			sum+=mask[j][k];
-		}
-	}
-	for(int j=0;j<Nmask;j++)
-	{
-		for(int k=0;k<Nmask;k++)
-		{
-			mask[j][k]/=sum;
-		}
-	}
-
-	std::valarray<PosType> map_out(0.0, map.size());
-
-	for(long i=0;i<map.size();i++){
-		for(int j=0;j<Nmask;j++){
-			ix=i%Nx + j-Nmask_half;
-			if( (ix>-1) && (ix<Nx) ){
-				for(int k=0;k<Nmask;k++){
-					iy=i/Nx + k-Nmask_half;
-					if( (iy>-1) && (iy<Ny) ){
-						map_out[ix+Nx*iy] += mask[j][k]*map[i];
-					}
-				}
-			}
-		}
-	}
-
-	using std::swap;
-	swap(map, map_out);
-
-	for (int j = 0; j <Nmask; j++)
-		delete[] mask[j];
-	delete[] mask;
+  PosType sum=0,**mask;
+  int ix,iy;
+  int Nmask,Nmask_half;
+  int j_cen, k_cen;
+
+  sigma /= 3600.*180/pi;
+  Nmask=2*(int)(3*sigma/resolution + 1);
+  std::cout << Nmask << std::endl;
+  if(Nmask < 4 ) std::cout << "WARNING: pixels are large compare to psf Nmask=" << Nmask << std::endl;
+
+  Nmask_half = int(Nmask/2);
+  mask = new PosType*[Nmask];
+  for (int j = 0; j <Nmask; j++)
+    mask[j] = new PosType[Nmask];
+
+  for(int j=0;j<Nmask;j++)
+  {
+    for(int k=0;k<Nmask;k++)
+    {
+      j_cen = j - Nmask_half;
+      k_cen = k - Nmask_half;
+      mask[j][k]= exp(-(pow(j_cen*resolution,2) + pow(k_cen*resolution,2))/2/pow(sigma,2) );
+      sum+=mask[j][k];
+    }
+  }
+  for(int j=0;j<Nmask;j++)
+  {
+    for(int k=0;k<Nmask;k++)
+    {
+      mask[j][k]/=sum;
+    }
+  }
+
+  std::valarray<PosType> map_out(0.0, map.size());
+
+  for(long i=0;i<map.size();i++){
+    for(int j=0;j<Nmask;j++){
+      ix=i%Nx + j-Nmask_half;
+      if( (ix>-1) && (ix<Nx) ){
+        for(int k=0;k<Nmask;k++){
+          iy=i/Nx + k-Nmask_half;
+          if( (iy>-1) && (iy<Ny) ){
+            map_out[ix+Nx*iy] += mask[j][k]*map[i];
+          }
+        }
+      }
+    }
+  }
+
+  using std::swap;
+  swap(map, map_out);
+
+  for (int j = 0; j <Nmask; j++)
+    delete[] mask[j];
+  delete[] mask;
 }

 /**
@@ -683,57 +683,57 @@
  * by including neighbor points.
  */
 void PixelMap::drawline(
-        PosType x1[]     /// one end point of line
-        ,PosType x2[]    /// other end point of line
-        ,PosType value   /// value that it is set to on the map
-                        ){
-
-	PosType x[2],s1,s2,r;
-	size_t index;
-	PosType d = 0;
-
-	r = sqrt( (x2[0] - x1[0])*(x2[0] - x1[0]) + (x2[1] - x1[1])*(x2[1] - x1[1]) );
-
-	if(r==0.0){
-		if(inMapBox(x1)){
-			//index = Utilities::IndexFromPosition(x1,Nx,range,center);
+                        PosType x1[]     /// one end point of line
+                        ,PosType x2[]    /// other end point of line
+                        ,PosType value   /// value that it is set to on the map
+){
+
+  PosType x[2],s1,s2,r;
+  size_t index;
+  PosType d = 0;
+
+  r = sqrt( (x2[0] - x1[0])*(x2[0] - x1[0]) + (x2[1] - x1[1])*(x2[1] - x1[1]) );
+
+  if(r==0.0){
+    if(inMapBox(x1)){
+      //index = Utilities::IndexFromPosition(x1,Nx,range,center);
       index = find_index(x1);
-			map[index] = value;
-		}
-		return;
-	}
-
-	s1 = (x2[0] - x1[0])/r;
-	s2 = (x2[1] - x1[1])/r;
-
-	x[0] = x1[0];
-	x[1] = x1[1];
-	while(d <= r){
-		if(inMapBox(x)){
-			//index = Utilities::IndexFromPosition(x,Nx,range,center);
+      map[index] = value;
+    }
+    return;
+  }
+
+  s1 = (x2[0] - x1[0])/r;
+  s2 = (x2[1] - x1[1])/r;
+
+  x[0] = x1[0];
+  x[1] = x1[1];
+  while(d <= r){
+    if(inMapBox(x)){
+      //index = Utilities::IndexFromPosition(x,Nx,range,center);
       index = find_index(x);
-			map[index] = value;
-		}
-		x[0] += s1*resolution;
-		x[1] += s2*resolution;
-		d += resolution;
-	}
-
-	return;
+      map[index] = value;
+    }
+    x[0] += s1*resolution;
+    x[1] += s2*resolution;
+    d += resolution;
+  }
+
+  return;
 }

 /**
  * \brief Draws a circle
  */
 void PixelMap::drawcircle(
-                        PosType r_center[]    /// center of circle
-                        ,PosType radius       ///  radius of circle
-                        ,PosType value        /// value that it is set to on the map
-                        ){
-
-	PosType x1[2],x2[2];
+                          PosType r_center[]    /// center of circle
+                          ,PosType radius       ///  radius of circle
+                          ,PosType value        /// value that it is set to on the map
+){
+
+  PosType x1[2],x2[2];
   PosType dtheta = resolution/fabs(radius);
-
+
   for(float theta = 0; theta < 2*pi; theta += dtheta){
     x1[0] = r_center[0] + radius*cos(theta);
     x1[1] = r_center[1] + radius*sin(theta);
@@ -741,8 +741,8 @@
     x2[1] = r_center[1] + radius*sin(theta+dtheta);
     drawline(x1,x2,value);
   }
-
-	return;
+
+  return;
 }
 void PixelMap::drawgrid(int N,PosType value){

@@ -800,24 +800,43 @@
  * that may have irregular cell sizes.  The last point will be connected to the first point.
  */
 void PixelMap::AddCurve(ImageInfo *curve,PosType value){
-	PosType x[2];
-
+  PosType x[2];
+
   if(curve->imagekist->Nunits() == 0 ) return;
-
-	curve->imagekist->MoveToTop();
-	x[0] = curve->imagekist->getCurrent()->x[0];
-	x[1] = curve->imagekist->getCurrent()->x[1];
-	curve->imagekist->Down();
-	for(;!(curve->imagekist->OffBottom());curve->imagekist->Down()){
-		drawline(x,curve->imagekist->getCurrent()->x,value);
-		x[0] = curve->imagekist->getCurrent()->x[0];
-		x[1] = curve->imagekist->getCurrent()->x[1];
-	}
-	curve->imagekist->MoveToTop();
-	drawline(x,curve->imagekist->getCurrent()->x,value);
-
-	return;
-}
+
+  curve->imagekist->MoveToTop();
+  x[0] = curve->imagekist->getCurrent()->x[0];
+  x[1] = curve->imagekist->getCurrent()->x[1];
+  curve->imagekist->Down();
+  for(;!(curve->imagekist->OffBottom());curve->imagekist->Down()){
+    drawline(x,curve->imagekist->getCurrent()->x,value);
+    x[0] = curve->imagekist->getCurrent()->x[0];
+    x[1] = curve->imagekist->getCurrent()->x[1];
+  }
+  curve->imagekist->MoveToTop();
+  drawline(x,curve->imagekist->getCurrent()->x,value);
+
+  return;
+}
+
+void PixelMap::AddCurve(std::vector<Point_2d> &curve,double value){
+  PosType x[2];
+
+  if(curve.size() == 0 ) return;
+
+  x[0] = curve[0][0];
+  x[1] = curve[0][1];
+  for(size_t ii=1;ii<curve.size();++ii){
+    drawline(x,curve[ii].x,value);
+    x[0] = curve[ii][0];
+    x[1] = curve[ii][1];
+  }
+  drawline(x,curve[0].x,value);
+
+  return;
+
+}
+

 /**
  *  \brief Fills in pixels where the image plane points in the grid are located with the value given
@@ -826,14 +845,14 @@
   PointList* list = grid.i_tree->pointlist;
   size_t index;

-  list->current = list->top;
+  PointList::iterator list_current(list->Top());
   do{
-    if(inMapBox(list->current->x)){
-      //index = Utilities::IndexFromPosition(list->current->x,Nx,Ny,range,center);
-      index = find_index(list->current->x);
+    if(inMapBox((*list_current)->x)){
+      index = find_index((*list_current)->x);
       map[index] = value;
     }
-  }while(MoveDownList(list));
+  }while(--list_current);
+
 }
 /**
  *  \brief Fills in pixels with the selected quantity from the grid points.
@@ -852,9 +871,10 @@

   exit(0);
   //***********************************************************************
-
+
   int Nblocks = 16;
   std::vector<PointList> lists(Nblocks);
+  PointList::iterator list_current;

   Kist<Point> kist;

@@ -863,13 +883,14 @@
   TreeStruct::iterator treeit(grid.i_tree);
   int i = 0;
   do{
-    //    if(grid.i_tree->current->level == 4){
     if((*treeit)->level == 4){
       assert(i < 16);
-      //lists[i].top = lists[i].current = grid.i_tree->current->points;
-      lists[i].top = lists[i].current = (*treeit)->points;
-      //lists[i].Npoints = grid.i_tree->current->npoints;
-      lists[i].Npoints = (*treeit)->npoints;
+      lists[i].setTop((*treeit)->points);
+       lists[i].setN((*treeit)->npoints);
+      list_current = lists[i].Top();
+      list_current.JumpDownList( (*treeit)->npoints -1);
+      lists[i].setBottom(*list_current);
+
       ++i;
       allowDecent = false;
     }else{
@@ -877,7 +898,7 @@
     }
     //  }while(grid.i_tree->TreeWalkStep(allowDecent) && i < Nblocks);
   }while(treeit.TreeWalkStep(allowDecent) && i < Nblocks);
-
+
   std::thread thr[16];

   for(int i = 0; i< Nblocks ;++i){
@@ -892,42 +913,43 @@
   double tmp,area;
   PosType tmp2[2];

-  list.current = list.top;
-  for(size_t i = 0; i< list.Npoints; ++i){
+  PointList::iterator pl_it(list.Top());
+  for(size_t i = 0; i< list.size(); ++i){
+
     switch (val) {
       case ALPHA:
-        tmp2[0] = list.current->x[0] - list.current->image->x[0];
-        tmp2[1] = list.current->x[1] - list.current->image->x[1];
+        tmp2[0] = (*pl_it)->x[0] - (*pl_it)->image->x[0];
+        tmp2[1] = (*pl_it)->x[1] - (*pl_it)->image->x[1];
         tmp = sqrt(tmp2[0]*tmp2[0] + tmp2[1]*tmp2[1])/resolution/resolution;
         break;
       case ALPHA1:
-        tmp = (list.current->x[0] - list.current->image->x[0])/resolution/resolution;
+        tmp = ((*pl_it)->x[0] - (*pl_it)->image->x[0])/resolution/resolution;
         break;
       case ALPHA2:
-        tmp = (list.current->x[1] - list.current->image->x[1])/resolution/resolution;
+        tmp = ((*pl_it)->x[1] - (*pl_it)->image->x[1])/resolution/resolution;
         break;
       case KAPPA:
-        tmp = list.current->kappa/resolution/resolution;
+        tmp = (*pl_it)->kappa/resolution/resolution;
         break;
       case GAMMA:
-        tmp2[0] = list.current->gamma[0];
-        tmp2[1] = list.current->gamma[1];
+        tmp2[0] = (*pl_it)->gamma[0];
+        tmp2[1] = (*pl_it)->gamma[1];
         tmp = sqrt(tmp2[0]*tmp2[0] + tmp2[1]*tmp2[1])/resolution/resolution;
         break;
       case GAMMA1:
-        tmp = list.current->gamma[0]/resolution/resolution;
+        tmp = (*pl_it)->gamma[0]/resolution/resolution;
         break;
       case GAMMA2:
-        tmp = list.current->gamma[1]/resolution/resolution;
+        tmp = (*pl_it)->gamma[1]/resolution/resolution;
         break;
       case GAMMA3:
-        tmp = list.current->gamma[2]/resolution/resolution;
+        tmp = (*pl_it)->gamma[2]/resolution/resolution;
         break;
       case INVMAG:
-        tmp = list.current->invmag/resolution/resolution;
+        tmp = (*pl_it)->invmag/resolution/resolution;
         break;
       case DT:
-        tmp = list.current->dt/resolution/resolution;
+        tmp = (*pl_it)->dt/resolution/resolution;
         break;
       default:
         std::cerr << "PixelMap::AddGrid() does not work for the input LensingVariable" << std::endl;
@@ -937,15 +959,16 @@
     }

     if(tmp != 0.0){
-      if( inMapBox(list.current->leaf) == true){
-        PointsWithinLeaf(list.current->leaf,neighborlist);
+      if( inMapBox((*pl_it)->leaf) == true){
+        PointsWithinLeaf((*pl_it)->leaf,neighborlist);
         for(it = neighborlist.begin();it != neighborlist.end();it++){
-          area = LeafPixelArea(*it,list.current->leaf);
+          area = LeafPixelArea(*it,(*pl_it)->leaf);
           map[*it] += tmp*area;
         }
       }
     }
-    MoveDownList(&list);
+    --pl_it;
+
   }
 }

@@ -959,7 +982,7 @@
                        ,PosType &arclength
                        ,PosType &width
                        ,PosType threshold    // threshold in pixal value
-                       ){
+){

   if(Nx != Ny){
     std::cout << "PixelMap::FindArc() Doesn't work on nonsquare maps" << std::endl;
@@ -969,7 +992,7 @@
   size_t j=0;
   long k=0;
   PosType const tmp_center[2] = {0,0};
-
+
   // mask pixels below threshhold
   PosType maxval = map[0],minval = map[0];
   for(size_t i=0;i<Nx*Nx;i++){
@@ -1023,7 +1046,7 @@
         rmax2 = MAX(rmax2,r2);

         if(r2 < RmaxSqr){
-            k = Utilities::locate<PosType>(R2,r2);
+          k = Utilities::locate<PosType>(R2,r2);
           if(k > -1 && k < Nr){
             //votes(ii,jj,k) += log(map[mask[m]]/minval);
             votes(ii,jj,k) += map[mask[m]];
@@ -1041,7 +1064,7 @@
   PosType maxvotes,secondvotes;
   maxvotes = votes(0);
   for(size_t kk=0;kk < Nc*Nc*Nr;++kk){
-
+
     if(votes(kk) >= maxvotes ){

       secondvotes = maxvotes;
@@ -1077,22 +1100,22 @@
   }
   xave[0] /= arclength;
   xave[1] /= arclength;
-
+
   double tmp = sqrt( (xave[0] - xc[0])*(xave[0] - xc[0]) + (xave[1] - xc[1])*(xave[1] - xc[1]) );
   arc_center[0] = radius*(xave[0] - xc[0])/tmp + xc[0];
   arc_center[1] = radius*(xave[1] - xc[1])/tmp + xc[1];
-
+
   // convert from pixel units to angular units
   width = MAX(rmax-rmin,1.0)*resolution;
   arclength *= resolution;
   radius *= resolution;
-
+
   xc[0] = xc[0]*resolution + center[0];
   xc[1] = xc[1]*resolution + center[1];
-
+
   arc_center[0] = arc_center[0]*resolution + center[0];
   arc_center[1] = arc_center[1]*resolution + center[1];
-
+
 }

 /** \brief Reads all the fits files in a directory into a vector of PixelMaps.
@@ -1106,7 +1129,7 @@
                                ,int maxN       /// maximum number of images that will be read in
                                ,double resolution  /// resolution (rad) of fits image if not given in fits file, use default or -1 otherwise
                                ,bool verbose   /// lists files to stdout
-                               ){
+){

   DIR *dp = opendir( dir.c_str() );
   struct dirent *dirp;
@@ -1158,14 +1181,14 @@
                                ,int maxN       /// maximum number of images that will be read in
                                ,double resolution  /// resolution (rad) of fits image if not given in fits file, use default or -1 otherwise
                                ,bool verbose   /// lists files to stdout
-                               ){
+){

   DIR *dp = opendir( dir.c_str() );
   struct dirent *dirp;
   struct stat filestat;
   std::string filepath,filename;
   size_t count = 0;
-
+

   if (dp == NULL)
   {
@@ -1205,10 +1228,10 @@
 }

 /** \brief Reads the file names in a directory that contain a specific sub string.
-
+
  */
 void Utilities::ReadFileNames(
-                               std::string dir              /// path to directory containing fits files
+                              std::string dir              /// path to directory containing fits files
                               ,const std::string filespec /// string of charactors in file name that are matched. It can be an empty string.
                               ,std::vector<std::string> & filenames  /// output vector of PixelMaps
                               ,bool verbose){
@@ -1247,26 +1270,26 @@
 }

 /*// get the index for a position, returns -1 if out of map
-long PixelMap::find_index(PosType const x[],long &ix,long &iy){
-  PosType fx, fy;
-
-  fx = (x[0] - center[0])/rangeX;
-  fy = (x[1] - center[1])/rangeY;
-  if(fabs(fx) > 0.5 || fabs(fy) > 0.5){
-    ix = iy = -1;
-    return -1;
-  }
-
-  fx = (fx + 0.5)*(Nx-1) + 0.5;
-  fy = (fy + 0.5)*(Ny-1) + 0.5;
-
-  ix = (long)(fx);
-  iy = (long)(fy);
-
-  if( (ix<Nx) && (iy<Ny) ) return ix+Nx*iy;
-  return -1;
-}
-*/
+ long PixelMap::find_index(PosType const x[],long &ix,long &iy){
+ PosType fx, fy;
+
+ fx = (x[0] - center[0])/rangeX;
+ fy = (x[1] - center[1])/rangeY;
+ if(fabs(fx) > 0.5 || fabs(fy) > 0.5){
+ ix = iy = -1;
+ return -1;
+ }
+
+ fx = (fx + 0.5)*(Nx-1) + 0.5;
+ fy = (fy + 0.5)*(Ny-1) + 0.5;
+
+ ix = (long)(fx);
+ iy = (long)(fy);
+
+ if( (ix<Nx) && (iy<Ny) ) return ix+Nx*iy;
+ return -1;
+ }
+ */

 /// get the index for a position, returns -1 if out of map
 long PixelMap::find_index(PosType const x[],long &ix,long &iy){
@@ -1337,7 +1360,7 @@
   }
   //x[0] = center[0] + rangeX*( 1.0*ix/(Nx-1) - 0.5);
   //x[1] = center[1] + rangeY*( iy*1.0/(Ny-1) - 0.5);
-
+
   x[0] = map_boundary_p1[0] + resolution*(ix + 0.5);
   x[1] = map_boundary_p1[1] + resolution*(iy + 0.5);
   return;
@@ -1392,7 +1415,7 @@
                                      ,std::size_t Nx    /// number of pixels on x-axis in the highest resolution grid
                                      ,std::size_t Ny    /// number of pixels on y-axis in the highest resolution grid
                                      ,double resolution /// highest resolution to be used, usually the final desired resolution
-                                     )
+)
 {
   throw std::runtime_error("does not conserve mass yet");

@@ -1418,7 +1441,7 @@
 MultiGridSmoother::MultiGridSmoother(double center[],std::size_t Nx,double resolution)
 {
   //throw std::runtime_error("does not conserve mass yet");
-
+
   if( (Nx & (Nx-1)) != 0){
     ERROR_MESSAGE();
     std::printf("ERROR: MultiGridSmoother, Nx must be a power of 2\n");
@@ -1431,7 +1454,7 @@
   while(Nx > 16 ){
     Nx /= 2;
     resolution *= 2;
-   // resolution = maps[0].getRangeX()/(Nx-1);
+    // resolution = maps[0].getRangeX()/(Nx-1);
     maps.push_back(PixelMap(center,Nx,resolution));
     interpolators.push_back(Utilities::Interpolator<PixelMap>(x,maps[k].getNx(),maps[k].getRangeX(),maps[k].getNy(),maps[k].getRangeX(),center));
   }
@@ -1475,7 +1498,7 @@
         --k;
         index = maps[k].find_index(x,ix,iy);
       }
-
+
       res = maps[k].getResolution();
       //PosType c[2] = {maps[k].getCenter()[0],maps[k].getCenter()[1]};
       //Utilities::Interpolator<PixelMap>
@@ -1510,7 +1533,7 @@
     size_t Nratio = map.getNx()/maps[k].getNx();
     //tmp = maps[k][ i + j*maps[k].getNx() ]/maps[k].getResolution()/maps[k].getResolution();
     tmp = maps[k].getResolution()*maps[k].getResolution();
-
+
     for(int ii = Nratio*i ; ii < Nratio*(i+1) ;++ii){
       for(int jj = Nratio*j ; jj < Nratio*(j+1) ; ++jj){
         // interpolate
@@ -1518,7 +1541,7 @@
         map.find_position(x, index);
         map[ index ] = maps[k].linear_interpolate(x)/tmp;
         //map[ index ] = tmp;
-
+
       }
     }


xStl: sarray: Removing unneeded __memcpy

Removing static function __memcpy which is not in used

Signed-off-by: Elad Raz <58e6b3a414a1e090dfc6029add0f3555ccba127f@eladraz.com>

--- Include/xStl/data/sarray.inl
+++ Include/xStl/data/sarray.inl
@@ -43,16 +43,6 @@
 #include "xStl/stream/basicIO.h"
 #include "xStl/os/os.h"

-static void __memcpy(void* dest,
-                 const void* src,
-                 uint size
-                 /*cWaitable wait*/)
-{
-    // reimplementing memcpy to avoid reentry
-    cOS::memcpy(dest, src, size);
-
-}
-
 template <class T>
 cSArray<T>::cSArray(uint numberOfElements /* = 0*/,
                     uint pageSize /* = 0*/) :
@@ -69,7 +59,7 @@
     ASSERT(staticArray != NULL);

     // Copy the array using memcpy
-    __memcpy(this->m_array, staticArray, this->m_size * sizeof(T));
+    cOS::memcpy(this->m_array, staticArray, this->m_size * sizeof(T));
 }

 template <class T>
@@ -88,7 +78,7 @@
     /* Fast copy array */
     this->freeArray();
     changeSize(other.getSize());
-    __memcpy(this->m_array, other.getBuffer(), this->m_size * sizeof(T));
+    cOS::memcpy(this->m_array, other.getBuffer(), this->m_size * sizeof(T));
 }

 template <class T>
@@ -113,8 +103,8 @@

 		    if (this->m_array != NULL)
 		    {
-                __memcpy(buffer, this->m_array,
-                       t_min(newSize, this->m_size) * sizeof(T));
+                cOS::memcpy(buffer, this->m_array,
+                            t_min(newSize, this->m_size) * sizeof(T));
 			    delete [] this->m_array;
 		    }

@@ -137,7 +127,7 @@
 void cSArray<T>::append(const T& object)
 {
 	changeSize(this->m_size + 1);
-    __memcpy(this->m_array + this->m_size - 1, &object, sizeof(T));
+    cOS::memcpy(this->m_array + this->m_size - 1, &object, sizeof(T));
 }

 template <class T>
@@ -151,7 +141,7 @@
 	changeSize(this->m_size + array.getSize());

     // Copy the elements
-    __memcpy(this->m_array + org_size, array.getBuffer(), sizeof(T)*add_size);
+    cOS::memcpy(this->m_array + org_size, array.getBuffer(), sizeof(T)*add_size);
 }

@@ -161,7 +151,7 @@
                            uint count)
 {
     changeSize(count, false);
-    __memcpy(this->m_array, other.getBuffer() + startLocation, count * sizeof(T));
+    cOS::memcpy(this->m_array, other.getBuffer() + startLocation, count * sizeof(T));
 }


Porting code to C & added memory table

Porting code to C & added memory table

--- core/src/PIFAlizator.cpp
+++ core/src/PIFAlizator.cpp
@@ -441,7 +441,7 @@
     for (MemoryTableIterator it = MemoryTable_begin(&this->LibraryAllocations); it != MemoryTable_end(&this->LibraryAllocations); ++it) {
         void *ptr = MemoryTable_key(&this->LibraryAllocations, it);
         if (ptr) {
-            fprintf(stderr, "WARNING: %i bytes at address %X allocate in static library was not freed\n", (int)MemoryTable_val(&this->LibraryAllocations, it), ptr);
+            fprintf(stderr, "WARNING: %i bytes at address %X allocated in static library was not freed\n", (int)MemoryTable_val(&this->LibraryAllocations, it), ptr);
             free(ptr);
         }
     }


Maybe we loop now, who knows.

Maybe we loop now, who knows.

--- Ascendgine/Audio.cpp
+++ Ascendgine/Audio.cpp
@@ -39,6 +39,7 @@
   FMOD::Sound* sound;
   system->createSound(filename, FMOD_SOFTWARE, 0, &sound);
   sound->setLoopCount(INT_MAX * (int)loop);
+  sound->setMode(loop ? FMOD_LOOP_NORMAL : FMOD_LOOP_OFF);

   system->playSound(FMOD_CHANNEL_FREE, sound, false, &pAudioObject->sound);
   pAudioObject->sound->setVolume(volume);


[Transparency][WIN] fix white popup on startup when specifying transparent window

--- src/browser/native_window_aura.cc
+++ src/browser/native_window_aura.cc
@@ -45,6 +45,7 @@
 #include "content/public/browser/native_web_keyboard_event.h"
 #include "content/public/browser/render_view_host.h"
 #include "content/browser/renderer_host/render_view_host_impl.h"
+#include "content/public/browser/render_widget_host_view.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/common/content_switches.h"
 #include "extensions/common/draggable_region.h"
@@ -498,6 +499,15 @@
     toolbar_->SchedulePaint();
   }

+  // this is needed to prevent white popup on startup
+  content::RenderWidgetHostView* rwhv = shell_->web_contents()->GetRenderWidgetHostView();
+  if (rwhv) {
+    if (transparent)
+      rwhv->SetBackgroundColor(SK_ColorTRANSPARENT);
+    else
+      rwhv->SetBackgroundColorToDefault();
+  }
+
   content::RenderViewHostImpl* rvh = static_cast<content::RenderViewHostImpl*>(shell_->web_contents()->GetRenderViewHost());
   if (rvh) {
     rvh->SetBackgroundOpaque(!transparent);


simplify

simplify

git-svn-id: 67bf12f30ddf2081c31403e0b02b2123541f1680@8992 08b3d480-bf2c-0410-a26f-811ee3361c24

--- src/bzflag/BackgroundRenderer.cxx
+++ src/bzflag/BackgroundRenderer.cxx
@@ -738,7 +738,7 @@

 void BackgroundRenderer::drawGroundCentered()
 {
-  const float InnerHalfWidth = 64.0f;
+//  const float InnerHalfWidth = 64.0f;
   const float groundSize = 10.0f * BZDBCache::worldSize;

   const ViewFrustum& frustum = RENDERER.getViewFrustum();
@@ -747,46 +747,35 @@
   const float repeat = BZDB.eval("groundHighResTexRepeat");

   // vertices
-  const float viXmin = center[0] - InnerHalfWidth;
-  const float viXmax = center[0] + InnerHalfWidth;
-  const float viYmin = center[1] - InnerHalfWidth;
-  const float viYmax = center[1] + InnerHalfWidth;
   const float voXmin = -groundSize;
   const float voXmax = +groundSize;
   const float voYmin = -groundSize;
   const float voYmax = +groundSize;
-  const GLfloat vertices[8][2] = {
-    {viXmin, viYmin}, {viXmax, viYmin}, {viXmin, viYmax}, {viXmax, viYmax},
-    {voXmin, voYmin}, {voXmax, voYmin}, {voXmin, voYmax}, {voXmax, voYmax}
+  const GLfloat vertices[5][2] = {
+    {center[0], center[1]},
+    {voXmin, voYmin}, {voXmax, voYmin}, {voXmax, voYmax}, {voXmin, voYmax}
   };

   // texcoords
   const float toffX = center[0] * repeat;
   const float toffY = center[1] * repeat;
-  const float tdist = InnerHalfWidth * repeat;
-  const float tiXmin = toffX - tdist;
-  const float tiXmax = toffX + tdist;
-  const float tiYmin = toffY - tdist;
-  const float tiYmax = toffY + tdist;
   const float toXmin = -groundSize * repeat;
   const float toXmax = +groundSize * repeat;
   const float toYmin = -groundSize * repeat;
   const float toYmax = +groundSize * repeat;
-  const GLfloat texcoords[8][2] = {
-    {tiXmin, tiYmin}, {tiXmax, tiYmin}, {tiXmin, tiYmax}, {tiXmax, tiYmax},
-    {toXmin, toYmin}, {toXmax, toYmin}, {toXmin, toYmax}, {toXmax, toYmax}
+  const GLfloat texcoords[5][2] = {
+    {toffX, toffY},
+    {toXmin, toYmin}, {toXmax, toYmin}, {toXmax, toYmax}, {toXmin, toYmax}
   };

-  GLubyte inside[] = { 0, 1, 2, 3 };
-  GLubyte outside[] = { 0, 4, 1, 5, 3, 7, 2, 6, 0, 4 };
+  GLubyte fan[6] = { 0, 1, 2, 3, 4, 1};

   glVertexPointer(2, GL_FLOAT, 0, vertices);
   glEnableClientState(GL_VERTEX_ARRAY);
   glTexCoordPointer(2, GL_FLOAT, 0, texcoords);
   glEnableClientState(GL_TEXTURE_COORD_ARRAY);

-  glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, inside);
-  glDrawElements(GL_TRIANGLE_STRIP, 10, GL_UNSIGNED_BYTE, outside);
+  glDrawElements(GL_TRIANGLE_FAN, 6, GL_UNSIGNED_BYTE, fan);

   glDisableClientState(GL_TEXTURE_COORD_ARRAY);
   glDisableClientState(GL_VERTEX_ARRAY);


removed unused array comment

removed unused array comment

--- barcode/include/barcode/pathingmapmenu.hpp
+++ barcode/include/barcode/pathingmapmenu.hpp
@@ -8,7 +8,5 @@
 	~PathingMapMenu();

 	void render(bool &closeBool, float delta, int sizeX, int sizeY);
-
-	//bool selected[32][32] = {false};
 private:
 };


INTEGRATION: CWS basmgr02 (1.5.2); FILE MERGED 2007/02/21 09:37:42 fs 1.5.2.1: #i73331# encapsulate (nearly) all usages of SfxObjectShell in the ScriptDocument class

--- basctl/source/basicide/localizationmgr.cxx
+++ basctl/source/basicide/localizationmgr.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: localizationmgr.cxx,v $
  *
- *  $Revision: 1.5 $
+ *  $Revision: 1.6 $
  *
- *  last change: $Author: rt $ $Date: 2007-02-01 11:45:39 $
+ *  last change: $Author: obo $ $Date: 2007-03-15 15:56:41 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -63,11 +63,11 @@

 LocalizationMgr::LocalizationMgr( BasicIDEShell* pIDEShell,
-    SfxObjectShell* pShell, String aLibName,
+    const ScriptDocument& rDocument, String aLibName,
     const Reference< XStringResourceManager >& xStringResourceManager )
         : m_xStringResourceManager( xStringResourceManager )
         , m_pIDEShell( pIDEShell )
-        , m_pShell( pShell )
+        , m_aDocument( rDocument )
         , m_aLibName( aLibName )
 {
 }
@@ -152,7 +152,7 @@

 void LocalizationMgr::implEnableDisableResourceForAllLibraryDialogs( HandleResourceMode eMode )
 {
-    Sequence< ::rtl::OUString > aDlgNames = BasicIDE::GetDialogNames( m_pShell, m_aLibName );
+    Sequence< ::rtl::OUString > aDlgNames = m_aDocument.getObjectNames( E_DIALOGS, m_aLibName );
     sal_Int32 nDlgCount = aDlgNames.getLength();
     const ::rtl::OUString* pDlgNames = aDlgNames.getConstArray();

@@ -160,7 +160,7 @@
     for( sal_Int32 i = 0 ; i < nDlgCount ; i++ )
     {
         String aDlgName = pDlgNames[ i ];
-        DialogWindow* pWin = m_pIDEShell->FindDlgWin( m_pShell, m_aLibName, aDlgName, FALSE );
+        DialogWindow* pWin = m_pIDEShell->FindDlgWin( m_aDocument, m_aLibName, aDlgName, FALSE );
         if( pWin && pWin->IsA( TYPE( DialogWindow ) ) )
         {
             DialogWindow* pDialogWin = static_cast< DialogWindow* >( pWin );
@@ -676,7 +676,7 @@
         enableResourceForAllLibraryDialogs();
     }

-    BasicIDE::MarkDocShellModified( m_pShell );
+    BasicIDE::MarkDocumentModified( m_aDocument );

     // update locale toolbar
     SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
@@ -732,7 +732,7 @@
     }
     if( bModified )
     {
-        BasicIDE::MarkDocShellModified( m_pShell );
+        BasicIDE::MarkDocumentModified( m_aDocument );

         // update slots
         SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
@@ -848,9 +848,12 @@
     DialogWindow* pDlgWin = FindDialogWindowForEditor( pEditor );
     if( !pDlgWin )
         return;
-    SfxObjectShell* pShell = pDlgWin->GetShell();
+    ScriptDocument aDocument( pDlgWin->GetDocument() );
+    DBG_ASSERT( aDocument.isValid(), "LocalizationMgr::setControlResourceIDsForNewEditorObject: invalid document!" );
+    if ( !aDocument.isValid() )
+        return;
     const String& rLibName = pDlgWin->GetLibName();
-    Reference< container::XNameContainer > xDialogLib = BasicIDE::GetDialogLibrary( pShell, rLibName, TRUE );
+    Reference< container::XNameContainer > xDialogLib( aDocument.getLibrary( E_DIALOGS, rLibName, TRUE ) );
     Reference< XStringResourceManager > xStringResourceManager =
         LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib );

@@ -865,7 +868,7 @@
           xDummyStringResolver, SET_IDS );

     if( nChangedCount )
-        BasicIDE::MarkDocShellModified( pShell );
+        BasicIDE::MarkDocumentModified( aDocument );
 }

 void LocalizationMgr::renameControlResourceIDsForEditorObject( DlgEditor* pEditor,
@@ -875,9 +878,12 @@
     DialogWindow* pDlgWin = FindDialogWindowForEditor( pEditor );
     if( !pDlgWin )
         return;
-    SfxObjectShell* pShell = pDlgWin->GetShell();
+    ScriptDocument aDocument( pDlgWin->GetDocument() );
+    DBG_ASSERT( aDocument.isValid(), "LocalizationMgr::renameControlResourceIDsForEditorObject: invalid document!" );
+    if ( !aDocument.isValid() )
+        return;
     const String& rLibName = pDlgWin->GetLibName();
-    Reference< container::XNameContainer > xDialogLib = BasicIDE::GetDialogLibrary( pShell, rLibName, TRUE );
+    Reference< container::XNameContainer > xDialogLib( aDocument.getLibrary( E_DIALOGS, rLibName, TRUE ) );
     Reference< XStringResourceManager > xStringResourceManager =
         LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib );

@@ -905,9 +911,12 @@
     DialogWindow* pDlgWin = FindDialogWindowForEditor( pEditor );
     if( !pDlgWin )
         return;
-    SfxObjectShell* pShell = pDlgWin->GetShell();
+    ScriptDocument aDocument( pDlgWin->GetDocument() );
+    DBG_ASSERT( aDocument.isValid(), "LocalizationMgr::deleteControlResourceIDsForDeletedEditorObject: invalid document!" );
+    if ( !aDocument.isValid() )
+        return;
     const String& rLibName = pDlgWin->GetLibName();
-    Reference< container::XNameContainer > xDialogLib = BasicIDE::GetDialogLibrary( pShell, rLibName, TRUE );
+    Reference< container::XNameContainer > xDialogLib( aDocument.getLibrary( E_DIALOGS, rLibName, TRUE ) );
     Reference< XStringResourceManager > xStringResourceManager =
         LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib );

@@ -918,16 +927,16 @@
           xDummyStringResolver, REMOVE_IDS_FROM_RESOURCE );

     if( nChangedCount )
-        BasicIDE::MarkDocShellModified( pShell );
-}
-
-void LocalizationMgr::setStringResourceAtDialog( SfxObjectShell* pShell, const String& aLibName,
+        BasicIDE::MarkDocumentModified( aDocument );
+}
+
+void LocalizationMgr::setStringResourceAtDialog( const ScriptDocument& rDocument, const String& aLibName,
     const String& aDlgName, Reference< container::XNameContainer > xDialogModel )
 {
     static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAscii( "ResourceResolver" );

     // Get library
-    Reference< container::XNameContainer > xDialogLib = BasicIDE::GetDialogLibrary( pShell, aLibName, TRUE );
+    Reference< container::XNameContainer > xDialogLib( rDocument.getLibrary( E_DIALOGS, aLibName, TRUE ) );
     Reference< XStringResourceManager > xStringResourceManager =
         LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib );

@@ -953,11 +962,11 @@
     }
 }

-void LocalizationMgr::renameStringResourceIDs( SfxObjectShell* pShell, const String& aLibName,
+void LocalizationMgr::renameStringResourceIDs( const ScriptDocument& rDocument, const String& aLibName,
     const String& aDlgName, Reference< container::XNameContainer > xDialogModel )
 {
     // Get library
-    Reference< container::XNameContainer > xDialogLib = BasicIDE::GetDialogLibrary( pShell, aLibName, TRUE );
+    Reference< container::XNameContainer > xDialogLib( rDocument.getLibrary( E_DIALOGS, aLibName, TRUE ) );
     Reference< XStringResourceManager > xStringResourceManager =
         LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib );
     if( !xStringResourceManager.is() )
@@ -984,11 +993,11 @@
     }
 }

-void LocalizationMgr::removeResourceForDialog( SfxObjectShell* pShell, const String& aLibName,
+void LocalizationMgr::removeResourceForDialog( const ScriptDocument& rDocument, const String& aLibName,
     const String& aDlgName, Reference< container::XNameContainer > xDialogModel )
 {
     // Get library
-    Reference< container::XNameContainer > xDialogLib = BasicIDE::GetDialogLibrary( pShell, aLibName, TRUE );
+    Reference< container::XNameContainer > xDialogLib( rDocument.getLibrary( E_DIALOGS, aLibName, TRUE ) );
     Reference< XStringResourceManager > xStringResourceManager =
         LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib );
     if( !xStringResourceManager.is() )
@@ -1050,9 +1059,12 @@
     DialogWindow* pDlgWin = FindDialogWindowForEditor( pEditor );
     if( !pDlgWin )
         return;
-    SfxObjectShell* pShell = pDlgWin->GetShell();
+    ScriptDocument aDocument( pDlgWin->GetDocument() );
+    DBG_ASSERT( aDocument.isValid(), "LocalizationMgr::moveResourcesForPastedEditorObject: invalid document!" );
+    if ( !aDocument.isValid() )
+        return;
     const String& rLibName = pDlgWin->GetLibName();
-    Reference< container::XNameContainer > xDialogLib = BasicIDE::GetDialogLibrary( pShell, rLibName, TRUE );
+    Reference< container::XNameContainer > xDialogLib( aDocument.getLibrary( E_DIALOGS, rLibName, TRUE ) );
     Reference< XStringResourceManager > xStringResourceManager =
         LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib );


Fix a bug in constraint matrix filling.

Fix a bug in constraint matrix filling.

--- src/QPSolver.cpp
+++ src/QPSolver.cpp
@@ -405,8 +405,9 @@
 		const Eigen::MatrixXd& A1 = eqConstr_[i]->AEq();
 		const Eigen::VectorXd& B1 = eqConstr_[i]->BEq();

-		A1_.block(nrEq_, 0, nrConstr, data_.nrVars_) = A1;
-		B1_.segment(nrEq_, nrConstr) = B1;
+		A1_.block(nrEq_, 0, nrConstr, data_.nrVars_) =
+			A1.block(0, 0, nrConstr, data_.nrVars_);
+		B1_.segment(nrEq_, nrConstr) = B1.head(nrConstr);

 		nrEq_ += nrConstr;
 	}
@@ -420,8 +421,9 @@
 		const Eigen::MatrixXd& A2 = inEqConstr_[i]->AInEq();
 		const Eigen::VectorXd& B2 = inEqConstr_[i]->BInEq();

-		A2_.block(nrInEq_, 0, nrConstr, data_.nrVars_) = A2;
-		B2_.segment(nrInEq_, nrConstr) = B2;
+		A2_.block(nrInEq_, 0, nrConstr, data_.nrVars_) =
+			A2.block(0, 0, nrConstr, data_.nrVars_);
+		B2_.segment(nrInEq_, nrConstr) = B2.head(nrConstr);

 		nrInEq_ += nrConstr;
 	}


Renderer: change initial camera position and scroll strep

--- src/Renderer.cpp
+++ src/Renderer.cpp
@@ -11,7 +11,7 @@
 #include <gli/gli.hpp>

 Renderer::Renderer(int width, int height) {
-    translate_z = -0.1f;
+    translate_z = -0.5f;
     rotate_x = 0.0;
     rotate_y = 0.0;

@@ -166,7 +166,7 @@
 }

 void Renderer::translate(float z) {
-    translate_z += z * 0.1;
+    translate_z += z * 0.01;
     updateModel();
 }


Highlight correct line while using mesa-driver

--- src/Renderer.cpp
+++ src/Renderer.cpp
@@ -181,14 +181,16 @@
     if(hasError){
         delete newShaderProgram;

-        QRegExp errorline(":[0-9]+:");
-        errorline.indexIn(error);
-        QString text = errorline.capturedTexts().at(0);
-        text.replace(":", "");
-        if(text.toInt()-3 > 0)
-            emit errored(error, text.toInt()-3);
-        else
-            emit errored(error, text.toInt());
+        //mac  :<line>:
+        //mesa :<line>(<errorcode>):
+        QRegExp errorline(":([0-9]+)(\\([0-9]+\\))?:");
+        if(errorline.indexIn(error) > -1){
+            QString text = errorline.cap(1);
+            if(text.toInt()-3 > 0)  // because: "#define lowp", "#define mediump" and "#define highp"
+                emit errored(error, text.toInt()-3);
+            else
+                emit errored(error, text.toInt());
+        }
         return false;
     }
     shaderProgramMutex.lock();


Fix remove legislator to update replicaset

--- src/parliament.cpp
+++ src/parliament.cpp
@@ -46,7 +46,7 @@
               {
                   legislators->Remove(op.replica);
                   std::ofstream replicasetfile(
-                      (fs::path(op.content) /
+                      (fs::path(location) /
                        fs::path(ReplicasetFilename)).string());
                   SaveReplicaSet(legislators, replicasetfile);
               }


Compatibility with Pinocchio v2.1.6

Compatibility with Pinocchio v2.1.6

--- src/center-of-mass-computation.cc
+++ src/center-of-mass-computation.cc
@@ -82,7 +82,11 @@
       // TODO as of now, it is not possible to access the template parameter
       // JointCollectionTpl of Model so we use the default one.
       typedef ::pinocchio::JacobianCenterOfMassBackwardStep<Model::Scalar,
-              Model::Options, JointCollectionTpl> Pass;
+              Model::Options, JointCollectionTpl
+#if PINOCCHIO_VERSION_AT_LEAST(2,1,6)
+              ,Data::Matrix3x
+#endif
+                > Pass;

       // Assume root is sorted from smallest id.
       // Nasty cast below, from (u-long) size_t to int.
@@ -95,7 +99,11 @@
           {
             if(computeJac)
               Pass::run(model.joints[jid],data.joints[jid],
-                      Pass::ArgsType(model,data,false));
+                      Pass::ArgsType(model,data,
+#if PINOCCHIO_VERSION_AT_LEAST(2,1,6)
+                        data.Jcom,
+#endif
+                        false));
             else
               {
                 assert(computeCOM);
@@ -117,7 +125,11 @@
             const JointIndex & parent = model.parents[jid];
             if(computeJac)
               Pass::run(model.joints[jid],data.joints[jid],
-                      Pass::ArgsType(model,data,false));
+                      Pass::ArgsType(model,data,
+#if PINOCCHIO_VERSION_AT_LEAST(2,1,6)
+                        data.Jcom,
+#endif
+                        false));
             else
               {
                 assert(computeCOM);


Default settings DSST

Default settings DSST

--- src/cf_libs/dsst/dsst_tracker.cpp
+++ src/cf_libs/dsst/dsst_tracker.cpp
@@ -3,8 +3,8 @@
 using namespace cf_tracking;

 DsstParameters::DsstParameters() :
-    padding(),
-    outputSigmaFactor(),
+    padding(1.6),
+    outputSigmaFactor(0.05),
     lambda(static_cast<double>(0.01)),
     learningRate(static_cast<double>(0.012)),
     templateSize(100),


should have been commited

should have been commited

--- NaoTHSoccer/Source/Cognition/Modules/Behavior/PathPlanner/PathPlanner.cpp
+++ NaoTHSoccer/Source/Cognition/Modules/Behavior/PathPlanner/PathPlanner.cpp
@@ -426,7 +426,7 @@
   getMotionRequest().walkRequest.stepControl.stepID            = getMotionStatus().stepControl.stepID;
   getMotionRequest().walkRequest.stepControl.type              = step_buffer.front().type;
   getMotionRequest().walkRequest.stepControl.time              = step_buffer.front().time;
-  getMotionRequest().walkRequest.stepControl.speedDirection    = Math::fromDegrees(step_buffer.front().speedDirection);
+  getMotionRequest().walkRequest.stepControl.speedDirection    = step_buffer.front().speedDirection;
   getMotionRequest().walkRequest.stepControl.target            = step_buffer.front().pose;
   getMotionRequest().walkRequest.stepControl.restriction       = step_buffer.front().restriction;
   getMotionRequest().walkRequest.stepControl.isProtected       = step_buffer.front().isProtected;


Disable pinning app list folder onto the shelf.

BUG=346534
R=xiyuan@chromium.org

Review URL: https://codereview.chromium.org/203093005

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@258041 0039d316-1c4b-4281-b951-d872f2087c98

--- ui/app_list/views/apps_grid_view.cc
+++ ui/app_list/views/apps_grid_view.cc
@@ -1506,6 +1506,9 @@
       drag_and_drop_host_->EndDrag(true);
     }
   } else {
+    if (IsFolderItem(drag_view_->item()))
+      return;
+
     // The event happened outside our app menu and we might need to dispatch.
     if (forward_events_to_drag_and_drop_host_) {
       // Dispatch since we have already started.


Tuning bin limits

Tuning bin limits

--- PWGLF/STRANGENESS/Cascades/AliAnalysisTaskStrangenessVsMultiplicityMC.cxx
+++ PWGLF/STRANGENESS/Cascades/AliAnalysisTaskStrangenessVsMultiplicityMC.cxx
@@ -1063,7 +1063,7 @@

   if(! fHistVZEROResponseStudyTotal ) {
     fHistVZEROResponseStudyTotal    = new TH2D(
-    "fHistVZEROResponseStudyTotal",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);
+    "fHistVZEROResponseStudyTotal",       "Generated;p_{T} (GeV/c); Mult",5000,0,500,lAmplitudeBins,0,lMaxAmplitude);
     fListHist->Add(fHistVZEROResponseStudyTotal); }

    //List of Histograms: Normal


Remove an old svn tag.

Remove an old svn tag.


Doxygen (\class was missing)

Doxygen (\class was missing)


Bind minmax computation strategies into Lua.

they are in the global namespace, so "MM_GLOBAL" can just be used
raw.

Due to a quirk with how this works, these constants are not
defined until you create a dataset.  It's complicated.

git-svn-id: 83c4c97093aeea62ac982fbfd516bf9db27f5c99@2565 c36c8488-0289-0348-9b64-b301f74bd9a7

--- LuaScripting/TuvokSpecific/LuaDatasetProxy.cpp
+++ LuaScripting/TuvokSpecific/LuaDatasetProxy.cpp
@@ -32,18 +32,16 @@

 #include <vector>

+#include "3rdParty/LUA/lua.hpp"
 #include "Controller/Controller.h"
-#include "3rdParty/LUA/lua.hpp"
+#include "IO/DynamicBrickingDS.h"
+#include "IO/FileBackedDataset.h"
 #include "IO/IOManager.h"
-#include "IO/FileBackedDataset.h"
 #include "IO/uvfDataset.h"
-
+#include "../LuaClassRegistration.h"
 #include "../LuaScripting.h"
-#include "../LuaClassRegistration.h"
-
+#include "LuaDatasetProxy.h"
 #include "LuaTuvokTypes.h"
-
-#include "LuaDatasetProxy.h"

 using namespace std;

@@ -165,7 +163,7 @@
 void LuaDatasetProxy::defineLuaInterface(
     LuaClassRegistration<LuaDatasetProxy>& reg,
     LuaDatasetProxy* me,
-    LuaScripting*)
+    LuaScripting* ss)
 {
   me->mReg = new LuaClassRegistration<LuaDatasetProxy>(reg);

@@ -175,6 +173,14 @@
   id = reg.function(&LuaDatasetProxy::getDatasetType, "getDSType", "", false);
   id = reg.function(&LuaDatasetProxy::proxyGetMetadata, "getMetadata", "",
                     false);
+
+  lua_State* L = ss->getLuaState();
+  lua_pushinteger(L, DynamicBrickingDS::MM_SOURCE);
+  lua_setglobal(L, "MM_SOURCE");
+  lua_pushinteger(L, DynamicBrickingDS::MM_PRECOMPUTE);
+  lua_setglobal(L, "MM_PRECOMPUTE");
+  lua_pushinteger(L, DynamicBrickingDS::MM_DYNAMIC);
+  lua_setglobal(L, "MM_DYNAMIC");
 }


Don't let a reactor start until its bcard has been insterted.

--- src/clustering/reactor/reactor.cc
+++ src/clustering/reactor/reactor.cc
@@ -185,6 +185,11 @@
 }

 template<class protocol_t>
+bool we_see_our_bcard(const std::map<peer_id_t, cow_ptr_t<reactor_business_card_t<protocol_t> > > &bcards, peer_id_t me) {
+    return std_contains(bcards, me);
+}
+
+template<class protocol_t>
 void reactor_t<protocol_t>::run_role(
         typename protocol_t::region_t region,
         current_role_t *role,
@@ -198,11 +203,17 @@
         //and interruptions... so we just unify those signals
         wait_any_t wait_any(&role->abort_roles, keepalive.get_drain_signal());

+        try {
+            directory_echo_mirror.get_internal()->run_until_satisfied(boost::bind(&we_see_our_bcard<protocol_t>, _1, get_me()), &wait_any);
+        } catch (const interrupted_exc_t &) {
+            goto CLEANUP;
+        }
         // guarantee(CLUSTER_CPU_SHARDING_FACTOR == svs_subview.num_stores());

         pmap(svs_subview.num_stores(), boost::bind(&reactor_t<protocol_t>::run_cpu_sharded_role, this, _1, role, region, &svs_subview, &wait_any, &role->abort_roles));
     }

+CLEANUP:
     //As promised, clean up the state from try_spawn_roles
     current_roles.erase(region);
     delete role;


Fixed error with normalization

Fixed error with normalization

Former-commit-id: cfb8fb813bac7396c17643b6f8584091d25699bc


coverity#738566 Uninitialized pointer field

Change-Id: I8eefe76a202c11858df0c5bddebfce3559ec8ca4


-ENH: implement computation of crc32 checksum on the final parameter vector, to facilitate testing (and comparison of registration results betweeen platforms). The crc checksum is written to the screen and log file.

--- src/Core/ComponentBaseClasses/elxOptimizerBase.hxx
+++ src/Core/ComponentBaseClasses/elxOptimizerBase.hxx
@@ -18,9 +18,8 @@
 #include "elxOptimizerBase.h"

 #include "itkSingleValuedNonLinearOptimizer.h"
+#include "itk_zlib.h"

-//#include <kwsys/MD5.h.in> // for MD5 hash
-//#include KWSYS_HEADER(MD5.h)

 namespace elastix
 {
@@ -93,26 +92,19 @@
 OptimizerBase<TElastix>
 ::AfterRegistrationBase( void )
 {
-//   /** Get the final parameters. */
-//   ParametersType finalTP = this->GetAsITKBaseType()->GetCurrentPosition();
-//
-//   /** Compute the MD5 Checksum. */
-//   unsigned char * md5InputData = reinterpret_cast<unsigned char *>( finalTP );
-//
-//   kwsysMD5* md5 = kwsysMD5_New();
-//   kwsysMD5_Initialize( md5 );
-//   kwsysMD5_Append( md5, md5InputData, md5InputData->GetSize() );
-//   unsigned char digest[16];
-//   kwsysMD5_Finalize( md5, digest );
-//   kwsysMD5_Delete( md5 );
-//
-// //   char md5out[33];
-// //   kwsysMD5_DigestToHex(digest, md5out);
-// //   md5out[32] = 0;
-//
-//   elxout << "\nRegistration result checksum: "
-//     << digest
-//     << std::endl;
+  typedef typename ParametersType::ValueType ParametersValueType;
+
+  /** Get the final parameters. */
+  ParametersType finalTP = this->GetAsITKBaseType()->GetCurrentPosition();
+
+  /** Compute the crc checksum using zlib crc32 function. */
+  const unsigned char * crcInputData = reinterpret_cast<const unsigned char *>( finalTP.data_block() );
+  uLong crc = crc32(0L, Z_NULL, 0);
+  crc = crc32(crc, crcInputData, finalTP.Size()* sizeof(ParametersValueType) );
+
+  elxout << "\nRegistration result checksum: "
+    << crc
+    << std::endl;

 } // end AfterRegistrationBase()


INTEGRATION: CWS warnings01 (1.20.6); FILE MERGED 2005/11/08 17:55:51 pl 1.20.6.3: #i53898# removed warnings 2005/11/07 19:35:45 pl 1.20.6.2: RESYNC: (1.20-1.21); FILE MERGED 2005/10/24 16:15:02 pl 1.20.6.1: #i55991# remove warnings for solaris platform

--- basegfx/source/polygon/b2dpolygontools.cxx
+++ basegfx/source/polygon/b2dpolygontools.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: b2dpolygontools.cxx,v $
  *
- *  $Revision: 1.21 $
+ *  $Revision: 1.22 $
  *
- *  last change: $Author: kz $ $Date: 2005-11-02 13:58:09 $
+ *  last change: $Author: hr $ $Date: 2006-06-20 03:43:59 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -1479,10 +1479,10 @@
             {
                 // in both directions full radius, use ellipse
                 const B2DPoint aCenter(rRect.getCenter());
-                const double fRadiusX(rRect.getWidth() / 2.0);
-                const double fRadiusY(rRect.getHeight() / 2.0);
-
-                return createPolygonFromEllipse( aCenter, fRadiusX, fRadiusY );
+                const double fRectRadiusX(rRect.getWidth() / 2.0);
+                const double fRectRadiusY(rRect.getHeight() / 2.0);
+
+                return createPolygonFromEllipse( aCenter, fRectRadiusX, fRectRadiusY );
             }
             else
             {
@@ -1665,7 +1665,6 @@
             OSL_ENSURE(fStart >= 0.0 && fStart <= 1.0, "appendUnitCircleQuadrant: Access out of range (!)");
             OSL_ENSURE(fEnd >= 0.0 && fEnd <= 1.0, "appendUnitCircleQuadrant: Access out of range (!)");
             OSL_ENSURE(fEnd >= fStart, "appendUnitCircleQuadrant: Access out of range (!)");
-            const double fZero(0.0);
             const double fOne(1.0);
             const bool bStartIsZero(fTools::equalZero(fStart));
             const bool bEndIsOne(fTools::equal(fEnd, fOne));
@@ -2631,10 +2630,10 @@
             const sal_uInt32 nCount( rPoly.count() );
             const double epsilon = ::std::numeric_limits<double>::epsilon();

-            for(unsigned int i=0; i<4; ++i)
-            {
-                const ::basegfx::B2DPoint &p1 = aPoints[i];
-                const ::basegfx::B2DPoint &p2 = aPoints[(i+1)%4];
+            for(unsigned int j=0; j<4; ++j)
+            {
+                const ::basegfx::B2DPoint &p1 = aPoints[j];
+                const ::basegfx::B2DPoint &p2 = aPoints[(j+1)%4];
                 bool bPointOnBoundary = false;
                 for( sal_uInt32 i=0; i<nCount; ++i )
                 {


ENH : forgive a change after texture functor refactoring

--- Testing/Code/BasicFilters/otbFunctionWithNeighborhoodToImageFilterNew.cxx
+++ Testing/Code/BasicFilters/otbFunctionWithNeighborhoodToImageFilterNew.cxx
@@ -18,13 +18,14 @@
 #include "itkExceptionObject.h"
 #include "itkNeighborhood.h"
 #include "otbImage.h"
-#include "itkVariableLengthVector.h"
-#include "itkConstNeighborhoodIterator.h"
+//#include "itkVariableLengthVector.h"
+//#include "itkConstNeighborhoodIterator.h"
 #include "otbTextureImageFunction.h"
 #include "otbFunctionWithNeighborhoodToImageFilter.h"
-#include "otbTextureFunctorBase.h"
+#include "itkOffset.h"
+//#include "otbTextureFunctorBase.h"

-template <class TIterInput1, class TIterInput2, class TOutput>
+template <class TInputScalarType, class TOutputScalarType>//IterInput1, class TIterInput2, class TOutput>
 class TextureFunctorTest
 {
 public:
@@ -34,26 +35,16 @@
   };
   ~TextureFunctorTest() {};

-  typedef TIterInput1                    IterType1;
-  typedef TIterInput2                    IterType2;
-  typedef TOutput                        OutputType;
-  typedef typename IterType1::OffsetType OffsetType;
-  typedef typename IterType1::InternalPixelType InternalPixelType;
-  typedef typename IterType1::ImageType  ImageType;
-  typedef itk::Neighborhood<InternalPixelType, ::itk::GetImageDimension<ImageType>::ImageDimension>    NeighborhoodType;
-
+  typedef itk::Offset<> OffsetType;
+  typedef itk::Neighborhood<TInputScalarType, 2>    NeighborhoodType;
+
   void SetOffset(OffsetType off){ m_Offset=off; };

-  inline TOutput operator()(const IterType1 &it, const IterType2 &itOff)
+  inline TOutputScalarType operator()(const NeighborhoodType &neigh)
     {
-      return static_cast<OutputType>(it.GetCenterPixel()[0]);
+      return static_cast<TOutputScalarType>(neigh.GetCenterValue());
     }

-  double ComputeOverSingleChannel(const NeighborhoodType &neigh, const NeighborhoodType &neighOff)
-  {
-    return 0.;
-  }
-
  private:
   OffsetType m_Offset;
 };
@@ -67,7 +58,7 @@
   typedef itk::VariableLengthVector<double>         VectorType;
   typedef itk::ConstNeighborhoodIterator<ImageType> IteratorType;

-  typedef TextureFunctorTest<IteratorType, IteratorType, VectorType>                     FunctorType;
+  typedef TextureFunctorTest<PixelType, PixelType>                                       FunctorType;
   typedef otb::TextureImageFunction<ImageType, FunctorType>                              FunctionType;
   typedef otb::FunctionWithNeighborhoodToImageFilter<ImageType, ImageType, FunctionType> FilterType;


Implement sharing of dependency nodes, and graph insertion

--- src/Resolver.cpp
+++ src/Resolver.cpp
@@ -1,70 +1,226 @@
 #include "Resolver.h"

+#include "Hash.h"
 #include "Requirement.h"

 #include <cassert>
 #include <exception>
-#include <map>
-#include <set>
 #include <stdexcept>
+#include <unordered_map>
+#include <unordered_set>

 using namespace Arbiter;
 using namespace Resolver;

 namespace {

-struct DependencyNode final
+/**
+ * A node in, or being considered for, an acyclic dependency graph.
+ */
+class DependencyNode final
 {
   public:
+    struct Hash final
+    {
+      public:
+        size_t operator() (const DependencyNode &node) const
+        {
+          return hashOf(node._project);
+        }
+    };
+
     const ArbiterProjectIdentifier _project;
+
+    /**
+     * The version of the dependency that this node represents.
+     *
+     * This version is merely "proposed" because it depends on the final
+     * resolution of the graph, as well as whether any "better" graphs exist.
+     */
     const ArbiterSelectedVersion _proposedVersion;
-
-    std::unique_ptr<ArbiterRequirement> _requirement;
-    std::set<DependencyNode> _dependencies;

     DependencyNode (ArbiterProjectIdentifier project, ArbiterSelectedVersion proposedVersion, const ArbiterRequirement &requirement)
       : _project(std::move(project))
       , _proposedVersion(std::move(proposedVersion))
-      , _requirement(requirement.clone())
-    {
-      assert(_requirement->satisfiedBy(_proposedVersion._semanticVersion));
-    }
+      , _state(std::make_shared<State>())
+    {
+      setRequirement(requirement);
+    }
+
+    DependencyNode (const DependencyNode &other) noexcept
+      : _project(other._project)
+      , _proposedVersion(other._proposedVersion)
+      , _state(other._state)
+    {}
+
+    DependencyNode (DependencyNode &&other) noexcept
+      : _project(other._project)
+      , _proposedVersion(other._proposedVersion)
+      , _state(std::move(other._state))
+    {}
+
+    DependencyNode &operator= (const DependencyNode &other) = delete;
+    DependencyNode &operator= (DependencyNode &&other) = delete;

     bool operator== (const DependencyNode &other) const
     {
-      return _project == other._project && _proposedVersion == other._proposedVersion;
-    }
-
-    bool operator< (const DependencyNode &other) const
-    {
-      if (_project != other._project) {
-        // There's no well-defined ordering between nodes for different
-        // projects, and we don't want them to appear equal within a set.
-        return true;
-      }
-
-      // Sort such that higher versions are tried first.
-      return _proposedVersion > other._proposedVersion;
-    }
+      // For the purposes of node lookup in a graph, this is the only field
+      // which matters.
+      return _project == other._project;
+    }
+
+    /**
+     * The current requirement(s) applied to this dependency.
+     *
+     * This specifier may change as the graph is added to, and the requirements
+     * become more stringent.
+     */
+    const ArbiterRequirement &requirement () const noexcept
+    {
+      return *_state->_requirement;
+    }
+
+    void setRequirement (const ArbiterRequirement &requirement)
+    {
+      setRequirement(requirement.clone());
+    }
+
+    void setRequirement (std::unique_ptr<ArbiterRequirement> requirement)
+    {
+      assert(requirement);
+      assert(requirement->satisfiedBy(_proposedVersion._semanticVersion));
+
+      _state->_requirement = std::move(requirement);
+    }
+
+    std::unordered_set<DependencyNode, Hash> &dependencies () noexcept
+    {
+      return _state->_dependencies;
+    }
+
+    const std::unordered_set<DependencyNode, Hash> &dependencies () const noexcept
+    {
+      return _state->_dependencies;
+    }
+
+  private:
+    struct State final
+    {
+      public:
+        std::unique_ptr<ArbiterRequirement> _requirement;
+        std::unordered_set<DependencyNode, Hash> _dependencies;
+    };
+
+    std::shared_ptr<State> _state;
 };

 std::ostream &operator<< (std::ostream &os, const DependencyNode &node)
 {
   return os
     << node._project << " @ " << node._proposedVersion
-    << " (restricted to " << *node._requirement << ")";
-}
-
+    << " (restricted to " << node.requirement() << ")";
+}
+
+} // namespace
+
+namespace std {
+
+template<>
+struct hash<DependencyNode> final
+{
+  public:
+    size_t operator() (const DependencyNode &node) const
+    {
+      return DependencyNode::Hash()(node);
+    }
+};
+
+} // namespace std
+
+namespace {
+
+/**
+ * Represents an acyclic dependency graph in which each project appears at most
+ * once.
+ *
+ * Dependency graphs can exist in an incomplete state, but will never be
+ * inconsistent (i.e., include versions that are known to be invalid given the
+ * current graph).
+ */
 class DependencyGraph final
 {
   public:
-    std::set<DependencyNode> _allNodes;
-    std::map<DependencyNode, std::set<DependencyNode>> _edges;
-    std::set<DependencyNode> _roots;
+    /**
+     * A full list of all nodes included in the graph.
+     */
+    std::unordered_set<DependencyNode> _allNodes;
+
+    /**
+     * Maps between nodes in the graph and their immediate dependencies.
+     */
+    std::unordered_map<DependencyNode, std::unordered_set<DependencyNode>> _edges;
+
+    /**
+     * The root nodes of the graph (i.e., those dependencies that are listed by
+     * the top-level project).
+     */
+    std::unordered_set<DependencyNode> _roots;

     bool operator== (const DependencyGraph &other) const
     {
       return _edges == other._edges && _roots == other._roots;
+    }
+
+    /**
+     * Attempts to add the given node into the graph, as a dependency of
+     * `dependent` if specified.
+     *
+     * If the given node refers to a project which already exists in the graph,
+     * this method will attempt to intersect the version requirements of both.
+     *
+     * Returns a pointer to the node as actually inserted into the graph (which
+     * may be different from the node passed in), or `nullptr` if this addition
+     * would make the graph inconsistent.
+     */
+    DependencyNode *addNode (const DependencyNode &inputNode, const DependencyNode *dependent)
+    {
+      auto nodeInsertion = _allNodes.insert(inputNode);
+
+      // Unordered collections rightly discourage mutation so hashes don't get
+      // invalidated, but we've already handled this in the implementation of
+      // DependencyNode.
+      DependencyNode &insertedNode = const_cast<DependencyNode &>(*nodeInsertion.first);
+
+      // If no insertion was actually performed, we need to unify our input with
+      // what was already there.
+      if (!nodeInsertion.second) {
+        if (auto newRequirement = insertedNode.requirement().intersect(inputNode.requirement())) {
+          if (!newRequirement->satisfiedBy(insertedNode._proposedVersion._semanticVersion)) {
+            // This strengthened requirement invalidates the version we've
+            // proposed in this graph, so the graph would become inconsistent.
+            return nullptr;
+          }
+
+          insertedNode.setRequirement(std::move(newRequirement));
+        } else {
+          // If intersecting the requirements is impossible, the versions
+          // currently shouldn't be able to match.
+          //
+          // Notably, though, Carthage does permit scenarios like this when
+          // pinned to a branch. Arbiter doesn't support requirements like this
+          // right now, but may in the future.
+          assert(inputNode._proposedVersion != insertedNode._proposedVersion);
+          return nullptr;
+        }
+      }
+
+      if (dependent) {
+        _edges[*dependent].insert(insertedNode);
+      } else {
+        _roots.insert(insertedNode);
+      }
+
+      return &insertedNode;
     }
 };


Completing const iterator.

Completing const iterator.

--- src/RowRange.hpp
+++ src/RowRange.hpp
@@ -22,11 +22,18 @@
             CV_DbgAssert(position >= 0 && position <= data.rows + 1);
         }

+        // Dereference
         const cv::Mat_<T>& operator*() const
         {
             return row;
         }

+        const cv::Mat_<T>* operator->() const
+        {
+            return &row;
+        }
+
+        // Logical comparison
         bool operator==(const RowRangeConstIterator& that) const
         {
             return this->position == that.position;
@@ -56,6 +63,22 @@
         {
             return !(*this < that);
         }
+
+        // Increment
+        RowRangeConstIterator& operator++()
+        {
+            ++position;
+            return *this;
+        }
+
+        RowRangeConstIterator operator++(int) const
+        {
+            RowRangeConstIterator tmp(*this);
+            ++(*this);
+            return tmp;
+        }
+
+

     protected:
         const cv::Mat_<T>& data;


RunClang: Tolerate __builtin_assume_aligned declaration in MSVC header

MSVC tools 14.23 and above declare `__builtin_assume_aligned` in
`intrin0.h` with a signature incompatible with Clang's builtin.  It is
guarded by `!defined(__clang__)` but that breaks when we simulate MSVC's
preprocessor.  Rename the builtin via preprocessing to avoid the
conflict.

--- src/RunClang.cxx
+++ src/RunClang.cxx
@@ -285,6 +285,17 @@
                     "  char x[16] __attribute__((aligned(16))); "
                     "} __castxml__float128;\n"
                     "#define __float128 __castxml__float128\n";
+      }
+
+      if (CI.getLangOpts().MSCompatibilityVersion >= 192300000) {
+        // MSVC tools 14.23 and above declare __builtin_assume_aligned
+        // in "intrin0.h" with a signature incompatible with Clang's
+        // builtin.  It is guarded by '!defined(__clang__)' but that
+        // breaks when we simulate MSVC's preprocessor.  Rename the
+        // builtin via preprocessing to avoid the conflict.
+        builtins += "\n"
+                    "#define __builtin_assume_aligned"
+                    " __castxml__builtin_assume_aligned\n";
       }

       // Provide __is_assignable builtin if simulating MSVC.


Useless line in onAccept and should be removed. (#5299)

Remove unused variable assignment in ConnectionHandlerImpl::ActiveListener::onAccept

Risk Level: Low
Testing: no test
Docs Changes: no doc change
Release Notes: no release note
Fixes: #5277

Signed-off-by: jianghongke <9a900be03914921de9c2f892b78eaec63a6e42a4@tencent.com>

--- source/server/connection_handler_impl.cc
+++ source/server/connection_handler_impl.cc
@@ -207,7 +207,6 @@

 void ConnectionHandlerImpl::ActiveListener::onAccept(
     Network::ConnectionSocketPtr&& socket, bool hand_off_restored_destination_connections) {
-  Network::Address::InstanceConstSharedPtr local_address = socket->localAddress();
   auto active_socket = std::make_unique<ActiveSocket>(*this, std::move(socket),
                                                       hand_off_restored_destination_connections);


renderer: fix highlight_clickable_areas

renderer: fix highlight_clickable_areas

--- src/components/renderer.cpp
+++ src/components/renderer.cpp
@@ -734,7 +734,7 @@
     double h = m_rect.height;

     m_context->save();
-    *m_context << CAIRO_OPERATOR_DIFFERENCE << (n % 2 ? 0xFF00FF00 : 0xFFFF0000);
+    *m_context << CAIRO_OPERATOR_DIFFERENCE << (n % 2 ? rgba{0xFF00FF00} :rgba{0xFFFF0000});
     *m_context << cairo::rect{x, y, w, h};
     m_context->fill();
     m_context->restore();


COFF: Add some error checking to SymbolTable::addCombinedLTOObject().

git-svn-id: f6089bf0e6284f307027cef4f64114ee9ebb0424@240511 91177308-0d34-0410-b5e6-96231b3b80d8

--- COFF/SymbolTable.cpp
+++ COFF/SymbolTable.cpp
@@ -287,7 +287,8 @@
     // We may see new references to runtime library symbols such as __chkstk
     // here. These symbols must be wholly defined in non-bitcode files.
     if (auto *B = dyn_cast<Lazy>(Sym->Body))
-      addMemberFile(B);
+      if (auto EC = addMemberFile(B))
+        return EC;
   }

   size_t NumBitcodeFiles = BitcodeFiles.size();


VFS-6130 Added IOBuf coalesce before writes

--- src/posixHelper.cc
+++ src/posixHelper.cc
@@ -290,11 +290,19 @@
         return;
     }

-    auto iov = op.buf.front()->getIov();
+    auto iobuf = op.buf.empty() ? folly::IOBuf::create(0) : op.buf.move();
+    if (iobuf->isChained()) {
+        LOG_DBG(2) << "Coalescing chained buffer at offset " << op.offset
+                   << " of size: " << iobuf->length();
+        iobuf->unshare();
+        iobuf->coalesce();
+    }
+
+    auto iov = iobuf->getIov();
     auto iov_size = iov.size();
     auto size = 0;

-    LOG_DBG(2) << "Attempting to write " << op.buf.chainLength()
+    LOG_DBG(2) << "Attempting to write " << iobuf->length()
                << " bytes at offset " << op.offset << " to file "
                << handle->m_fileId;

@@ -307,7 +315,7 @@
             [](int result) { return result != -1; });

         if (res == -1) {
-            LOG_DBG(1) << "Writing to file " << handle->m_fileId
+            LOG(ERROR) << "Writing to file " << handle->m_fileId
                        << " failed with error " << errno;
             ONE_METRIC_COUNTER_INC("comp.helpers.mod.posix.errors.write");
             op.promise.setException(makePosixException(errno));
@@ -316,7 +324,8 @@
         size += res;
     }

-    LOG_DBG(2) << "Written " << size << " bytes to file " << handle->m_fileId;
+    LOG_DBG(2) << "Written " << size << " bytes to file " << handle->m_fileId
+               << " at offset " << op.offset;

     ONE_METRIC_TIMERCTX_STOP(op.timer, size);


Fixed grid lines for bar charts

Fixed grid lines for bar charts

--- src/wxchartgrid.cpp
+++ src/wxchartgrid.cpp
@@ -87,21 +87,28 @@

 void wxChartGrid::Draw(wxGraphicsContext &gc)
 {
-	Fit(gc);
-
-	wxDouble yLabelGap = (m_mapping.GetStartPoint().m_y - m_mapping.GetEndPoint().m_y) / m_steps;
-	wxDouble xStart = m_mapping.GetLeftPadding();
+	Fit(gc);

 	if (m_options.ShowHorizontalLines())
 	{
-		for (size_t i = 1; i < m_YAxis->GetNumberOfTickMarks(); ++i)
-		{
-			wxDouble yLabelCenter = m_mapping.GetStartPoint().m_y - (yLabelGap * i);
+		const wxChartAxis* verticalAxis = 0;
+		if (m_XAxis->GetOptions().GetPosition() == wxCHARTAXISPOSITION_LEFT)
+		{
+			verticalAxis = m_XAxis.get();
+		}
+		else if (m_YAxis->GetOptions().GetPosition() == wxCHARTAXISPOSITION_LEFT)
+		{
+			verticalAxis = m_YAxis.get();
+		}
+
+		for (size_t i = 1; i < verticalAxis->GetNumberOfTickMarks(); ++i)
+		{
+			wxDouble yLabelCenter = verticalAxis->GetTickMarkPosition(i).m_y;
 			wxDouble linePositionY = yLabelCenter;

 			wxGraphicsPath path = gc.CreatePath();
-			path.MoveToPoint(xStart, linePositionY);
-			path.AddLineToPoint(m_mapping.GetSize().GetWidth() - m_mapping.GetRightPadding() + m_XAxis->GetOptions().GetOverhang(), linePositionY);
+			path.MoveToPoint(m_mapping.GetLeftPadding(), linePositionY);
+			path.AddLineToPoint(m_mapping.GetSize().GetWidth() - m_mapping.GetRightPadding() + verticalAxis->GetOptions().GetOverhang(), linePositionY);

 			wxPen pen1(m_options.GetGridLineColor(), m_options.GetGridLineWidth());
 			gc.SetPen(pen1);
@@ -111,13 +118,23 @@

 	if (m_options.ShowVerticalLines())
 	{
-		for (size_t i = 1; i < m_XAxis->GetNumberOfTickMarks(); ++i)
-		{
-			wxDouble linePosition = m_XAxis->GetTickMarkPosition(i).m_x;
+		const wxChartAxis* horizontalAxis = 0;
+		if (m_XAxis->GetOptions().GetPosition() == wxCHARTAXISPOSITION_BOTTOM)
+		{
+			horizontalAxis = m_XAxis.get();
+		}
+		else if (m_YAxis->GetOptions().GetPosition() == wxCHARTAXISPOSITION_BOTTOM)
+		{
+			horizontalAxis = m_YAxis.get();
+		}
+
+		for (size_t i = 1; i < horizontalAxis->GetNumberOfTickMarks(); ++i)
+		{
+			wxDouble linePosition = horizontalAxis->GetTickMarkPosition(i).m_x;

 			wxGraphicsPath path = gc.CreatePath();
 			path.MoveToPoint(linePosition, m_mapping.GetStartPoint().m_y);
-			path.AddLineToPoint(linePosition, m_mapping.GetEndPoint().m_y - m_YAxis->GetOptions().GetOverhang());
+			path.AddLineToPoint(linePosition, m_mapping.GetEndPoint().m_y - horizontalAxis->GetOptions().GetOverhang());

 			wxPen pen1(m_options.GetGridLineColor(), m_options.GetGridLineWidth());
 			gc.SetPen(pen1);


Introduce SAVEPOINT and CHECKPOINT storage reasons

Former-commit-id: 9ccb8ad3522b1c718ce6297b2f8d843b36d24f05

--- source/tools/finite/io/h5dset.cpp
+++ source/tools/finite/io/h5dset.cpp
@@ -37,9 +37,9 @@

 int tools::finite::io::h5dset::decide_layout(std::string_view prefix_path) {
-    return H5D_CHUNKED; // Let everything be chunked a while. When resuming, rewriting into checkpoint/iter_? can lead datasets of different sizes
+    return H5D_CHUNKED; // Let everything be chunked a while. When resuming, rewriting into savepoint/iter_? can lead datasets of different sizes
     std::string str(prefix_path);
-    std::regex  rx(R"(checkpoint/iter_[0-9])"); // Declare the regex with a raw string literal
+    std::regex  rx(R"(savepoint/iter_[0-9])"); // Declare the regex with a raw string literal
     std::smatch m;
     if(regex_search(str, m, rx)) return H5D_CONTIGUOUS;
     else


Update bitcoin.cpp

Update bitcoin.cpp

--- src/qt/bitcoin.cpp
+++ src/qt/bitcoin.cpp
@@ -1,6 +1,7 @@
 /*
  * W.J. van der Laan 2011-2012
  * The PPCoin Developers 2013
+ * The Platinum Developers 2013-2014
  */
 #include "bitcoingui.h"
 #include "clientmodel.h"


INTEGRATION: CWS dba16 (1.10.66); FILE MERGED 2004/10/11 11:38:54 oj 1.10.66.1: #i30220# enable having, group by for queries

--- connectivity/inc/connectivity/PColumn.hxx
+++ connectivity/inc/connectivity/PColumn.hxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: PColumn.hxx,v $
  *
- *  $Revision: 1.10 $
+ *  $Revision: 1.11 $
  *
- *  last change: $Author: vg $ $Date: 2003-12-16 12:26:58 $
+ *  last change: $Author: rt $ $Date: 2004-10-22 08:40:26 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -81,6 +81,7 @@
             ::rtl::OUString m_aTableName;
             sal_Bool        m_bFunction;
             sal_Bool        m_bDbasePrecisionChanged;
+            sal_Bool        m_bAggregateFunction;
         protected:
             virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const;
             virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
@@ -104,6 +105,7 @@
             void setRealName(const ::rtl::OUString& _rName)  { m_aRealName  = _rName; }
             void setTableName(const ::rtl::OUString& _rName) { m_aTableName = _rName; }
             void setFunction(sal_Bool _bFunction)            { m_bFunction  = _bFunction; }
+            void setAggregateFunction(sal_Bool _bFunction)   { m_bAggregateFunction = _bFunction; }
             void setDbasePrecisionChanged(sal_Bool _bDbasePrecisionChanged) { m_bDbasePrecisionChanged = _bDbasePrecisionChanged; }

             ::rtl::OUString getRealName() const { return  m_aRealName; }