//---------------------------------------------------------------------

        private void WriteMap(string speciesName,
                              MaxAgeCalculator maxAgeCalculator)
        {
            IOutputRaster <AgePixel> map = CreateMap(speciesName);

            using (map) {
                AgePixel pixel        = new AgePixel();
                Location location_1_1 = new Location(1, 1);
                foreach (Site site in modelCore.Landscape.AllSites)
                {
                    ushort age;
                    if (site.IsActive)
                    {
                        ActiveSite activeSite = (ActiveSite)site;
                        if (activeSite.SharesData)
                        {
                            Location blockLocation = activeSite.BroadScaleLocation;
                            if (activeSite.LocationInBlock == location_1_1)
                            {
                                age = maxAgeCalculator.ComputeMaxAge(activeSite);
                                ageBuffer[blockLocation.Column] = age;
                            }
                            else
                            {
                                // already computed age for the block
                                age = ageBuffer[blockLocation.Column];
                            }
                        }
                        else
                        {
                            age = maxAgeCalculator.ComputeMaxAge(activeSite);
                        }
                    }
                    else
                    {
                        // inactive site
                        age = 0;
                    }
                    pixel.Band0 = age;
                    map.WritePixel(pixel);
                }
            }
        }
 //---------------------------------------------------------------------
 private void WriteMap(string           speciesName,
     MaxAgeCalculator maxAgeCalculator)
 {
     IOutputRaster<AgePixel> map = CreateMap(speciesName);
     using (map) {
         AgePixel pixel = new AgePixel();
         Location location_1_1 = new Location(1,1);
         foreach (Site site in modelCore.Landscape.AllSites) {
             ushort age;
             if (site.IsActive) {
                 ActiveSite activeSite = (ActiveSite) site;
                 if (activeSite.SharesData) {
                     Location blockLocation = activeSite.BroadScaleLocation;
                     if (activeSite.LocationInBlock == location_1_1) {
                         age = maxAgeCalculator.ComputeMaxAge(activeSite);
                         ageBuffer[blockLocation.Column] = age;
                     }
                     else {
                         // already computed age for the block
                         age = ageBuffer[blockLocation.Column];
                     }
                 }
                 else {
                     age = maxAgeCalculator.ComputeMaxAge(activeSite);
                 }
             }
             else {
                 // inactive site
                 age = 0;
             }
             pixel.Band0 = age;
             map.WritePixel(pixel);
         }
     }
 }