MultiBlock Inspector only show one dataset there are two dataset with two process

After upgrade paraview from 5.9 to 5.12 i found when I load multiblock dataset with parallel process, there is something wrong when interacting with multiblock dataset.

We created a multiblock data reader plugin, which can read a folder and support multiple process, like if there is two block files in folder, it can read one file per process.

When in client-only mode, there are two blocks in MultiBlock Inspector and each block color can be changed by right-click context menu, there is no problem, but when in remote mode with two processes, there is ONLY one block in MultiBlock Inspector and when set block color by right-click context menu, one block cannot be recognized as data block, but when set color to the other one, it will make two blocks color changed…

Is this is a bug, or do I need do something for my multiblock dataset?

Thanks in advance and Best Regards

when debug into code, I found the selector is correct, but one is not work, the other will make two blocks work, any suggestion to fix this?

vtkSMProxy* proxy = repr->getProxy();
vtkSMProperty* property = proxy->GetProperty("BlockColors");
if (property)
{
	double colorF[3] = {r, g, b};

	vtkSMPropertyHelper helper(property);

            helper.SetStatus(selector.c_str(), colorF, 3);

	proxy->UpdateVTKObjects();
}
repr->renderViewEventually();

Hi @sharon

Please share the code

Best,

Hi Mathieu,
Thanks for your reply!

Our reader is a “directory reader” whose input is a folder name and read all files under this folder, when in multiple process, we will allocate files according to process id and let each process read some of files: [ifileBegin, ifileEnd)

unsigned int nfile = FileNameList.size();
unsigned int ifileBegin = 0;
unsigned int ifileEnd = nfile;	
vtkMultiProcessController* controller = vtkMultiProcessController::GetGlobalController();
int numberOfProcesses = controller->GetNumberOfProcesses();
if (numberOfProcesses > 1)
{
	int iProcessId = controller->GetLocalProcessId();
	int nProcesses = controller->GetNumberOfProcesses();
	int nfilePerProcess = nfile / nProcesses;
	ifileBegin = iProcessId * nfilePerProcess;
	ifileEnd = (iProcessId + 1) * nfilePerProcess;
	if (ifileEnd > nfile || iProcessId == nProcesses - 1)
	{
		ifileEnd = nfile;
	}
}

and then use multiple threads to read and create multiblock dataset for all files: if one file is in range [ifileBegin, ifileEnd) then read true data and create true dataset, while creating dummy dataset(the same structure but no true data) if the file is out of range [ifileBegin, ifileEnd).

std::thread::id main_thread_id = std::this_thread::get_id();
int nThread = vtkSMPTools::GetEstimatedNumberOfThreads();

if (numberOfProcesses > 1)
{
	int numThreadPerProcess = nThread / numberOfProcesses;
	if (numThreadPerProcess < 1) numThreadPerProcess = 1;
	vtkSMPTools::Initialize(numThreadPerProcess);
}	

vtkSMPTools::For(0, nfile, functor);

after multiple threads reading, all data will be reduce to vector “GlobalDatas”, the multiblock dataset for each file will be assembled into output multiblock dataset, in this way to keep the data structure on all processes has the same structure profile:

for (size_t i = 0; i < nfile; i++)
{
	const std::string& file = FileNameList[i];
	assert(globalDatas.find(file) != globalDatas.end());
	auto processData = globalDatas[file];
	if (processData->GetIsDummy())
	{
		output->AddDummyDataBlock(processData, processData->FileName);
	}
	else
	{
		output->AddTrueDataBlock(processData, processData->FileName);
	}
	processData->Delete();
}

do we still need keep the the same data structure profile for all process?

any suggestions for this reader?

Make sure each of your block have distinct names, even the dummy ones.

Thank you Mathieu, you are right, after correct block name for dummy ones, it works as expected!

That looks like an issue though, could you open it?

https://gitlab.kitware.com/paraview/paraview/-/issues

oh, no, this is my own mistake, i failed to assign the correct names for blocks and result in final UI control error…
after correct names, it now works as expected

Best Regards,