[cig-commits] r11566 - cs/benchmark/cigma/trunk/src

luis at geodynamics.org luis at geodynamics.org
Wed Mar 26 03:27:56 PDT 2008


Author: luis
Date: 2008-03-26 03:27:56 -0700 (Wed, 26 Mar 2008)
New Revision: 11566

Modified:
   cs/benchmark/cigma/trunk/src/SearchCmd.cpp
Log:
Test the effect of changing number of neighbors on locator object


Modified: cs/benchmark/cigma/trunk/src/SearchCmd.cpp
===================================================================
--- cs/benchmark/cigma/trunk/src/SearchCmd.cpp	2008-03-26 10:27:55 UTC (rev 11565)
+++ cs/benchmark/cigma/trunk/src/SearchCmd.cpp	2008-03-26 10:27:56 UTC (rev 11566)
@@ -127,13 +127,12 @@
     coordsField->meshPart = meshPart;
     coordsField->meshPart->set_cell();
 
-    /*
-    if (coordsField->meshPart->nsd == 3)
+    if ((coordsField->meshPart->nsd == 3) && (coordsField->meshPart->nno > 1000))
     {
         AnnLocator *locator = new AnnLocator();
+        locator->nnk = 10;
         coordsField->meshPart->set_locator(locator);
     }
-    // */
 
     return;
 }
@@ -167,13 +166,27 @@
         pointCellCount[i] = 0;
     }
 
+
+    time_t t0,t1;
+    time(&t0);
+
+    int hitCount = 0;
+
     if (meshPart->locator != 0)
     {
         for (i = 0; i < points->n_points(); i++)
         {
-            double *pt = (*points)[nsd*i];
+            //double *pt = (*points)[i];
+            double pt[3] = {0,0,0};
+            for (j = 0; j < points->n_dim(); j++)
+            {
+                pt[j] = (*points)(i,j);
+            }
+
             //bool found = meshPart->find_cell(pt, &parentCell);
+
             bool found = false;
+
             meshPart->locator->search(pt);
             for (j = 0; j < meshPart->locator->n_idx(); j++)
             {
@@ -191,20 +204,34 @@
                     break;
                 }
             }
+            //*
+            if (!found)
+            {
+                hitCount++;
+                cout << i << endl;
+                for (e = 0; e < nel; e++)
+                {
+                    meshPart->select_cell(e);
+                    if (meshPart->cell->global_interior(pt))
+                    {
+                        found = true;
+                        cellPointCount[e]++;
+                        pointCellCount[i] = e+1;
+                        break;
+                    }
+                }
+                assert(found);
+            } // */
         }
+        cout << "Locator missed " << hitCount << " "
+             << "(" << ((100.0*hitCount)/npts) << "%)"
+             << endl;
     }
     else
     {
-        time_t t0,t1;
-        time(&t0);
-        if (verbose)
-        {
-            cout << "starting...";
-        }
-
         for (i = 0; i < points->n_points(); i++)
         {
-            double *pt = (*points)[nsd*i];
+            double *pt = (*points)[i];
             bool found = false;
             for (e = 0; e < nel; e++)
             {
@@ -218,17 +245,13 @@
                 }
             }
         }
-
-        time(&t1);
-        double total_time = t1 - t0;
-        if (verbose)
-        {
-            cout << "done!" << endl;
-            cout << "total time: " << total_time << endl;
-        }
     }
 
+    time(&t1);
+    double total_time = t1 - t0;
+    cout << "Total time = " << total_time << endl;
 
+
     int ierr;
 
     HdfWriter *hdfWriter = static_cast<HdfWriter*>(writer);



More information about the cig-commits mailing list