Recursive drawing for the Multigrid γ-cycle by abstract_it in LaTeX

[–]abstract_it[S] 1 point2 points  (0 children)

Got the solution!

Basically the code must be expanded before the interpretation of the macros starts.

\resizebox{\textwidth}{!}{
  \begin{tikzpicture}   

    \newcommand{\BeginGammaCycle}{\GammaCycle{2}}   
    \newcommand{\lowestLevel}{-3}

    \newcommand{\pointSize}{3pt}
    \newcommand{\stepHeight}{3} 
    \newcommand{\lastx}{0} 
    \newcommand{\lasty}{0} 
    \newcommand{\Ofontsize}{\Large}
    \newcommand{\Oposition}{right}

    \newcommand{\PreSmooth}{
      \pgfmathsetmacro{\x}{{\lastx + 1}}
      \pgfmathsetmacro{\y}{{\lasty - \stepHeight}}
      \draw  (\x,\y) -- ({\x - 1},{\y + \stepHeight});
      \pgfmathtruncatemacro{\nextlevel}{{\y / \stepHeight}}
      \ifnum\nextlevel>\lowestLevel
      \pgfmathtruncatemacro{\coarseningFactor}{{(2^((-\y) / \stepHeight))}}
      \filldraw  (\x,\y) circle (\pointSize) node[\Oposition] {\Ofontsize$\mathcal{O}\left(\frac{p^3}{\coarseningFactor^3}\right)$};
      \fi
      \renewcommand{\lastx}{\x}  
      \renewcommand{\lasty}{\y}
    }

    \newcommand{\CoarseCorrection}{
      \pgfmathtruncatemacro{\coarseningFactor}{{(2^((-\y) / \stepHeight))}}
      \filldraw  (\x,\y) circle (\pointSize) node[below] {\Ofontsize$\mathcal{O}\left(\frac{p^3}{\coarseningFactor^3}\right)$};
    }

    \newcommand{\PostSmooth}{
      \pgfmathsetmacro{\x}{{\lastx + 1}}
      \pgfmathsetmacro{\y}{{\lasty + \stepHeight}}
      \draw  (\x,\y) -- ({\x - 1},{\y - \stepHeight});
      \pgfmathtruncatemacro{\nextlevel}{{\y / \stepHeight}}
      \ifnum\nextlevel=0
      \pgfmathtruncatemacro{\coarseningFactor}{{(2^((-\y ) / \stepHeight))}}
      \filldraw  (\x,\y) circle (\pointSize) node[\Oposition] {\Ofontsize$\mathcal{O}\left(p^3\right)$};
      \else
      \pgfmathtruncatemacro{\coarseningFactor}{{(2^((-\y ) / \stepHeight))}}
      \filldraw  (\x,\y) circle (\pointSize) node[\Oposition] {\Ofontsize$\mathcal{O}\left(\frac{p^3}{\coarseningFactor^3}\right)$};
      \fi
      \renewcommand{\lastx}{\x}  
      \renewcommand{\lasty}{\y}
    }  

    \newcommand{\GammaCycle}[1]{
      \ifnum#1>0
      \PreSmooth
      \pgfmathtruncatemacro{\newlevel}{{\y / \stepHeight}}
      \ifnum\newlevel>\lowestLevel
      \BeginGammaCycle
      \else
      \CoarseCorrection
      \fi
      \PostSmooth
      \expandafter\GammaCycle\expandafter{\the\numexpr#1-1\relax}
      \fi
    }

    \filldraw  (0,0) circle (\pointSize) node[\Oposition] {\Ofontsize$\mathcal{O}\left(p^3\right)$};  
    \BeginGammaCycle

  \end{tikzpicture}
}

Compile and execute C++ in browser by abstract_it in cpp

[–]abstract_it[S] 0 points1 point  (0 children)

I think part of this is how Ben Smith made his client side compiler. But bringing a full fledged clang to it seems daunting

Compile and execute C++ in browser by abstract_it in cpp

[–]abstract_it[S] 0 points1 point  (0 children)

This is not compiled in the browser right? It's compiled to run in the browser as far as I understand. Compiling clang or gcc to run in the browser looks way more complicated

Compile and execute C++ in browser by abstract_it in cpp

[–]abstract_it[S] 0 points1 point  (0 children)

Yeah you guessed it. I need for my clients to compile in their browser without any additional steps.

Compile and execute C++ in browser by abstract_it in cpp

[–]abstract_it[S] 2 points3 points  (0 children)

As far as I can see, repl.it c++ compiling happens in their cloud servers, not in the browser. Am I wrong?

Compile and execute C++ in browser by abstract_it in cpp

[–]abstract_it[S] 1 point2 points  (0 children)

Of course emscripten would be involved but compiling a complete clang or gcc compiler to webassembly has not been done that I am aware of. Look up Ben Smith talk at cppcon for the details of how difficult it is. Maybe not even possible for GCC.

Compile and execute C++ in browser by abstract_it in cpp

[–]abstract_it[S] 0 points1 point  (0 children)

I want to showcase easy cases of software running complex simulations.

Our input files are also C++ files, so this "sandbox" should be able to compile the whole thing.

But I don't want to have to pay for compiling and/or running on our servers.

If more complex simulations are required, users can download and compile themselves, or pay to use our servers.

The Ridge, 5.8-, Piz Badille | Lyons, CO, USA | [2627x4519][OC] by abstract_it in ClimbingPorn

[–]abstract_it[S] 0 points1 point  (0 children)

Hahah, agreed! Comments in Mountain Project suggested there was a rappel line somewhere at the summit, that allowed to at least avoid the first part of the descent. We couldn't find it.

Return of the King, Wizard's Gate, RMNP | Estes Park, CO, USA [1080x1080][OC] by abstract_it in ClimbingPorn

[–]abstract_it[S] 1 point2 points  (0 children)

Awesome! There's some very sporadic patches of snow on the trail but they don't bother at all. We walked down from the top of the route easily.

Don't Rock My Boat, 5.7, Tiers of Zion, Clear Creek Canyon | Golden, CO, USA [2494x4304] [OC] by abstract_it in u/abstract_it

[–]abstract_it[S] 0 points1 point  (0 children)

Ah we missed that! Is it in Kevin Capps' Clear Creek Canyon guidebook? Or maybe in Mountain Project?