Peano
Loading...
Searching...
No Matches
create-durham-logo Namespace Reference

Variables

 Here = os.path.dirname(os.path.abspath(__file__))
 
str LogoURL = "https://www.topuniversities.com/sites/default/files/profiles/logos/durham-university_170_large.jpg"
 
str Header
 
str Implementation
 
 request = urllib.request.Request(LogoURL, headers={"User-Agent": "Mozilla/5.0"})
 
float logo = matplotlib.image.imread(urllib.request.urlopen(request), format="jpg") / 255.0
 
float purple = logo.mean(axis=2) < 0.7
 
str rows
 

Variable Documentation

◆ Header

str create-durham-logo.Header
Initial value:
1= """// This file is part of the Peano project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3//
4// Generated by create-durham-logo.py. Do not edit.
5#pragma once
6
7namespace tutorials::exahype2::tsunami {{
8 /**
9 * Number of pixels per axis of DurhamLogo
10 */
11 constexpr int DurhamLogoSize = {size};
12
13 /**
14 * The shield of Durham University as depth map
15 *
16 * One string per row of pixels, starting with the top row of the image,
17 * i.e. DurhamLogo[row][column]. A '1' marks a purple pixel, a '0' a white
18 * one. The tutorial 11_tsunami.ipynb maps the image onto its domain and
19 * uses it as depth map: the water is deeper where the logo is purple.
20 *
21 * Created from
22 *
23 * {url}
24 *
25 * by create-durham-logo.py.
26 */
27 extern const char* const DurhamLogo[DurhamLogoSize];
28}} // namespace tutorials::exahype2::tsunami
29"""

Definition at line 26 of file create-durham-logo.py.

◆ Here

create-durham-logo.Here = os.path.dirname(os.path.abspath(__file__))

Definition at line 22 of file create-durham-logo.py.

◆ Implementation

str create-durham-logo.Implementation
Initial value:
1= """// This file is part of the Peano project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3//
4// Generated by create-durham-logo.py. Do not edit.
5#include "DurhamLogo.h"
6
7const char* const tutorials::exahype2::tsunami::DurhamLogo[DurhamLogoSize] = {{
8{rows}
9}};
10"""

Definition at line 56 of file create-durham-logo.py.

◆ logo

float create-durham-logo.logo = matplotlib.image.imread(urllib.request.urlopen(request), format="jpg") / 255.0

Definition at line 71 of file create-durham-logo.py.

◆ LogoURL

str create-durham-logo.LogoURL = "https://www.topuniversities.com/sites/default/files/profiles/logos/durham-university_170_large.jpg"

Definition at line 24 of file create-durham-logo.py.

◆ purple

float create-durham-logo.purple = logo.mean(axis=2) < 0.7

Definition at line 72 of file create-durham-logo.py.

◆ request

create-durham-logo.request = urllib.request.Request(LogoURL, headers={"User-Agent": "Mozilla/5.0"})

Definition at line 70 of file create-durham-logo.py.

◆ rows

str create-durham-logo.rows
Initial value:
1= ",\n".join(
2 ' "' + "".join("1" if pixel else "0" for pixel in row) + '"' for row in purple
3 )

Definition at line 75 of file create-durham-logo.py.