(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
\documentclass[utf8]{article} | |
\usepackage{url} | |
\usepackage{lineno} | |
\usepackage{microtype} | |
\usepackage{booktabs} | |
\usepackage[onehalfspacing]{setspace} | |
\usepackage{blindtext} | |
\usepackage{timestamp} | |
\usepackage{lscape} | |
\usepackage{tabularx} |
// CopyGrid defined in lib_grid/file_io/file_io.cpp | |
CopyGrid<APosition>(grid, gridOut, sh, destSh, aPosition); | |
size_t numVertsGrid = grid.num<Vertex>(); | |
size_t numVertsGridOut = gridOut.num<Vertex>(); | |
UG_COND_THROW(numVertsGrid != numVertsGridOut, "Num vertices of copied grid must agree."); | |
for (VertexIterator iter = grid.vertices_begin(); iter != grid.vertices_end(); ++iter) { | |
UG_LOGN("(grid before) aaSurfParams[*iter]: " << aaSurfParams[*iter]); | |
} |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
SelectSubsetElements<Vertex>(sel, sh, si, true); | |
std::vector<Vertex*> vrts; | |
vrts.assign(sel.vertices_begin(), sel.vertices_end()); | |
sel.clear(); | |
std::vector<Edge*> edges; | |
SelectSubsetElements<Edge>(sel, sh, si, true); | |
edges.assign(sel.edges_begin(), sel.edges_end()); | |
sel.clear(); |
SelectSubsetElements<Vertex>(sel, sh, si, true); | |
std::vector<Vertex*> vrts; | |
vrts.assign(sel.vertices_begin(), sel.vertices_end()); | |
sel.clear(); | |
std::vector<Edge*> edges; | |
SelectSubsetElements<Edge>(sel, sh, si, true); | |
edges.assign(sel.edges_begin(), sel.edges_end()); | |
sel.clear(); |
#include <iostream> | |
#include <vector> | |
#include <cmath> | |
#include <cstring> | |
#include <cstdlib> | |
#include <cstdio> | |
#include <cassert> | |
using namespace std; |
// Collapse edges | |
size_t beginningOfQuads = 2; | |
for (size_t i = 0; i < numQuads; i++) { | |
size_t numEdges = sh.num<Edge>(beginningOfQuads+i); | |
while (numEdges > 4) { | |
Edge* e = *sh.begin<Edge>(beginningOfQuads+i); | |
CollapseEdge(g, e, e->vertex(0)); | |
numEdges--; | |
} | |
} |
/// Collapse now | |
std::vector<Grid::traits<Edge>::secure_container>::iterator it = edgeContainers.begin(); | |
size_t numEdges = 4; | |
for (; it != edgeContainers.end(); ++it) { | |
UG_LOGN("edges contained in container: " << it->size()); | |
if (it->size() > numEdges) { | |
for (size_t i = 0; i < it->size()-numEdges; i++) { | |
UG_LOGN("Collapse " << i); | |
CollapseEdge(g, (*it)[0], (*it)[0]->vertex(0)); | |
} |
template <typename TGridFunction> | |
void TestenSCV(SmartPtr<TGridFunction> spGridFct, | |
const char* cmp, const char* subset) { | |
SmartPtr<ug::MultiGridSubsetHandler> spSh = spGridFct->domain().get()->subset_handler(); | |
ug::MultiGridSubsetHandler* sh = spSh.get(); | |
int si = sh->get_subset_index(subset); | |
UG_COND_THROW(si == -1, "Subset not present!"); | |
int grid_level = sh->num_levels()-1; |
------------------------------------------------------------------------------- | |
-- PARAMETERS | |
------------------------------------------------------------------------------- | |
minParamA = 0 | |
maxParamA = 10 | |
stepParamA = 1 | |
------------------------------------------------------------------------------- | |
------------------------------------------------------------------------------- | |
------------------------------------------------------------------------------- |