From 5dfe4f8044cd85884c994a5dfb738c1694a16728 Mon Sep 17 00:00:00 2001 From: James E McClure Date: Tue, 16 Jun 2015 21:39:26 -0400 Subject: [PATCH] Refactoring --- common/TwoPhase.h | 9 +++++---- tests/lbpm_color_simulator.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/common/TwoPhase.h b/common/TwoPhase.h index 146d68b6..e5c1da53 100644 --- a/common/TwoPhase.h +++ b/common/TwoPhase.h @@ -300,7 +300,7 @@ public: }; -void TwoPhase::ColorToSignedDistance(double Beta, double *ColorData, double *DistData){ +void TwoPhase::ColorToSignedDistance(double Beta, DoubleArray &ColorData, DoubleArray &DistData){ double factor,temp,value; factor=0.5/Beta; @@ -311,13 +311,14 @@ void TwoPhase::ColorToSignedDistance(double Beta, double *ColorData, double *Dis else DistData[n] = factor*log((1.0+value)/(1.0-value)); if (DistData[n] > 1.0) DistData[n] = 1.0; if (DistData[n] < -1.0) DistData[n] = -1.0; - }*/ - + } +*/ // Initialize to -1,1 (segmentation) for (int k=0; k 1.0) DistData(i,j,k) = 1.0; else if (temp < -1.0) DistData(i,j,k) = -1.0; diff --git a/tests/lbpm_color_simulator.cpp b/tests/lbpm_color_simulator.cpp index 2b74b416..71b27f5c 100644 --- a/tests/lbpm_color_simulator.cpp +++ b/tests/lbpm_color_simulator.cpp @@ -1551,8 +1551,8 @@ int main(int argc, char **argv) //........................................................................... // Copy the phase indicator field for the earlier timestep DeviceBarrier(); - CopyToHost(Averages.Phase.get(),Phi,N*sizeof(double)); - Averages.ColorToSignedDistance(beta,Averages.Phase.get(),Averages.Phase_tplus.get()); + CopyToHost(Averages.Phase_tplus.get(),Phi,N*sizeof(double)); + // Averages.ColorToSignedDistance(beta,Averages.Phase,Averages.Phase_tplus); //........................................................................... } if (timestep%5000 == 0){ @@ -1575,11 +1575,11 @@ int main(int argc, char **argv) // Copy the phase indicator field for the later timestep DeviceBarrier(); CopyToHost(Averages.Phase_tminus.get(),Phi,N*sizeof(double)); - Averages.ColorToSignedDistance(beta,Averages.Phase_tminus.get(),Averages.Phase_tminus.get()); +// Averages.ColorToSignedDistance(beta,Averages.Phase_tminus,Averages.Phase_tminus); //.................................................................... Averages.Initialize(); Averages.ComputeDelPhi(); - Averages.ColorToSignedDistance(beta,Averages.Phase.get(),Averages.SDn.get()); + Averages.ColorToSignedDistance(beta,Averages.Phase,Averages.SDn); Averages.UpdateMeshValues(); Averages.ComputeLocal(); Averages.Reduce();