void csv::pulsadores() { RAM=initFPGA_RAM(); cont2=0; photo=0; result_out(); cont_hi=0; cont_vi=0; startTimer(100); }
void Data<Annotation>::set_union( std::set<Data<Annotation> *> & result_, const std::set<Data<Annotation> *> & datas_ ) { // FIXME currently: same symbol => same data std::vector<Data<Annotation> *> datas(datas_.begin(), datas_.end()); std::vector<Data<Annotation> *> result_in (result_.begin(), result_.end()); std::vector<Data<Annotation> *> result_out(result_.size() + datas.size()); std::sort(result_in.begin(), result_in.end(), less); std::sort(datas.begin(), datas.end(), less); typename std::vector<Data<Annotation> *>::iterator it_result_begin = result_out.begin(); typename std::vector<Data<Annotation> *>::iterator it_result_end = std::set_union(result_in.begin(), result_in.end(), datas.begin(), datas.end(), it_result_begin, less); result_.clear(); result_.insert(it_result_begin, it_result_end); }
int main(int argc, char* argv[]) { ApplicationsLib::LogogSetup logo_setup; TCLAP::CmdLine cmd( "Integrates the given element property and outputs an OGS-5 direct " "Neumann boundary condition. The mesh has to contain a property " "'bulk_node_ids' that stores the original subsurface " "mesh node ids. Such surface meshes can be created using the OGS-6 " "tool ExtractSurface.\n\n" "OpenGeoSys-6 software, version " + BaseLib::BuildInfo::git_describe + ".\n" "Copyright (c) 2012-2019, OpenGeoSys Community " "(http://www.opengeosys.org)", ' ', BaseLib::BuildInfo::git_describe); TCLAP::ValueArg<std::string> in_mesh("i", "in-mesh", "the surface mesh that has an element " "property for the Neumann " "boundary condition", true, "", "filename for surface mesh input"); cmd.add(in_mesh); TCLAP::ValueArg<std::string> property_in_arg( "p", "property-in-name", "name of an element property used for the computation of the " "Neumann boundary condition", true, "", "string (property name)"); cmd.add(property_in_arg); TCLAP::ValueArg<std::string> property_out_arg( "", "property-out-name", "name of the node based property used for the output of the " "Neumann boundary condition", true, "", "string (property name)"); cmd.add(property_out_arg); TCLAP::ValueArg<std::string> result_file( "o", "result-out", "the file name the result will be written to ", true, "", "output file name"); cmd.add(result_file); cmd.parse( argc, argv ); // read surface mesh std::unique_ptr<MeshLib::Mesh> surface_mesh( MeshLib::IO::readMeshFromFile(in_mesh.getValue())); auto const* const node_id_pv = [&]() -> MeshLib::PropertyVector<std::size_t>* { try { return surface_mesh->getProperties().getPropertyVector<std::size_t>( "bulk_node_ids", MeshLib::MeshItemType::Node, 1); } catch (std::runtime_error const& e) { WARN("%s", e.what()); return nullptr; } }(); if (!node_id_pv) return EXIT_FAILURE; std::vector<double> integrated_values = getSurfaceIntegratedValuesForNodes( *surface_mesh, property_in_arg.getValue()); std::vector<std::pair<std::size_t, double>> direct_values; direct_values.reserve(surface_mesh->getNumberOfNodes()); for (auto const* node : surface_mesh->getNodes()) { auto const id(node->getID()); auto const subsurface_node_id((*node_id_pv)[id]); auto const val(integrated_values[id]); direct_values.push_back(std::make_pair(subsurface_node_id, val)); } auto* const pv = surface_mesh->getProperties().createNewPropertyVector<double>( property_out_arg.getValue(), MeshLib::MeshItemType::Node, 1); pv->resize(surface_mesh->getNodes().size()); for (std::size_t k(0); k < surface_mesh->getNodes().size(); ++k) { (*pv)[k] = direct_values[k].second; } MeshLib::IO::writeMeshToFile(*surface_mesh, result_file.getValue()); std::ofstream result_out(result_file.getValue() + ".txt"); result_out.precision(std::numeric_limits<double>::digits10); for (auto const& p : direct_values) result_out << p.first << " " << p.second << "\n"; return EXIT_SUCCESS; }