| 2000 | /////////////////////////////////////////////////////////////////////////////// |
| 2001 | |
| 2002 | void PIOAdaptor::load_variable_data_HTG( |
| 2003 | vtkMultiBlockDataSet* grid, vtkDataArraySelection* cellDataArraySelection) |
| 2004 | { |
| 2005 | for (size_t var = 0; var < this->variableName.size(); var++) |
| 2006 | { |
| 2007 | double** dataVector = nullptr; |
| 2008 | std::valarray<double> scalarArray; |
| 2009 | std::valarray<std::valarray<double>> vectorArray; |
| 2010 | int numberOfComponents; |
| 2011 | int numberOfCells; |
| 2012 | if (cellDataArraySelection->ArrayIsEnabled(this->variableName[var].c_str())) |
| 2013 | { |
| 2014 | if (this->Rank == 0) |
| 2015 | { |
| 2016 | bool status = false; |
| 2017 | |
| 2018 | // check if variable is a material variable |
| 2019 | if (this->matVariables.count(this->variableName[var]) > 0) |
| 2020 | { |
| 2021 | numberOfCells = this->numCells; |
| 2022 | numberOfComponents = 1; |
| 2023 | dataVector = new double*[numberOfComponents]; |
| 2024 | PIOMaterialVariable* matvar = this->matVariables[this->variableName[var]]; |
| 2025 | |
| 2026 | // reconstruct the material variable |
| 2027 | status = this->pioData->reconstruct_chunk_field(this->numCells, scalarArray, |
| 2028 | matvar->prefix.c_str(), matvar->baseVar.c_str(), matvar->material_number); |
| 2029 | dataVector[0] = &scalarArray[0]; |
| 2030 | |
| 2031 | // check if the variable is a derived variable, and if so, calculate |
| 2032 | // the variable correctly |
| 2033 | if (status && matvar->var == "fvol") |
| 2034 | { |
| 2035 | // calculate fvol (volume fraction) by dividing values by cell volume (vcell) |
| 2036 | std::valarray<double> vcell; |
| 2037 | bool vcell_status = this->pioData->set_scalar_field(vcell, "vcell"); |
| 2038 | if (vcell_status) |
| 2039 | { |
| 2040 | scalarArray = scalarArray / vcell; |
| 2041 | } |
| 2042 | } |
| 2043 | else if (status && matvar->var == "rho") |
| 2044 | { |
| 2045 | // calculate rho by dividing values by cell volume (vcell) |
| 2046 | std::valarray<double> vcell; |
| 2047 | bool vcell_status = this->pioData->set_scalar_field(vcell, "vcell"); |
| 2048 | if (vcell_status) |
| 2049 | { |
| 2050 | scalarArray = scalarArray / vcell; |
| 2051 | } |
| 2052 | } |
| 2053 | else if (status && matvar->var == "fmass") |
| 2054 | { |
| 2055 | // calculate fmass by dividing values by cell mass (mass) |
| 2056 | std::valarray<double> mass; |
| 2057 | bool mass_status = this->pioData->set_scalar_field(mass, "mass"); |
| 2058 | if (mass_status) |
| 2059 | { |
nothing calls this directly
no test coverage detected