trying to make label more robust

This commit is contained in:
James E McClure 2019-03-29 05:23:49 -04:00
parent 9fc8d8a55d
commit a8bd5dca7e
2 changed files with 8 additions and 8 deletions

View File

@ -160,10 +160,10 @@ void ScaLBL_ColorModel::ReadInput(){
void ScaLBL_ColorModel::AssignComponentLabels(double *phase) void ScaLBL_ColorModel::AssignComponentLabels(double *phase)
{ {
size_t NLABELS=0; size_t NLABELS=0;
char VALUE=0; signed char VALUE=0;
double AFFINITY=0.f; double AFFINITY=0.f;
auto LabelList = color_db->getVector<signed char>( "ComponentLabels" ); auto LabelList = color_db->getVector<int>( "ComponentLabels" );
auto AffinityList = color_db->getVector<double>( "ComponentAffinity" ); auto AffinityList = color_db->getVector<double>( "ComponentAffinity" );
NLABELS=LabelList.size(); NLABELS=LabelList.size();
@ -210,7 +210,7 @@ void ScaLBL_ColorModel::AssignComponentLabels(double *phase)
VALUE=LabelList[idx]; VALUE=LabelList[idx];
AFFINITY=AffinityList[idx]; AFFINITY=AffinityList[idx];
double volume_fraction = double(label_count_global[idx])/double((Nx-2)*(Ny-2)*(Nz-2)*nprocs); double volume_fraction = double(label_count_global[idx])/double((Nx-2)*(Ny-2)*(Nz-2)*nprocs);
printf(" label=%hhd, affinity=%f, volume fraction==%f\n",VALUE,AFFINITY,volume_fraction); printf(" label=%d, affinity=%f, volume fraction==%f\n",VALUE,AFFINITY,volume_fraction);
} }
} }

View File

@ -90,8 +90,8 @@ int main(int argc, char **argv)
else { else {
checkerSize = SIZE[0]; checkerSize = SIZE[0];
} }
auto ReadValues = domain_db->getVector<char>( "ReadValues" ); auto ReadValues = domain_db->getVector<int>( "ReadValues" );
auto WriteValues = domain_db->getVector<char>( "WriteValues" ); auto WriteValues = domain_db->getVector<int>( "WriteValues" );
auto ReadType = domain_db->getScalar<std::string>( "ReadType" ); auto ReadType = domain_db->getScalar<std::string>( "ReadType" );
if (ReadType == "8bit"){ if (ReadType == "8bit"){
} }
@ -262,8 +262,8 @@ int main(int argc, char **argv)
n = k*(nx+2)*(ny+2) + j*(nx+2) + i;; n = k*(nx+2)*(ny+2) + j*(nx+2) + i;;
char locval = loc_id[n]; char locval = loc_id[n];
for (int idx=0; idx<ReadValues.size(); idx++){ for (int idx=0; idx<ReadValues.size(); idx++){
char oldvalue=ReadValues[idx]; signed char oldvalue=ReadValues[idx];
char newvalue=WriteValues[idx]; signed char newvalue=WriteValues[idx];
if (locval == oldvalue){ if (locval == oldvalue){
loc_id[n] = newvalue; loc_id[n] = newvalue;
LabelCount[idx]++; LabelCount[idx]++;
@ -288,7 +288,7 @@ int main(int argc, char **argv)
} }
} }
for (int idx=0; idx<ReadValues.size(); idx++){ for (int idx=0; idx<ReadValues.size(); idx++){
char label=ReadValues[idx]; int label=ReadValues[idx];
int count=LabelCount[idx]; int count=LabelCount[idx];
printf("Label=%d, Count=%d \n",label,count); printf("Label=%d, Count=%d \n",label,count);
} }