void OutputWarehouse::checkOutputs(const std::set<OutputName> & names) { for (const auto & name : names) if (!isReservedName(name) && !hasOutput(name)) mooseError("The output object '" << name << "' is not a defined output object"); }
void OutputWarehouse::checkOutputs(const std::set<OutputName> & names) { for (std::set<OutputName>::const_iterator it = names.begin(); it != names.end(); ++it) if (!isReservedName(*it) && !hasOutput(*it)) mooseError("The output object '" << *it << "' is not a defined output object"); }
MAdder::MAdder() { hasInputs(); hasOutput(); wave1Input = createInput("wave1"); wave2Input = createInput("wave2"); }
void NamedLogWriter::reopen(const boost::filesystem::path &newPath) { try { if (!hasOutput()) { BOOST_THROW_EXCEPTION(ClosedWriterError()); } close(); open(newPath); } catch (std::exception &) { BOOST_THROW_EXCEPTION(NamedLogWriterReopenError() << enable_nested_current()); } }
void NamedLogWriter::rotate(const boost::filesystem::path &renameTo) { try { if (!hasOutput()) { BOOST_THROW_EXCEPTION(ClosedWriterError()); } close(); boost::filesystem::rename(path_, renameTo); open(path_); } catch (std::exception &) { BOOST_THROW_EXCEPTION(NamedLogWriterRotateError() << enable_nested_current()); } }
void Exodus::initialSetup() { // Call base class setup method AdvancedOutput<OversampleOutput>::initialSetup(); // The libMesh::ExodusII_IO will fail when it is closed if the object is created but // nothing is written to the file. This checks that at least something will be written. if (!hasOutput()) mooseError("The current settings result in nothing being output to the Exodus file."); // Test that some sort of variable output exists (case when all variables are disabled but input output is still enabled if (!hasNodalVariableOutput() && !hasElementalVariableOutput() && !hasPostprocessorOutput() && !hasScalarOutput()) mooseError("The current settings results in only the input file and no variables being output to the Exodus file, this is not supported."); }
void ProcessModel::on_processRemoved(const Process::ProcessModel & proc) { auto proc_id = proc.id(); auto fac = iscore::AppContext().components.factory<Audio::AudioStreamEngine::ProcessComponentFactoryList>().factory(proc); if(!fac) return; bool in = fac->hasInput(); bool out = fac->hasOutput(); if(!in && out) { auto it = ossia::find(m_dataProcesses, proc_id); if(it != m_dataProcesses.end()) m_dataProcesses.erase(it); } else if(in && out) { auto it = ossia::find(m_fxProcesses, proc_id); if(it != m_fxProcesses.end()) m_fxProcesses.erase(it); } else if(in && !out) { auto it = ossia::find(m_sendProcesses, proc_id); if(it != m_sendProcesses.end()) m_sendProcesses.erase(it); } else { // send, mix return; } for (auto it = m_routings.begin(); it != m_routings.end(); ) { if ((*it).in == proc.id() || (*it).out == proc.id()) { it = m_routings.erase(it); } else { ++ it; } } emit structureChanged(); }
void Exodus::outputSetup() { // The libMesh::ExodusII_IO will fail when it is closed if the object is created but // nothing is written to the file. This checks that at least something will be written. if (!hasOutput()) mooseError("The current settings result in nothing being output to the Exodus file."); // Delete existing ExodusII_IO objects if (_exodus_io_ptr != NULL) delete _exodus_io_ptr; // Create the new ExodusII_IO object _exodus_io_ptr = new ExodusII_IO(_es_ptr->get_mesh()); /* Increment file number and set appending status, append if all the following conditions are met: (1) If the application is recovering (not restarting) (2) The mesh has not changed (3) An existing Exodus file exists for appending (_exodus_num > 0) (4) Sequential output is NOT desired */ if (_recovering && !_mesh_changed && _exodus_num > 0 && !_sequence) { // Set the recovering flag to false so that this special case is not triggered again _recovering = false; // Set the append flag to true b/c on recover the file is being appended _exodus_io_ptr->append(true); } else { // Increment file counter and reset exodus file number count _file_num++; _exodus_num = 1; // Do not append the existing file _exodus_io_ptr->append(false); } // Utilize the spatial dimensions if (_es_ptr->get_mesh().mesh_dimension() != 1) _exodus_io_ptr->use_mesh_dimension_instead_of_spatial_dimension(true); // Adjust the position of the output if (_app.hasOutputPosition()) _exodus_io_ptr->set_coordinate_offset(_app.getOutputPosition()); }
void Exodus::output(const ExecFlagType & type) { // Do nothing if there is nothing to output if (!hasOutput(type)) return; // Start the performance log Moose::perf_log.push("Exodus::output()", "Output"); // Prepare the ExodusII_IO object outputSetup(); LockFile lf(filename(), processor_id() == 0); // Adjust the position of the output if (_app.hasOutputPosition()) _exodus_io_ptr->set_coordinate_offset(_app.getOutputPosition()); // Clear the global variables (postprocessors and scalars) _global_names.clear(); _global_values.clear(); // Call the individual output methods AdvancedOutput::output(type); // Write the global variables (populated by the output methods) if (!_global_values.empty()) { if (!_exodus_initialized) outputEmptyTimestep(); _exodus_io_ptr->write_global_data(_global_values, _global_names); } // Write the input file record if it exists and the output file is initialized if (!_input_record.empty() && _exodus_initialized) { _exodus_io_ptr->write_information_records(_input_record); _input_record.clear(); } // Reset the mesh changed flag _exodus_mesh_changed = false; // Stop the logging Moose::perf_log.pop("Exodus::output()", "Output"); }
void NamedLogWriter::open_( const boost::filesystem::path &path, const bool append) { if (hasOutput()) { BOOST_THROW_EXCEPTION(OpenedWriterError() << OpenedWriterError::Path(path_)); } try { path_ = path; if (append) { auto input = detail::openFileReadOnly(path_); boost::uuids::uuid format; detail::readFormatMagic(*input, format); if (format != MAGIC_FORMAT) { BOOST_THROW_EXCEPTION(IncompatibleFormatError() << IncompatibleFormatError::Format(format)); } auto logReader = detail::make_unique<LogReader>(std::move(input)); if (logReader->messageTypePool().header() != pool_.header()) { BOOST_THROW_EXCEPTION(IncompatibleHeaderError()); } logReader->fastCheck(); } setOutput(openFile_(path_, append)); if (append) { writeContinue(); } else { try { write(nullptr, *headerData_); } catch (std::exception &) { BOOST_THROW_EXCEPTION(UnableToWriteHeaderError() << enable_nested_current()); } } } catch (std::exception &) { if (boost::exception *const e = boost::current_exception_cast<boost::exception>()) { *e << Error::Path(path_); } state_ = State::kBad; try { closeOutput(); } catch (std::exception &) {} throw; } }
void VTKOutput::outputSetup() { // The libMesh::VTK_IO will fail when it is closed if the object is created but // nothing is written to the file. This checks that at least something will be written. if (!hasOutput()) mooseError("The current settings result in nothing being output to the VTKOutput file."); // Delete existing VTKOutputIO objects if (_vtk_io_ptr != NULL) delete _vtk_io_ptr; #ifdef LIBMESH_HAVE_VTK // Create the new VTKOutput object and set compression _vtk_io_ptr = new VTKIO(_es_ptr->get_mesh()); _vtk_io_ptr->set_compression(_binary); #else mooseError("libMesh not configured with VTKOutput"); #endif }
void Nemesis::outputSetup() { // The libMesh::NemesisII_IO will fail when it is closed if the object is created but // nothing is written to the file. This checks that at least something will be written. if (!hasOutput()) mooseError("The current settings result in nothing being output to the Nemesis file."); // Delete existing NemesisII_IO objects if (_nemesis_io_ptr != NULL) delete _nemesis_io_ptr; // Increment the file number _file_num++; // Reset the number of outputs for this file _nemesis_num = 1; // Create the new NemesisIO object _nemesis_io_ptr = new Nemesis_IO(_mesh_ptr->getMesh()); }
void NamedLogWriter::write( const std::string &typeName, const google::protobuf::Message &message) { if (!hasOutput()) { BOOST_THROW_EXCEPTION(ClosedWriterError()); } BOOST_ASSERT(headerData_); try { write(&typeName, message); } catch (std::exception &e) { if (recoverable(e)) { state_ = State::kFail; } else { state_ = State::kBad; try { closeOutput(); } catch (std::exception &) {} } BOOST_THROW_EXCEPTION(UnableToWriteMessageError() << enable_nested_current()); } }
void ProcessModel::on_processAdded(const Process::ProcessModel & proc) { auto fac = iscore::AppContext().components.factory<Audio::AudioStreamEngine::ProcessComponentFactoryList>().factory(proc); if(!fac) return; bool in = fac->hasInput(); bool out = fac->hasOutput(); auto proc_id = proc.id(); if(!in && out) { m_dataProcesses.push_back({proc_id, 1.0}); for(const auto& fx : m_fxProcesses) { m_routings.insert(Routing{proc_id, fx.process, 1.0}); } for(const auto& send : m_sendProcesses) { m_routings.insert(Routing{proc_id, send, 1.0}); } } else if(in && out) { // For now we forbid mixing FX each into another. m_fxProcesses.push_back({proc_id, 1.0}); for(const auto& other : m_dataProcesses) { m_routings.insert(Routing{other.process, proc_id, 1.0}); } for(const auto& other : m_fxProcesses) { // By default we disable mixing Fx's into each other // to prevent cycles. m_routings.insert(Routing{other.process, proc_id, 1.0, false}); m_routings.insert(Routing{proc_id, other.process, 1.0, false}); } for(const auto& send : m_sendProcesses) { m_routings.insert(Routing{proc_id, send, 1.0}); } } else if(in && !out) { m_sendProcesses.push_back(proc_id); for(const auto& other : m_dataProcesses) { m_routings.insert(Routing{other.process, proc_id, 1.0}); } for(const auto& other : m_fxProcesses) { m_routings.insert(Routing{other.process, proc_id, 1.0}); } } else { // mix return; } emit structureChanged(); }