• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

tools/mesh/mgmesh.c

Go to the documentation of this file.
00001 
00055 #include "apbscfg.h"
00056 #include "maloc/maloc.h"
00057 #include "apbs/apbs.h"
00058 
00059 
00060 int main(int argc, char **argv) {
00061 
00062     int i, lev;
00063     int maxvert = 700;
00064     int minlev = VMGNLEV;
00065     double newval, oldval;
00066 
00067     Vio_start();
00068 
00069     Vnm_print(1, "\n\nThis program determines the acceptable meshpoint number\n"
00070                  "and level combinations for the PMG multigrid libraries and\n"
00071                  "%d or more levels in the mesh (because you typically use\n"
00072                  "one less than the max number of levels)\n\n\n", minlev);
00073 
00074     for (i=2; i<maxvert; i++) { 
00075         /* the number of times it's divisible. */
00076         lev = 0;
00077         newval = (double)(i-1);
00078         oldval = (double)(i-1);
00079         while (1) {
00080            oldval = newval;
00081            newval = newval/2.0;
00082            if ((floor(newval) != newval) || (ceil(newval) != newval)) break;
00083            lev++;
00084         } 
00085         if (lev >= minlev) {
00086             Vnm_print(1, "%4d verts/direction => %d levels\n", i, lev);
00087             Vnm_print(1, "                        %d verts on coarsest level\n",
00088               (int)oldval); 
00089             Vnm_print(1, "                        ~%g MB memory (for %d^3 mesh)\n",
00090               (double)(i*i*i)*160.0/1024.0/1024.0, i);
00091         }
00092     }
00093 
00094 #if 0
00095     int i, maxmult = 30;
00096     int j, maxlev = 5;
00097     double log2 = log(2.0);
00098     double x;
00099 
00100     for (i=0; i<maxlev; i++) {
00101         for (j=0; j<maxmult; j++) {
00102             printf("%g ", j*pow(2,i+1) + 1);
00103         }
00104         printf("\n");
00105     }
00106 #endif
00107    
00108     return 0;
00109 }

Generated on Wed Oct 20 2010 11:12:20 for APBS by  doxygen 1.7.2