MCPcopy Create free account
hub / github.com/Kitware/VTK / collectVariableMetaData

Method collectVariableMetaData

IO/PIO/PIOAdaptor.cxx:599–677  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

597///////////////////////////////////////////////////////////////////////////////
598
599void PIOAdaptor::collectVariableMetaData()
600{
601 int64_t numberOfCells = this->pioData->get_num_cells();
602 int numberOfFields = this->pioData->get_pio_num();
603 PIO_FIELD* pioField = this->pioData->get_pio_field();
604
605 for (int i = 0; i < numberOfFields; i++)
606 {
607 // Are tracers available in file
608 char* pioName = pioField[i].pio_name;
609 if (strcmp(pioName, "tracer_num_pnts") == 0)
610 {
611 this->hasTracers = true;
612 }
613
614 // Default variable names that are initially enabled for loading if present
615 if ((strcmp(pioName, "tev") == 0) || (strcmp(pioName, "pres") == 0) ||
616 (strcmp(pioName, "rho") == 0) || (strcmp(pioName, "rade") == 0) ||
617 (strcmp(pioName, "cell_energy") == 0) || (strcmp(pioName, "kemax") == 0) ||
618 (strcmp(pioName, "vel") == 0) || (strcmp(pioName, "eng") == 0))
619 {
620 this->variableDefault.emplace_back(pioName);
621 }
622
623 if (pioField[i].length == numberOfCells && pioField[i].cdata_len == 0)
624 {
625 // index = 0 is scalar, index = 1 is vector, index = -1 is request from input deck
626 int index = pioField[i].index;
627 if (index == 0 || index == 1 || index == -1)
628 {
629 // Discard names used in geometry and variables with too many components
630 // which are present for use in tracers
631 size_t numberOfComponents = this->pioData->get_num_components(pioName);
632
633 if ((numberOfComponents <= 9) && (strcmp(pioName, "cell_has_tracers") != 0) &&
634 (strcmp(pioName, "cell_level") != 0) && (strcmp(pioName, "cell_mother") != 0) &&
635 (strcmp(pioName, "cell_daughter") != 0) && (strcmp(pioName, "cell_center") != 0) &&
636 (strcmp(pioName, "cell_active") != 0) && (strcmp(pioName, "amr_tag") != 0) &&
637 (strcmp(pioName, "chunk_nummat") != 0))
638 {
639 this->variableName.emplace_back(pioName);
640 }
641 }
642 }
643 }
644
645 // If xdt, ydt, zdt, rho are not already included, include them
646 // If we used a set std::set<std::string> s; we could simply add these items again without
647 // worrying if they were in there in the first place. And we could check in log time rather than
648 // linear time.
649 uint32_t mydimensions = this->pioData->get_dimension();
650 if (!(std::find(this->variableName.begin(), this->variableName.end(), "xdt") !=
651 this->variableName.end()))
652 {
653 this->variableName.emplace_back("xdt");
654 }
655 if (!(std::find(this->variableName.begin(), this->variableName.end(), "ydt") !=
656 this->variableName.end()) &&

Callers

nothing calls this directly

Calls 10

findFunction · 0.50
sortFunction · 0.50
get_num_cellsMethod · 0.45
get_pio_numMethod · 0.45
get_pio_fieldMethod · 0.45
emplace_backMethod · 0.45
get_num_componentsMethod · 0.45
get_dimensionMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected