MCPcopy Create free account
hub / github.com/AMReX-Codes/amrex / amrex_parser_new

Function amrex_parser_new

Src/Base/Parser/AMReX_Parser_Y.cpp:251–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249/*******************************************************************/
250
251struct amrex_parser*
252amrex_parser_new ()
253{
254 auto *my_parser = (struct amrex_parser*) std::malloc(sizeof(struct amrex_parser));
255
256 my_parser->sz_mempool = parser_ast_size(parser_workspace.root);
257 my_parser->p_root = std::malloc(my_parser->sz_mempool);
258 my_parser->p_free = my_parser->p_root;
259
260 my_parser->ast = parser_ast_dup(my_parser, parser_workspace.root);
261
262 amrex_parser_delete_ptrs();
263
264 if ((char*)my_parser->p_root + my_parser->sz_mempool != (char*)my_parser->p_free) {
265 amrex::Abort("amrex_parser_new: error in memory size");
266 }
267
268 std::map<std::string,double> local_consts;
269 parser_ast_optimize(my_parser->ast, local_consts);
270 if (my_parser->ast == nullptr) {
271 amrex::Abort("amrex::Parser: expression optimizes to nothing");
272 }
273 parser_ast_sort(my_parser->ast);
274
275 return my_parser;
276}
277
278void
279amrex_parser_delete (struct amrex_parser* parser)

Callers 1

defineMethod · 0.85

Calls 6

parser_ast_sizeFunction · 0.85
parser_ast_dupFunction · 0.85
amrex_parser_delete_ptrsFunction · 0.85
AbortFunction · 0.85
parser_ast_optimizeFunction · 0.85
parser_ast_sortFunction · 0.85

Tested by

no test coverage detected