home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 31,550 of 33,346   
   Jonathan Thornburg to you   
   Re: Using the STL for scientific program   
   06 Oct 11 14:01:55   
   
   From: clcppm-poster@this.is.invalid   
      
   In article  you wrote:   
   > Does anyone use the STL (and I mean the STL, not BOOST) for scientific   
   > programming and, if so, what parts and for what?   
   >   
   > I am not talking about incidental use, but where it provides a major   
   > advantage over rolling one's own for the sort of programmer capable   
   > of writing a serious scientific program in a language like C++.   
      
   I use  std::vector  and  std::complex  routinely in scientific programs   
   (and have done so since the late 1990s).  [Inspired by a colleague, my   
   personal programming guidelines now state that  std::vector::operator[]   
   is forbidden; all accesses use the range-checked  std::vector::at() .]   
      
   I now use my own home-brewed classes for {1,2,3,4}-dimensional arrays   
   where the index lower bounds may be nonzero.  At one point I tried   
   boost::multi_array for this, but the complexity didn't seem worthwhile   
   at that time.  (I might revisit that decision in the future.)   
      
      
   > I am interested in knowing which components and which areas of   
   > scientific programming it actually helps with, if any.  I can see   
   > some uses for its associative containers, but haven't studied them   
   > in enough depth to see if they really do provide an advantage.   
      
   I use std::string when it's convenient in my codes (and   
   const char* const  when that's convenient).  I use   
   std::map in a global "parameter database" that   
   keeps track of run-time configuration options.  These are all important   
   to the functioning of my codes, but don't consume significant CPU time   
   or memory.   
      
      
   For context, my (C++) scientific programs are mostly numerical   
   simulations in general relativity.  A code's typical size is 20-50K   
   source lines and 2-4 person-years of work.  Most are standalone codes,   
   but a few have also been modules in a big "toolkits" (~0.5 to 1M   
   source lines, 20-50 person-years) used by many colleagues.   
      
   [As to Boost, I'm now using  boost::noncopyable  and  boost::format   
   a lot.  Other things may come in the future...]   
      
   --   
   -- "Jonathan Thornburg [remove -animal to reply]"    
     Dept of Astronomy & IUCSS, Indiana University, Bloomington, Indiana, USA   
     "Washing one's hands of the conflict between the powerful and the   
      powerless means to side with the powerful, not to be neutral."   
                                        -- quote by Freire / poster by Oxfam   
      
      
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca