Skip to content

Commit

Permalink
Merge pull request #1 from dschwen/radial_greens_patchset
Browse files Browse the repository at this point in the history
Radial greens patchset
  • Loading branch information
maxnezdyur committed Aug 8, 2022
2 parents 004f3bd + adf5a5c commit 4602329
Show file tree
Hide file tree
Showing 345 changed files with 5,040 additions and 1,190 deletions.
4 changes: 2 additions & 2 deletions conda/libmesh/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Making a Change to this package?
# REMEMBER TO UPDATE the .yaml files for the following packages:
# template/
{% set build = 4 %}
{% set build = 0 %}
{% set strbuild = "build_" + build|string %}
{% set version = "2022.06.06" %}
{% set version = "2022.08.05" %}
{% set vtk_friendly_version = "9.1" %}

package:
Expand Down
2 changes: 1 addition & 1 deletion conda/template/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
moose_libmesh:
- moose-libmesh 2022.06.06 build_4
- moose-libmesh 2022.08.05 build_0

moose_python:
- python 3.9
Expand Down
2 changes: 1 addition & 1 deletion docker_ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ if [ ! -d $PETSC_DIR/lib/petsc ]; then exit 1; fi
#-----------------------------------------------------------------------------#
# Install Libmesh to system path
#-----------------------------------------------------------------------------#
ARG LIBMESH_REV=4747096de5d6c69ed79f28e38ce45c76546364c3
ARG LIBMESH_REV=fd99dadd91eb3f4155e7767613fc37ecf1bd75f3
ARG LIBMESH_OPTIONS
ARG LIBMESH_METHODS="opt dbg"
ENV LIBMESH_DIR=/usr/local \
Expand Down
20 changes: 15 additions & 5 deletions framework/contrib/hit/lex.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,18 @@ tokTypeName(TokType t)
// clang-format on
}

Token::Token(TokType t, const std::string & val, const std::string & name, size_t offset, int line)
: type(t), val(val), name(name), offset(offset), line(line)
Token::Token(TokType t,
const std::string & val,
const std::string & name,
size_t offset,
int line,
int column)
: type(t), val(val), name(name), offset(offset), line(line), column(column)
{
}

std::string
Token::str()
Token::str() const
{
if (type == TokType::String || type == TokType::Error)
return tokTypeName(type) + ":" + val;
Expand Down Expand Up @@ -121,7 +126,12 @@ void
Lexer::emit(TokType type)
{
auto substr = _input.substr(_start, _pos - _start);
_tokens.push_back(Token(type, substr, _name, _start, _line_count));
auto column = _input.rfind('\n', _start - 1);
if (column == std::string::npos)
column = _start;
else
column = _start - column;
_tokens.push_back(Token(type, substr, _name, _start, _line_count, column));
_line_count += lineCount(substr);
_start = _pos;
}
Expand Down Expand Up @@ -200,7 +210,7 @@ Lexer::backup()
_pos = std::max(_start, _pos - _width);
}

std::string
const std::string &
Lexer::input()
{
return _input;
Expand Down
11 changes: 8 additions & 3 deletions framework/contrib/hit/lex.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ struct Token
const std::string & val,
const std::string & name,
size_t offset = 0,
int line = 0);
int line = 0,
int column = 0);
/// str returns a human-friendly string representation of the token.
std::string str();
std::string str() const;

/// type identifies the category/type of the token (i.e. String, Number, Comment, etc.)
TokType type;
Expand All @@ -55,6 +56,10 @@ struct Token
/// character) on which the beginning of the token was found - this is redundant with the offset
/// combined with a reference to the original input, but is here for convenience.
int line;
/// column is the char position after the preceeding \n (or beginning of the file) at which
/// the beginning of the token was found - this is redundant with the offset
/// combined with a reference to the original input, but is here for convenience.
int column;
};

class Lexer;
Expand Down Expand Up @@ -143,7 +148,7 @@ class Lexer

/// input returns the full input text the lexer is operating on i.e. the entire input string it
/// was initialized/constructed with.
std::string input();
const std::string & input();
/// start returns the current start byte offset into the input identifying the start of the next
/// token that will be emitted (or next section of input that will be ignored).
size_t start();
Expand Down
63 changes: 63 additions & 0 deletions framework/contrib/hit/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <set>
#include <sstream>
#include <string>
#include <chrono>

#include "braceexpr.h"
#include "parse.h"
Expand All @@ -19,6 +20,7 @@ int merge(int argc, char ** argv);
int diff(int argc, char ** argv);
int common(int argc, char ** argv);
int subtract(int argc, char ** argv);
int profile(int argc, char ** argv);

bool
globCompare(const std::string & candidate,
Expand Down Expand Up @@ -84,6 +86,8 @@ main(int argc, char ** argv)
return common(argc - 2, argv + 2);
else if (subcmd == "subtract")
return subtract(argc - 2, argv + 2);
else if (subcmd == "profile")
return profile(argc - 2, argv + 2);
else if (subcmd == "braceexpr")
{
std::stringstream ss;
Expand Down Expand Up @@ -822,3 +826,62 @@ validate(int argc, char ** argv)
}
return ret;
}

class Timer
{
public:
Timer(const std::string & msg, int n) : _msg(msg), _n(n), _begin(std::chrono::steady_clock::now())
{
}
~Timer()
{
const auto end = std::chrono::steady_clock::now();
std::cout << _msg << ": "
<< std::chrono::duration_cast<std::chrono::milliseconds>(end - _begin).count() / _n
<< " ms" << std::endl;
}

private:
const std::string _msg;
const int _n;
const std::chrono::steady_clock::time_point _begin;
};

int
profile(int argc, char ** argv)
{
Flags flags("hit profile [flags] file\n Specify '-' as a file name to accept "
"input from stdin.");
flags.add("h", "print help");
flags.add("help", "print help");
flags.add("n", "Number of parse cycles", "100");

auto positional = parseOpts(argc, argv, flags);

if (flags.have("h") || flags.have("help"))
{
std::cout << flags.usage();
return 0;
}

if (positional.size() != 1)
{
std::cout << flags.usage();
return 1;
}

std::string input;
{
Timer timer("Reading input", 1);
input = readInput(positional[0]);
}

const unsigned int num_iteration = std::stoi(flags.val("n"));
{
Timer timer("Parsing input", num_iteration);
for (unsigned int i = i; i < num_iteration; ++i)
volatile auto root = hit::parse(positional[0], input);
}

return 0;
}

0 comments on commit 4602329

Please sign in to comment.