tweak labels
This commit is contained in:
parent
d4a8a3e039
commit
b69043c6da
@ -158,10 +158,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<char>( "ComponentLabels" );
|
auto LabelList = color_db->getVector<signed char>( "ComponentLabels" );
|
||||||
auto AffinityList = color_db->getVector<double>( "ComponentAffinity" );
|
auto AffinityList = color_db->getVector<double>( "ComponentAffinity" );
|
||||||
|
|
||||||
NLABELS=LabelList.size();
|
NLABELS=LabelList.size();
|
||||||
|
@ -82,8 +82,8 @@ int main(int argc, char **argv)
|
|||||||
for (n=0; n<N; n++) Dm->id[n]=1;
|
for (n=0; n<N; n++) Dm->id[n]=1;
|
||||||
Dm->CommInit();
|
Dm->CommInit();
|
||||||
|
|
||||||
char *id;
|
signed char *id;
|
||||||
id = new char [N];
|
id = new signed char [N];
|
||||||
sprintf(LocalRankFilename,"ID.%05i",rank);
|
sprintf(LocalRankFilename,"ID.%05i",rank);
|
||||||
size_t readID;
|
size_t readID;
|
||||||
FILE *IDFILE = fopen(LocalRankFilename,"rb");
|
FILE *IDFILE = fopen(LocalRankFilename,"rb");
|
||||||
@ -131,13 +131,13 @@ int main(int argc, char **argv)
|
|||||||
// calculate distance to non-wetting fluid
|
// calculate distance to non-wetting fluid
|
||||||
if (domain_db->keyExists( "HistoryLabels" )){
|
if (domain_db->keyExists( "HistoryLabels" )){
|
||||||
if (rank==0) printf("Relabel solid components that touch fluid 1 \n");
|
if (rank==0) printf("Relabel solid components that touch fluid 1 \n");
|
||||||
auto LabelList = domain_db->getVector<char>( "ComponentLabels" );
|
auto LabelList = domain_db->getVector<signed char>( "ComponentLabels" );
|
||||||
auto HistoryLabels = domain_db->getVector<char>( "HistoryLabels" );
|
auto HistoryLabels = domain_db->getVector<signed char>( "HistoryLabels" );
|
||||||
size_t NLABELS=LabelList.size();
|
size_t NLABELS=LabelList.size();
|
||||||
if (rank==0){
|
if (rank==0){
|
||||||
for (unsigned int idx=0; idx < NLABELS; idx++){
|
for (unsigned int idx=0; idx < NLABELS; idx++){
|
||||||
char VALUE = LabelList[idx];
|
signed char VALUE = LabelList[idx];
|
||||||
char NEWVAL = HistoryLabels[idx];
|
signed char NEWVAL = HistoryLabels[idx];
|
||||||
printf(" Relabel component %d as %d \n", VALUE, NEWVAL);
|
printf(" Relabel component %d as %d \n", VALUE, NEWVAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -167,13 +167,15 @@ int main(int argc, char **argv)
|
|||||||
for (int j=0;j<ny;j++){
|
for (int j=0;j<ny;j++){
|
||||||
for (int i=0;i<nx;i++){
|
for (int i=0;i<nx;i++){
|
||||||
int n = k*nx*ny+j*nx+i;
|
int n = k*nx*ny+j*nx+i;
|
||||||
char LOCVAL = id[n];
|
signed char LOCVAL = id[n];
|
||||||
for (unsigned int idx=0; idx < NLABELS; idx++){
|
for (unsigned int idx=0; idx < NLABELS; idx++){
|
||||||
char VALUE=LabelList[idx];
|
signed char VALUE=LabelList[idx];
|
||||||
|
signed char NEWVALUE=HistoryLabels[idx];
|
||||||
if (LOCVAL == VALUE){
|
if (LOCVAL == VALUE){
|
||||||
idx = NLABELS;
|
idx = NLABELS;
|
||||||
char NEWVALUE=HistoryLabels[idx];
|
if (SignDist(i,j,k) < 1.0){
|
||||||
if (SignDist(i,j,k) < 1.0) id[n] = NEWVALUE;
|
id[n] = NEWVALUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user