void TableOutputter::outputScalarVariables() { // List of scalar variables const std::vector<std::string> & out = getScalarOutput(); // Loop through each variable for (std::vector<std::string>::const_iterator it = out.begin(); it != out.end(); ++it) { // Get reference to the variable and the no. of components VariableValue & variable = _problem_ptr->getScalarVariable(0, *it).sln(); unsigned int n = variable.size(); // If the variable has a single component, simply output the value with the name if (n == 1) { _scalar_table.addData(*it, variable[0], _time); _all_data_table.addData(*it, variable[0], _time); } // Multi-component variables are appened with the component index else for (unsigned int i = 0; i < n; ++i) { std::ostringstream os; os << *it << "_" << i; _scalar_table.addData(os.str(), variable[i], _time); _all_data_table.addData(os.str(), variable[i], _time); } } }
void Exodus::outputScalarVariables() { // List of desired scalar outputs const std::vector<std::string> & out = getScalarOutput(); // Append the scalar to the global output lists for (std::vector<std::string>::const_iterator it = out.begin(); it != out.end(); ++it) { VariableValue & variable = _problem_ptr->getScalarVariable(0, *it).sln(); unsigned int n = variable.size(); // If the scalar has a single component, output the name directly if (n == 1) { _global_names.push_back(*it); _global_values.push_back(variable[0]); } // If the scalar as many components add indices to the end of the name else { for (unsigned int i = 0; i < n; ++i) { std::ostringstream os; os << *it << "_" << i; _global_names.push_back(os.str()); _global_values.push_back(variable[i]); } } } }
void Exodus::outputScalarVariables() { // List of desired scalar outputs const std::set<std::string> & out = getScalarOutput(); // Append the scalar to the global output lists for (const auto & out_name : out) { // Make sure scalar values are in sync with the solution vector // and are visible on this processor. See TableOutput.C for // TableOutput::outputScalarVariables() explanatory comments MooseVariableScalar & scalar_var = _problem_ptr->getScalarVariable(0, out_name); scalar_var.reinit(); VariableValue value = scalar_var.sln(); const std::vector<dof_id_type> & dof_indices = scalar_var.dofIndices(); const unsigned int n = dof_indices.size(); value.resize(n); const DofMap & dof_map = scalar_var.sys().dofMap(); for (unsigned int i = 0; i != n; ++i) { const processor_id_type pid = dof_map.dof_owner(dof_indices[i]); this->comm().broadcast(value[i], pid); } // If the scalar has a single component, output the name directly if (n == 1) { _global_names.push_back(out_name); _global_values.push_back(value[0]); } // If the scalar as many components add indices to the end of the name else { for (unsigned int i = 0; i < n; ++i) { std::ostringstream os; os << out_name << "_" << i; _global_names.push_back(os.str()); _global_values.push_back(value[i]); } } } }
void TableOutput::outputScalarVariables() { // List of scalar variables const std::set<std::string> & out = getScalarOutput(); // Loop through each variable for (std::set<std::string>::const_iterator it = out.begin(); it != out.end(); ++it) { // Get reference to the variable (0 is for TID) MooseVariableScalar & scalar_var = _problem_ptr->getScalarVariable(0, *it); // Make sure the value of the variable is in sync with the solution vector scalar_var.reinit(); VariableValue & value = scalar_var.sln(); unsigned int n = value.size(); // If the variable has a single component, simply output the value with the name if (n == 1) { _scalar_table.addData(*it, value[0], time()); _all_data_table.addData(*it, value[0], time()); } // Multi-component variables are appended with the component index else for (unsigned int i = 0; i < n; ++i) { std::ostringstream os; os << *it << "_" << i; _scalar_table.addData(os.str(), value[i], time()); _all_data_table.addData(os.str(), value[i], time()); } } }