| 1827 | /////////////////////////////////////////////////////////////////////////////// |
| 1828 | |
| 1829 | void PIOAdaptor::load_variable_data_UG( |
| 1830 | vtkMultiBlockDataSet* grid, vtkDataArraySelection* cellDataArraySelection) |
| 1831 | { |
| 1832 | int64_t* cell_daughter = &this->Impl->daughter[0]; |
| 1833 | for (size_t var = 0; var < this->variableName.size(); var++) |
| 1834 | { |
| 1835 | int numberOfComponents; |
| 1836 | int numberOfCells; |
| 1837 | double** dataVector; |
| 1838 | std::valarray<double> scalarArray; |
| 1839 | std::valarray<std::valarray<double>> vectorArray; |
| 1840 | |
| 1841 | if (cellDataArraySelection->ArrayIsEnabled(this->variableName[var].c_str())) |
| 1842 | { |
| 1843 | // Using PIOData fetch the variable data from the file only on proc 0 |
| 1844 | if (this->Rank == 0) |
| 1845 | { |
| 1846 | bool status = false; |
| 1847 | numberOfCells = this->Impl->countCell[0]; |
| 1848 | |
| 1849 | // check if variable is a material variable |
| 1850 | if (this->matVariables.count(this->variableName[var]) > 0) |
| 1851 | { |
| 1852 | numberOfComponents = 1; |
| 1853 | dataVector = new double*[numberOfComponents]; |
| 1854 | PIOMaterialVariable* matvar = this->matVariables[this->variableName[var]]; |
| 1855 | |
| 1856 | // reconstruct the material variable |
| 1857 | status = this->pioData->reconstruct_chunk_field(this->numCells, scalarArray, |
| 1858 | matvar->prefix.c_str(), matvar->baseVar.c_str(), matvar->material_number); |
| 1859 | dataVector[0] = &scalarArray[0]; |
| 1860 | |
| 1861 | // check if the variable is a derived variable, and if so, calculate |
| 1862 | // the variable correctly |
| 1863 | if (status && matvar->var == "fvol") |
| 1864 | { |
| 1865 | // calculate fvol (volume fraction) by dividing values by cell volume (vcell) |
| 1866 | std::valarray<double> vcell; |
| 1867 | bool vcell_status = this->pioData->set_scalar_field(vcell, "vcell"); |
| 1868 | if (vcell_status) |
| 1869 | { |
| 1870 | scalarArray = scalarArray / vcell; |
| 1871 | } |
| 1872 | } |
| 1873 | else if (status && matvar->var == "rho") |
| 1874 | { |
| 1875 | // calculate rho by dividing values by cell volume (vcell) |
| 1876 | std::valarray<double> vcell; |
| 1877 | bool vcell_status = this->pioData->set_scalar_field(vcell, "vcell"); |
| 1878 | if (vcell_status) |
| 1879 | { |
| 1880 | scalarArray = scalarArray / vcell; |
| 1881 | } |
| 1882 | } |
| 1883 | else if (status && matvar->var == "fmass") |
| 1884 | { |
| 1885 | // calculate fmass by dividing values by cell mass (mass) |
| 1886 | std::valarray<double> mass; |
nothing calls this directly
no test coverage detected