Просмотр исходного кода

Exmple for Andy and Boxin

iss2
Trevor Irons 8 лет назад
Родитель
Сommit
ac9f4b272e

+ 2724
- 0
examples/borehole/boundarySphere.pvsm
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 3
- 3
examples/borehole/sphere.geo Просмотреть файл

@@ -25,7 +25,7 @@ radius = 2.25;     // Radius of the damn thing
25 25
 lc = radius;   //  0.25;   // Target element size
26 26
 
27 27
 // Total Solution Space
28
-Box = 10*radius; // The down side of potential
28
+Box = 30*radius; // The down side of potential
29 29
 X0 = -Box;
30 30
 X1 =  Box;
31 31
 Y0 = -Box;
@@ -131,8 +131,8 @@ Surface{t6[0]} In Volume{v[1]};
131 131
 ///////////////////////////////////////////////
132 132
 // Attractor Field
133 133
 
134
-//Field[1] = Attractor;
135
-//Field[1].NodesList = {p}; //0, p0+1, p0+2, p0+3, p0+4, p, p+1, p+2, p+3, p+4};
134
+Field[1] = Attractor;
135
+Field[1].NodesList = {p}; //0, p0+1, p0+2, p0+3, p0+4, p, p+1, p+2, p+3, p+4};
136 136
 
137 137
 //Field[2] = MathEval;
138 138
 //Field[2].F = Sprintf("(2.25 - F1)^2 + %g", cellSize*10 );  // WORKS

+ 9
- 6
examples/borehole/sphere.sh Просмотреть файл

@@ -1,16 +1,19 @@
1
-
1
+#!/usr/bin/env bash
2 2
 gmsh  -3 -format vtk -o sphere.vtk  sphere.geo 
3 3
 gmsh  -2 -format stl -o sphereBox.stl  sphereBox.geo 
4
+paraview --state=boundarySphere.pvsm 
4 5
 
6
+#IMPORTANT! 
7
+#   Select ResampleWithDataset1
8
+#	-->File -> SaveData -> MergedSphere.vtu 
5 9
 
10
+# Set up problem 
6 11
 
7
-#gmsh -3 -format vtk -o sphere.vtk  sphere.geo
8
-#../utVTKEdgeGsphere sphere.vtk .25 magnet  sphereG.vtu
9
-#../utFEM4EllipticPDE_bhmag  sphereG.vtu  sphereG.vtu   sphereOut.vtu 
10 12
 
11 13
 # Gravity problem
12
-../utVTKEdgeGsphere sphere.vtk .25 gravity  sphereGrav.vtu
13
-../utFEM4EllipticPDE_bhmag  sphereGrav.vtu  sphereGrav.vtu   sphereOutGrav.vtu 
14
+#../VTKEdgeGsphere MergedSphere.vtu   2.25  gravity  sphereGrav.vtu
15
+#../FEM4EllipticPDE_bhmag  sphereGrav.vtu  sphereGrav.vtu   sphereOutGrav.vtu 
16
+
14 17
 #paraview --state=sliceSphere.pvsm
15 18
 
16 19
 

+ 32
- 0
examples/borehole/sphere2.sh Просмотреть файл

@@ -0,0 +1,32 @@
1
+#!/usr/bin/env bash
2
+#gmsh  -3 -format vtk -o sphere.vtk  sphere.geo 
3
+#gmsh  -2 -format stl -o sphereBox.stl  sphereBox.geo 
4
+#paraview --state=boundarySphere.pvsm 
5
+
6
+#IMPORTANT! 
7
+#   Select ResampleWithDataset1
8
+#	-->File -> SaveData -> MergedSphere.vtu 
9
+
10
+# Set up problem 
11
+# Gravity problem
12
+../VTKEdgeGsphere MergedSphere.vtu   2.25  gravity  sphereGrav.vtu
13
+../FEM4EllipticPDE_bhmag  sphereGrav.vtu  sphereGrav.vtu   sphereOutGrav.vtu 
14
+
15
+#paraview --state=sliceSphere.pvsm
16
+
17
+
18
+# --data=sphereOut.vtu
19
+
20
+# even finer meshing
21
+# radius = 4, u = \pm .9              analytic = \pm 1.33
22
+
23
+# Finer meshing
24
+# radius = 5, u = \pm 1.65            analytic = \pm 1.67
25
+# radius = 4, u = \pm 1.09            analytic = \pm 1.33
26
+
27
+# radius = 5, u = \pm 2.5             analytic = \pm 1.67
28
+# radius = 4, u = \pm 1.66            analytic = \pm 1.33
29
+# radius = 3, u= \pm .926 -.985       analytic = \pm 1
30
+# radius = 2, u = \pm.42              analytic = \pm .667
31
+# for radius=1,  u = \pm .111         analytic = \pm .333 
32
+# for radius=.5, u = \pm .0477 -.0462 analytic = \pm .167

+ 1
- 1
examples/borehole/sphereBox.geo Просмотреть файл

@@ -14,7 +14,7 @@ radius = 2.25;     // Radius of the damn thing
14 14
 lc = radius;   //  0.25;   // Target element size
15 15
 
16 16
 // Total Solution Space
17
-Box = 10*radius; // The down side of potential
17
+Box = 30*radius; // The down side of potential
18 18
 X0 = -Box;
19 19
 X1 =  Box;
20 20
 Y0 = -Box;

+ 95
- 75
src/FEM4EllipticPDE.cpp Просмотреть файл

@@ -156,12 +156,12 @@ namespace Lemma {
156 156
         for (int ic=0; ic < vtkGrid->GetNumberOfCells(); ++ic) {
157 157
 
158 158
 //             Eigen::Matrix<Real, 4, 4> C = Eigen::Matrix<Real, 4, 4>::Zero() ;
159
-//             for (int ip=0; ip<4; ++ip) {
160
-//                 double* pts =  vtkGrid->GetCell(ic)->GetPoints()->GetPoint(ip); //[ipc] ;
161
-//                 C(ip, 0) = 1;
162
-//                 C(ip, 1) =  pts[0];
163
-//                 C(ip, 2) =  pts[1];
164
-//                 C(ip, 3) =  pts[2];
159
+//             for (int ii=0; ii<4; ++ii) {
160
+//                 double* pts =  vtkGrid->GetCell(ic)->GetPoints()->GetPoint(ii); //[ipc] ;
161
+//                 C(ii, 0) = 1;
162
+//                 C(ii, 1) =  pts[0];
163
+//                 C(ii, 2) =  pts[1];
164
+//                 C(ii, 3) =  pts[2];
165 165
 //             }
166 166
 
167 167
 //             Real V = (1./6.) * C.determinant();          // volume of tetrahedra
@@ -215,6 +215,7 @@ namespace Lemma {
215 215
         //Eigen::BiCGSTAB<Eigen::SparseMatrix<Real> > cg(A);
216 216
         cg.setMaxIterations(3000);
217 217
 
218
+        std::cout <<"          rows\tcols\n";
218 219
         std::cout << "A: "  << A.rows() << "\t" << A.cols() << std::endl;
219 220
         std::cout << "g: "  << g.rows() << "\t" << g.cols() << std::endl;
220 221
 
@@ -257,6 +258,7 @@ namespace Lemma {
257 258
         // Build stiffness matrix (A)
258 259
         std::cout << "Building Stiffness Matrix (A) " << std::endl;
259 260
         std::cout << "\tMesh has " << vtkGrid->GetNumberOfCells()  << " cells "  << std::endl;
261
+        std::cout << "\tMesh has " << vtkGrid->GetNumberOfPoints()  << " points "  << std::endl;
260 262
 
261 263
   	    //Eigen::SparseMatrix<Real>
262 264
         A.resize(vtkGrid->GetNumberOfPoints(), vtkGrid->GetNumberOfPoints());
@@ -287,12 +289,12 @@ namespace Lemma {
287 289
 
288 290
             // construct coordinate matrix C
289 291
             Eigen::Matrix<Real, 4, 4> C = Eigen::Matrix<Real, 4, 4>::Zero() ;
290
-            for (int ip=0; ip<4; ++ip) {
291
-                double* pts =  vtkGrid->GetCell(ic)->GetPoints()->GetPoint(ip); //[ipc] ;
292
-                C(ip, 0) = 1;
293
-                C(ip, 1) =  pts[0] ;
294
-                C(ip, 2) =  pts[1] ;
295
-                C(ip, 3) =  pts[2] ;
292
+            for (int ii=0; ii<4; ++ii) {
293
+                double* pts =  vtkGrid->GetCell(ic)->GetPoints()->GetPoint(ii); //[ipc] ;
294
+                C(ii, 0) = 1;
295
+                C(ii, 1) =  pts[0] ;
296
+                C(ii, 2) =  pts[1] ;
297
+                C(ii, 3) =  pts[2] ;
296 298
             }
297 299
 
298 300
             Eigen::Matrix<Real, 4, 4> Phi = C.inverse(); // nabla \phi
@@ -304,7 +306,8 @@ namespace Lemma {
304 306
                 ID[1] = Ids->GetId(1);
305 307
                 ID[2] = Ids->GetId(2);
306 308
                 ID[3] = Ids->GetId(3);
307
-            Real sum(0), sigma_bar(0);
309
+
310
+            Real sigma_bar(0);
308 311
             if (GCell) {
309 312
                 sigma_bar = vtkGrid->GetCellData()->GetScalars("G")->GetTuple1(ic);
310 313
             } else {
@@ -314,26 +317,28 @@ namespace Lemma {
314 317
                 sigma_bar += vtkGrid->GetPointData()->GetScalars("G")->GetTuple1(ID[3]);
315 318
                 sigma_bar /= 4.;
316 319
             }
320
+            sigma_bar = 1.;
317 321
 
318
-            for (int ip=0; ip<4; ++ip) {
319
-                for (int ip2=0; ip2<4; ++ip2) {
320
-                    if (ip2 == ip) {
322
+            for (int ii=0; ii<4; ++ii) {
323
+                for (int jj=0; jj<4; ++jj) {
324
+                    if (jj == ii) {
321 325
                         // I apply boundary to Stiffness matrix, it's common to take the other approach and apply to the load vector and then
322 326
                         //   solve for the boundaries? Is one better? This seems to work, which is nice.
323
-                        //Real bdry = V*(1./(BndryH*BndryH))*BndrySigma*bndryCnt( ID[ip] ); // + sum;
324
-                        Real bb = vtkGrid->GetPointData()->GetScalars("vtkValidPointMask")->GetTuple(ID[ip])[0];
327
+                        //Real bdry = V*(1./(BndryH*BndryH))*BndrySigma*bndryCnt( ID[ii] ); // + sum;
328
+                        Real bb = vtkGrid->GetPointData()->GetScalars("vtkValidPointMask")->GetTuple(ID[ii])[0];
325 329
                         Real bdry = V*(1./(BndryH*BndryH))*BndrySigma*bb; // + sum;
326
-                        coeffs.push_back( Eigen::Triplet<Real> ( ID[ip], ID[ip2], bdry +  Phi.col(ip).tail<3>().dot(Phi.col(ip2).tail<3>() ) * V * sigma_bar ) );
330
+                        coeffs.push_back( Eigen::Triplet<Real> ( ID[ii], ID[jj], bdry +  Phi.col(ii).tail<3>().dot(Phi.col(jj).tail<3>() ) * V * sigma_bar ) );
327 331
                     } else {
328
-                        coeffs.push_back( Eigen::Triplet<Real> ( ID[ip], ID[ip2],         Phi.col(ip).tail<3>().dot(Phi.col(ip2).tail<3>() ) * V * sigma_bar ) );
332
+                        coeffs.push_back( Eigen::Triplet<Real> ( ID[ii], ID[jj],         Phi.col(ii).tail<3>().dot(Phi.col(jj).tail<3>() ) * V * sigma_bar ) );
329 333
                     }
330 334
                     // Stiffness matrix no longer contains boundary conditions...
331
-                    //coeffs.push_back( Eigen::Triplet<Real> ( ID[ip], ID[ip2],         Phi.col(ip).tail<3>().dot(Phi.col(ip2).tail<3>() ) * V * sigma_bar ) );
335
+                    //coeffs.push_back( Eigen::Triplet<Real> ( ID[ii], ID[jj], Phi.col(ii).tail<3>().dot(Phi.col(jj).tail<3>() ) * V * sigma_bar ) );
332 336
                 }
333 337
             }
334 338
             std::cout <<  "\r" << (int)(1e2*((float)(ic) / (float)(vtkGrid->GetNumberOfCells()))) << std::flush ;
335 339
         }
336 340
         A.setFromTriplets(coeffs.begin(), coeffs.end());
341
+        //std::cout << "A\n" << A << std::endl;
337 342
     }
338 343
 
339 344
     void FEM4EllipticPDE::SetupPotential() {
@@ -342,34 +347,48 @@ namespace Lemma {
342 347
 	    // Load vector g
343 348
         std::cout << "\nBuilding load vector (g)" << std::endl;
344 349
         g = VectorXr::Zero(vtkGrid->GetNumberOfPoints());
345
-        std::cout << "made g with "  << vtkGrid->GetNumberOfPoints() << " cells" << std::endl;
350
+        std::cout << "made g with "  << vtkGrid->GetNumberOfPoints() << " points" << std::endl;
346 351
 
347 352
         for (int ic=0; ic < vtkGrid->GetNumberOfCells(); ++ic) {
348 353
 
349
-                Eigen::Matrix<Real, 4, 4> C = Eigen::Matrix<Real, 4, 4>::Zero() ;
350
-                for (int ip=0; ip<4; ++ip) {
351
-                    double* pts =  vtkGrid->GetCell(ic)->GetPoints()->GetPoint(ip); //[ipc] ;
352
-                    C(ip, 0) = 1;
353
-                    C(ip, 1) =  pts[0];
354
-                    C(ip, 2) =  pts[1];
355
-                    C(ip, 3) =  pts[2];
356
-                }
354
+            Eigen::Matrix<Real, 4, 4> C = Eigen::Matrix<Real, 4, 4>::Zero() ;
355
+            for (int ii=0; ii<4; ++ii) {
356
+                double* pts =  vtkGrid->GetCell(ic)->GetPoints()->GetPoint(ii); //[ipc] ;
357
+                C(ii, 0) = 1;
358
+                C(ii, 1) =  pts[0];
359
+                C(ii, 2) =  pts[1];
360
+                C(ii, 3) =  pts[2];
361
+            }
357 362
 
358
-                Real V = (1./6.) * C.determinant();          // volume of tetrahedra
359
-                //Real V = C.determinant();          // volume of tetrahedra
363
+            Real V = (1./6.) * C.determinant();          // volume of tetrahedra
364
+
365
+            vtkIdList* Ids = vtkGrid->GetCell(ic)->GetPointIds();
366
+            int ID[4];
367
+                ID[0] = Ids->GetId(0);
368
+                ID[1] = Ids->GetId(1);
369
+                ID[2] = Ids->GetId(2);
370
+                ID[3] = Ids->GetId(3);
360 371
 
361
-                vtkIdList* Ids = vtkGrid->GetCell(ic)->GetPointIds();
362
-                int ID[4];
363
-                    ID[0] = Ids->GetId(0);
364
-                    ID[1] = Ids->GetId(1);
365
-                    ID[2] = Ids->GetId(2);
366
-                    ID[3] = Ids->GetId(3);
367 372
 
368
-            for (int ip=0; ip<4; ++ip) {
369
-                 g(ID[ip]) +=  (V/4.) *  ( vtkGrid->GetPointData()->GetScalars()->GetTuple(ID[ip])[0] )  ;
370
-                 //if ( std::abs(vtkGrid->GetPointData()->GetScalars()->GetTuple(ID[ip])[0]) > 1e-3 )
373
+            Real avg(0);
374
+            Real GG[4];
375
+            for (int ii=0; ii<4; ++ii) {
376
+                GG[ii] = vtkGrid->GetPointData()->GetScalars("G")->GetTuple(ID[ii])[0];
377
+                //avg /= 4.;
378
+            }
379
+            if ( std::abs( (GG[0]+GG[1]+GG[2]+GG[3])/4. - GG[0])  < 1e-5) {
380
+                avg = GG[0];
371 381
             }
372 382
 
383
+            for (int ii=0; ii<4; ++ii) {
384
+            //     avg += vtkGrid->GetPointData()->GetScalars()->GetTuple(ID[ii])[0];
385
+            //     //if ( std::abs(vtkGrid->GetPointData()->GetScalars()->GetTuple(ID[ii])[0]) > 1e-3 )
386
+            //}
387
+            //TODO this seems wrong!
388
+            //avg /= 4.;
389
+                //g(ID[ii]) +=  (V/4.) * ( vtkGrid->GetPointData()->GetScalars("G")->GetTuple(ID[ii])[0] )  ;
390
+                g(ID[ii]) +=  (V/4.) * avg;
391
+            }
373 392
         }
374 393
 
375 394
     }
@@ -392,7 +411,7 @@ namespace Lemma {
392 411
         // Expensive search for whether or not point is on boundary. O(n) cost.
393 412
         VectorXi bndryCnt = VectorXi::Zero(vtkGrid->GetNumberOfPoints());
394 413
         for (int isp=0; isp < Surface->GetOutput()->GetNumberOfPoints(); ++isp) {
395
-            //double* pts =  vtkGrid->GetCell(ic)->GetPoints()->GetPoint(ip); //[ipc] ;
414
+            //double* pts =  vtkGrid->GetCell(ic)->GetPoints()->GetPoint(ii); //[ipc] ;
396 415
             // x \in -14.5 to 14.5
397 416
             // y \in 0 to 30
398 417
             bndryCnt(BdryIds->GetTuple1(isp)) += 1;
@@ -402,6 +421,7 @@ namespace Lemma {
402 421
         // Build stiffness matrix (A)
403 422
         std::cout << "Building Stiffness Matrix (A) " << std::endl;
404 423
         std::cout << "\tMesh has " << vtkGrid->GetNumberOfCells()  << " cells "  << std::endl;
424
+        std::cout << "\tMesh has " << vtkGrid->GetNumberOfPoints()  << " points "  << std::endl;
405 425
 
406 426
 
407 427
   	    Eigen::SparseMatrix<Real> A(vtkGrid->GetNumberOfPoints(), vtkGrid->GetNumberOfPoints());
@@ -420,15 +440,15 @@ namespace Lemma {
420 440
 
421 441
             // construct coordinate matrix C
422 442
             Eigen::Matrix<Real, 4, 4> C = Eigen::Matrix<Real, 4, 4>::Zero() ;
423
-            for (int ip=0; ip<4; ++ip) {
424
-                double* pts =  vtkGrid->GetCell(ic)->GetPoints()->GetPoint(ip); //[ipc] ;
425
-                C(ip, 0) = 1;
426
-                C(ip, 1) =  pts[0] ;
427
-                C(ip, 2) =  pts[1] ;
428
-                C(ip, 3) =  pts[2] ;
443
+            for (int ii=0; ii<4; ++ii) {
444
+                double* pts =  vtkGrid->GetCell(ic)->GetPoints()->GetPoint(ii); //[ipc] ;
445
+                C(ii, 0) = 1;
446
+                C(ii, 1) =  pts[0] ;
447
+                C(ii, 2) =  pts[1] ;
448
+                C(ii, 3) =  pts[2] ;
429 449
             }
430 450
 
431
-            Eigen::Matrix<Real, 4, 4> Phi = C.inverse(); // nabla \phi
451
+            Eigen::Matrix<Real, 4, 4> GradPhi = C.inverse(); // nabla \phi
432 452
             Real V = (1./6.) * C.determinant();          // volume of tetrahedra
433 453
 
434 454
             vtkIdList* Ids = vtkGrid->GetCell(ic)->GetPointIds();
@@ -440,21 +460,21 @@ namespace Lemma {
440 460
             Real sum(0);
441 461
             Real sigma_bar = vtkGrid->GetCellData()->GetScalars()->GetTuple1(ic);
442 462
 
443
-            for (int ip=0; ip<4; ++ip) {
444
-                for (int ip2=0; ip2<4; ++ip2) {
445
-                    if (ip2 == ip) {
463
+            for (int ii=0; ii<4; ++ii) {
464
+                for (int jj=0; jj<4; ++jj) {
465
+                    if (jj == ii) {
446 466
                         // I apply boundary to Stiffness matrix, it's common to take the other approach and apply to the load vector and then
447 467
                         //   solve for the boundaries? Is one better? This seems to work, which is nice.
448
-                        //Real bdry = V*(1./(BndryH*BndryH))*BndrySigma*bndryCnt( ID[ip] ); // + sum;
449
-                        Real bb = vtkGrid->GetPointData()->GetScalars("vtkValidPointMask")->GetTuple(ID[ip])[0];
468
+                        //Real bdry = V*(1./(BndryH*BndryH))*BndrySigma*bndryCnt( ID[ii] ); // + sum;
469
+                        Real bb = vtkGrid->GetPointData()->GetScalars("vtkValidPointMask")->GetTuple(ID[ii])[0];
450 470
                         //std::cout << "bb " << bb  << std::endl;
451 471
                         Real bdry = V*(1./(BndryH*BndryH))*BndrySigma*bb; // + sum;
452
-                        coeffs.push_back( Eigen::Triplet<Real> ( ID[ip], ID[ip2], bdry +  Phi.col(ip).tail<3>().dot(Phi.col(ip2).tail<3>() ) * V * sigma_bar ) );
472
+                        coeffs.push_back( Eigen::Triplet<Real> ( ID[ii], ID[jj], bdry +  GradPhi.col(ii).tail<3>().dot(GradPhi.col(jj).tail<3>() ) * V * sigma_bar ) );
453 473
                     } else {
454
-                        coeffs.push_back( Eigen::Triplet<Real> ( ID[ip], ID[ip2],         Phi.col(ip).tail<3>().dot(Phi.col(ip2).tail<3>() ) * V * sigma_bar ) );
474
+                        coeffs.push_back( Eigen::Triplet<Real> ( ID[ii], ID[jj],         GradPhi.col(ii).tail<3>().dot(GradPhi.col(jj).tail<3>() ) * V * sigma_bar ) );
455 475
                     }
456 476
                     // Stiffness matrix no longer contains boundary conditions...
457
-                    //coeffs.push_back( Eigen::Triplet<Real> ( ID[ip], ID[ip2],         Phi.col(ip).tail<3>().dot(Phi.col(ip2).tail<3>() ) * V * sigma_bar ) );
477
+                    //coeffs.push_back( Eigen::Triplet<Real> ( ID[ii], ID[jj],         GradPhi.col(ii).tail<3>().dot(GradPhi.col(jj).tail<3>() ) * V * sigma_bar ) );
458 478
                 }
459 479
             }
460 480
             std::cout <<  "\r" << (int)(1e2*((float)(ic) / (float)(vtkGrid->GetNumberOfCells()))) << std::flush ;
@@ -482,12 +502,12 @@ namespace Lemma {
482 502
             for (int ic=0; ic < vtkGrid->GetNumberOfCells(); ++ic) {
483 503
 
484 504
                 Eigen::Matrix<Real, 4, 4> C = Eigen::Matrix<Real, 4, 4>::Zero() ;
485
-                for (int ip=0; ip<4; ++ip) {
486
-                    double* pts =  vtkGrid->GetCell(ic)->GetPoints()->GetPoint(ip); //[ipc] ;
487
-                    C(ip, 0) = 1;
488
-                    C(ip, 1) =  pts[0];
489
-                    C(ip, 2) =  pts[1];
490
-                    C(ip, 3) =  pts[2];
505
+                for (int ii=0; ii<4; ++ii) {
506
+                    double* pts =  vtkGrid->GetCell(ic)->GetPoints()->GetPoint(ii); //[ipc] ;
507
+                    C(ii, 0) = 1;
508
+                    C(ii, 1) =  pts[0];
509
+                    C(ii, 2) =  pts[1];
510
+                    C(ii, 3) =  pts[2];
491 511
                 }
492 512
 
493 513
                 Real V = (1./6.) * C.determinant();          // volume of tetrahedra
@@ -506,7 +526,7 @@ namespace Lemma {
506 526
                 /*
507 527
                 if (!pe) {
508 528
                     if (std::abs(pt[0]) < .2 && std::abs(pt[1]-15) < .2 && pt[2] < 3.25 ) {
509
-                        sum = 1; //vtkGrid->GetPointData()->GetScalars()->GetTuple(ID[ip])[0];
529
+                        sum = 1; //vtkGrid->GetPointData()->GetScalars()->GetTuple(ID[ii])[0];
510 530
                         pe = true;
511 531
                     }
512 532
                 }*/
@@ -520,15 +540,15 @@ namespace Lemma {
520 540
 /*
521 541
                 if (!ne) {
522 542
                     if (std::abs(pt[0]+1.) < .2 && std::abs(pt[1]-15) < .2 && pt[2] < 3.25 ) {
523
-                        sum = -1; //vtkGrid->GetPointData()->GetScalars()->GetTuple(ID[ip])[0];
543
+                        sum = -1; //vtkGrid->GetPointData()->GetScalars()->GetTuple(ID[ii])[0];
524 544
                         std::cout << "Negative Electroce\n";
525 545
                         ne = true;
526 546
                     }
527 547
                 }
528 548
 */
529
-                //for (int ip=0; ip<4; ++ip) {
530
-                    //g(ID[ip]) +=  (V/4.) *  ( vtkGrid->GetPointData()->GetScalars()->GetTuple(ID[ip])[0] )  ;
531
-                    //if ( std::abs(vtkGrid->GetPointData()->GetScalars()->GetTuple(ID[ip])[0]) > 1e-3 )
549
+                //for (int ii=0; ii<4; ++ii) {
550
+                    //g(ID[ii]) +=  (V/4.) *  ( vtkGrid->GetPointData()->GetScalars()->GetTuple(ID[ii])[0] )  ;
551
+                    //if ( std::abs(vtkGrid->GetPointData()->GetScalars()->GetTuple(ID[ii])[0]) > 1e-3 )
532 552
                 //}
533 553
                 // TODO check Load Vector...
534 554
                 g(ID[0]) = sum; //(V/4.) * sum; // Why 3, Why!!!?
@@ -545,9 +565,9 @@ namespace Lemma {
545 565
 
546 566
                     for(vtkIdType i = 0; i < connectedVertices->GetNumberOfIds(); ++i) {
547 567
 
548
-                        int ip = connectedVertices->GetId(i);
549
-                        vtkGrid->GetPoint(ip, r1);
550
-                        double g1 = vtkGrid->GetPointData()->GetScalars()->GetTuple(ip)[0] ;
568
+                        int ii = connectedVertices->GetId(i);
569
+                        vtkGrid->GetPoint(ii, r1);
570
+                        double g1 = vtkGrid->GetPointData()->GetScalars()->GetTuple(ii)[0] ;
551 571
                         //g(ic) += g0*dist(r0,r1); //CompositeSimpsons2(g0, r0, r1, 8);
552 572
                         if ( std::abs(g1) > 1e-3 ) {
553 573
                             g(ic) += CompositeSimpsons2(g1, g0, r1, r0, 1000);
@@ -580,8 +600,8 @@ namespace Lemma {
580 600
                 //g(ic) += vtkGrid->GetPointData()->GetScalars()->GetTuple1(ic);// FunctionValue(r0[0], r0[1], r0[2]) ;
581 601
                 /*
582 602
                 for(vtkIdType i = 0; i < connectedVertices->GetNumberOfIds(); ++i) {
583
-                    int ip = connectedVertices->GetId(i);
584
-                    vtkGrid->GetPoint(ip, r1);
603
+                    int ii = connectedVertices->GetId(i);
604
+                    vtkGrid->GetPoint(ii, r1);
585 605
                     g(ic) += CompositeSimpsons2(vtkG, r0, r1, 8); // vtkG->FunctionValue(r0[0], r0[1], r0[2]) ;
586 606
                 }
587 607
                 */
@@ -598,8 +618,8 @@ namespace Lemma {
598 618
                 //#pragma omp parallel for reduction(+:sum)
599 619
                 //#endif
600 620
                 for(vtkIdType i = 0; i < connectedVertices->GetNumberOfIds(); ++i) {
601
-                    int ip = connectedVertices->GetId(i);
602
-                    vtkGrid->GetPoint(ip, r1);
621
+                    int ii = connectedVertices->GetId(i);
622
+                    vtkGrid->GetPoint(ii, r1);
603 623
                     g(ic) += CompositeSimpsons2(gFcn3, r0, r1, 8); // vtkG->FunctionValue(r0[0], r0[1], r0[2]) ;
604 624
                     //sum += CompositeSimpsons2(gFcn3, r0, r1, 8); // vtkG->FunctionValue(r0[0], r0[1], r0[2]) ;
605 625
                 }

Загрузка…
Отмена
Сохранить