OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
checksum_list.cpp File Reference
#include <checksum_model.h>
#include <checksum_output_files.h>
#include <checksum_list.h>

Go to the source code of this file.

Functions

void grab_checksums (int *fd, char *rootname, int *lenr, char *path, int *lenp)

Function Documentation

◆ grab_checksums()

void grab_checksums ( int * fd,
char * rootname,
int * lenr,
char * path,
int * lenp )

Definition at line 557 of file checksum_list.cpp.

557 {
558 int i;
559
560 // Convert input fortran to C Character
561
562 char rootname_c[257]; // maximum length of the input string is 256 in Starter
563 for (i=0;i<*lenr;i++){
564 rootname_c[i]=rootname[i];
565 }
566 rootname_c[*lenr]='\0'; // Add null character to the end of the string
567 string str_rootname(rootname_c); // Convert to string
568
569
570 char path_c[2029]; // maximum length of the path string is 2048 in Starter
571 for (i=0;i<*lenp;i++){
572 path_c[i]=path[i];
573 }
574 path_c[*lenp]='\0'; // Add null character to the end of the string
575 string str_path(path_c); // Convert to string
576
577
578 // Create checksum_list object
579 // grab the input deck name
580 list<tuple<string,list<string>>> checksum_list; // checksum list collection from all decks : filename, checksum list
581 List_checksum chksum_tool;
582 checksum_list=chksum_tool.chk_list(str_rootname,str_path); // Compute the checksums from the input deck and parse the output files
583
584
585 // Print the checksum list to the output file
586 const char* blank=" ";
587 int len_blank= strlen(blank);
588
589 for (const auto& item : checksum_list){
590 string filename=" File. . . . "+get<0>(item);
591 const char* line=filename.c_str();
592 int len_line= strlen(line);
593 write_out_file(fd,line,&len_line);
594 int len_blanck=1;
595 write_out_file(fd," ",&len_blank);
596
597 for (const auto& checksum : get<1>(item)){
598 size_t pos = checksum.find_last_of("_");
599 string title=checksum.substr(0,pos); // Remove the checksum value
600 string digest=checksum.substr(pos+1); // Keep only the checksum value
601 string checksum_line=" "+title+" : "+digest;
602 const char* line=checksum_line.c_str();
603 len_line= strlen(line);
604 write_out_file(fd,line,&len_line); // Fortran routine to write the checksum line
605 }
606 write_out_file(fd,blank,&len_blank);
607 write_out_file(fd,blank,&len_blank);
608 }
609
610 }
#define write_out_file
Definition checksum.h:53
std::list< std::tuple< std::string, std::list< std::string > > > chk_list(std::string input, std::string directory)