Angel \”Java\” Lopez on Blog

December 17, 2008

Fractal application revisited

Filed under: .NET, C Sharp — ajlopez @ 9:46 am

This year, I wrote a fractal demo application using DSS/CCR

Distributed Agents and Fractals using DSS/VPL

Now, I’m exploring parallel execution using Task Parallel Library, threads, or MPI (Message Passing Interface). But before writing new versions of fractal app using parallel programming, I added to my ajcodekatas Google code, a base application, WinForm Fractal, that generates fractal images using the GUI thread:

http://code.google.com/p/ajcodekatas/source/browse/#svn/trunk/FractalExample

 

There is a class library, with core classes, and a WinForm project, that uses a Calculator object to calculate a Sector of fractal. An excerpt of that invocation:

 

private void Calculate() { Bitmap bitmap = new Bitmap(pcbFractal.Width, pcbFractal.Height); pcbFractal.Image = bitmap; pcbFractal.Refresh(); realWidth = realDelta * pcbFractal.Width; imgHeight = imgDelta * pcbFractal.Height; realMin = realCenter - realWidth / 2; imgMin = imgCenter - imgHeight / 2; int width = pcbFractal.Width; int height = pcbFractal.Height; SectorInfo sectorinfo = new SectorInfo() { FromX = 0, FromY = 0, Width = width, Height = height, RealMinimum = realMin, ImgMinimum = imgMin, Delta = realDelta, MaxIterations = colors.Length, MaxValue = 4 }; Calculator calculator = new Calculator(); Sector sector = calculator.CalculateSector(sectorinfo); this.DrawValues(sector.FromX, sector.FromY, sector.Width, sector.Height, sector.Values); }

Run Fractal.GUI project, and click on Calculate:

You can drag the mouse to select a zone. Releasing the mouse, a new image is generated. You can change the colors, that are randomly selected:

Next Steps

I want to add new versions:

- Multithread version

- Parallel version using Task Parallel Library

- Distributed version (MPI.NET? AjMessages?)

If you are impatient, there is an excellent tutorial, implementing a fractal application using HPC 2008 and the above technologies, ready to download from:

Learning Parallel Programming — from shared-memory multi-threading to distributed-memory multi-processing

Suggestions, comments, welcome!

Angel “Java” Lopez
http://www.ajlopez.com/en
http://twitter.com/ajlopez

10 Comments »

  1. [...] Fractal application revisited [...]

    Pingback by Webcast de desarrollo con Windows HPC Server 2008 - Angel "Java" Lopez — December 18, 2008 @ 12:29 pm

  2. [...] Fractal application revisited [...]

    Pingback by Webcast de desarrollo con Windows HPC Server 2008 | Buanzolandia — December 19, 2008 @ 12:00 am

  3. [...] Filed under: .NET, C Sharp, High Performance Computing — ajlopez @ 5:50 am I updated my fractal example to support MPI.NET (Message Passing Interface with .NET) and parametric tasks in Windows HPC Server [...]

    Pingback by Fractals using MPI.NET and HPC « Angel “Java” Lopez on Blog — December 26, 2008 @ 5:51 am

  4. [...] (Estar?? participando en lugar de Jorge "Chorch" Garc??a). Habr?? ejemplos de MPI.NET, con c??digo. Estoy adaptando mi ejemplo de Fractal: Fractal application revisited [...]

    Pingback by Webcast de desarrollo con Windows HPC Server 2008 | Buanzolandia — December 29, 2008 @ 1:21 am

  5. [...] January, I reimplemented my Fractal application, now using Azure (my Azure-related posts). The idea is to calculate each sector of a fractal image, [...]

    Pingback by Azure: Fractal application « Angel “Java” Lopez on Blog — February 15, 2011 @ 10:21 am

  6. It’s an remarkable piece of writing designed for all the internet viewers; they will obtain benefit from it I am sure.

    Comment by Martina — April 23, 2013 @ 5:53 am

  7. My brother suggested I would possibly like this website.
    He was once totally right. This post actually made my day.
    You can not consider just how much time I had spent for this info!
    Thank you!

    Comment by Lenore — May 8, 2013 @ 6:42 am

  8. Howdy very cool site!! Man .. Beautiful ..
    Amazing .. I will bookmark your web site and take the feeds
    also? I’m happy to search out so many helpful info here in the submit, we want work out more strategies in this regard, thank you for sharing. . . . . .

    Comment by houston solar tour — May 9, 2013 @ 10:06 pm

  9. Hi there i am kavin, its my first occasion to commenting anyplace, when i read this
    post i thought i could also make comment due to this sensible article.

    Comment by Numbers — May 10, 2013 @ 1:02 pm

  10. Appreciating the persistence you put into your site and detailed information you offer.
    It’s nice to come across a blog every once in a while that isn’t the same out
    of date rehashed material. Excellent read! I’ve saved your site and I’m including your RSS feeds to my Google account.

    Comment by alifefullofadventure.Blogspot.com Additional Info additional reading Check Out alifefullofadventure.Blogspot.com Check This Out Click at alifefullofadventure.Blogspot.com Click At this website click for source Click Here Click In this article Click on ali — May 11, 2013 @ 6:25 am


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Theme: Shocking Blue Green. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 37 other followers

%d bloggers like this: