14#include "arcane/utils/ScopedPtr.h"
15#include "arcane/utils/StringBuilder.h"
16#include "arcane/utils/ITraceMng.h"
17#include "arcane/utils/HashTableMap.h"
18#include "arcane/utils/PlatformUtils.h"
19#include "arcane/utils/NotSupportedException.h"
21#include "arcane/AbstractService.h"
22#include "arcane/IVariableReader.h"
23#include "arcane/BasicTimeLoopService.h"
24#include "arcane/IXmlDocumentHolder.h"
25#include "arcane/IIOMng.h"
26#include "arcane/IMesh.h"
27#include "arcane/IItemFamily.h"
28#include "arcane/IParallelMng.h"
29#include "arcane/ISubDomain.h"
30#include "arcane/CommonVariables.h"
31#include "arcane/IVariableAccessor.h"
32#include "arcane/Directory.h"
33#include "arcane/VariableCollection.h"
34#include "arcane/IMeshMng.h"
36#include "arcane/hdf5/Hdf5VariableReader_axl.h"
37#include "arcane/hdf5/Hdf5Utils.h"
38#include "arcane/hdf5/Hdf5VariableInfoBase.h"
51using namespace Hdf5Utils;
67 : m_time(vtime), m_path(path) {}
69 Real timeValue()
const {
return m_time; }
70 const String& path()
const {
return m_path; }
81 if (!platform::getEnvironmentVariable(
"ARCANE_DEBUG_HDF5VARIABLE").null())
102void Hdf5VariableReaderHelperBase::
103_readStandardArray(IVariable* var,
RealArray& buffer,hid_t file_id,
const String& path)
105 Hdf5Utils::StandardArrayT<Real> values(file_id,path);
108 Integer nb_dim = dims.size();
110 fatal() <<
"Only one-dimension array are allowed "
111 <<
" dim=" << nb_dim <<
" var_name=" << var->fullName() <<
" path=" << path;
113 info(4) <<
"NB_ITEM: nb_item=" << nb_item;
115 if (nb_item!=family->nbItem())
116 fatal() <<
"Bad number of items in file n=" << nb_item
117 <<
" expected=" << family->nbItem()
118 <<
" var_name=" << var_name <<
" path=" << var_path
119 <<
" family=" << var_family;
121 buffer.resize(nb_item);
122 values.read(m_types,buffer);
126 for( Integer i=0; i<nb_item; ++i ){
129 info() <<
" VAR_VAL i=" << i <<
" value=" << buffer[i];
141void Hdf5VariableReaderHelperBase::
142_readVariable(IVariable* var,
RealArray& buffer,HFile& hfile,
const String& path)
147 Integer master_rank = pm->masterIORank();
152 info() <<
"Hdf5VariableReaderHelper::OPEN FILE " << m_hdf5_file_name;
153 hfile.openRead(m_hdf5_file_name);
155 _readStandardArray(var,buffer,hfile.id(),path);
156 buf_size = buffer.size();
158 pm->broadcast(iav,master_rank);
159 pm->broadcast(buffer,master_rank);
163 pm->broadcast(iav,master_rank);
164 buffer.resize(buf_size);
165 pm->broadcast(buffer,master_rank);
170 IData* var_data = var->data();
171 auto* var_true_data =
dynamic_cast< IArrayDataT<Real>*
>(var_data);
173 throw FatalErrorException(A_FUNCINFO,
"Variable is not an array of Real");
175 Integer nb_var_value = var_value.size();
176 for( Integer z=0; z<buf_size; ++z )
178 var->itemFamily()->itemsUniqueIdToLocalId(local_ids,unique_ids,
false);
179 for( Integer z=0; z<buf_size; ++z ){
181 if (lid==NULL_ITEM_LOCAL_ID)
183 if (lid>nb_var_value)
184 throw FatalErrorException(A_FUNCINFO,
"Bad variable");
185 var_value[lid] = buffer[z];
187 info(4) <<
"End of read for variable '" << var->fullName()
188 <<
"' path=" << path;
195void Hdf5VariableReaderHelperBase::
196_checkValidVariable(IVariable* var)
198 if (var->dataType()==
DT_Real && (var->dimension()==1) && var->itemFamily())
200 throw FatalErrorException(A_FUNCINFO,
201 String::format(
"Bad variable '{0}'. Variable must be an item variable,"
202 " have datatype 'Real' and dimension '1'",
266 void open(
bool is_start);
298Hdf5VariableReaderHelper::
299Hdf5VariableReaderHelper(
IMesh* mesh,
const String& xml_file_name)
301, m_xml_file_name(xml_file_name)
308Hdf5VariableReaderHelper::
309~Hdf5VariableReaderHelper()
311 for( Integer i=0, n=m_init_variables.size(); i<n; ++i )
312 delete m_init_variables[i];
313 m_init_variables.clear();
314 for( Integer i=0, n=m_time_variables.size(); i<n; ++i )
315 delete m_time_variables[i];
316 m_time_variables.clear();
325 if (m_xml_file_name.
null())
328 m_xml_document_holder = io_mng->
parseXmlFile(m_xml_file_name);
329 if (!m_xml_document_holder.get())
330 ARCANE_FATAL(
"Can not read file '{0}'",m_xml_file_name);
332 XmlNode root_element = m_xml_document_holder->documentNode().documentElement();
333 m_hdf5_file_name = root_element.
attrValue(
"file-name",
true);
338 for(
XmlNode elem : variables_elem ){
339 String var_name = elem.attrValue(
"name",
true);
340 String var_family = elem.attrValue(
"family",
true);
341 String var_path = elem.attrValue(
"path",
true);
342 info() <<
"INIT_VARIABLE: name=" << var_name <<
" path=" << var_path
343 <<
" family=" << var_family;
346 m_init_variables.add(var_info);
352 for(
XmlNode elem : variables_elem ){
353 String var_name = elem.attrValue(
"name",
true);
354 String var_family = elem.attrValue(
"family",
true);
355 info() <<
"TIME_VARIABLE: name=" << var_name <<
" family=" << var_family;
359 warning() <<
"TEMPORARY: Create variable from hdf5 file";
363 _checkValidVariable(var);
367 XmlNodeList times_elem = elem.children(
"time-value");
368 Real last_var_time = -1.0;
369 for(
XmlNode time_elem : times_elem ){
370 String var_path = time_elem.attrValue(
"path",
true);
371 XmlNode var_time_node = time_elem.
attr(
"global-time",
true);
373 if (var_time<=last_var_time){
375 <<
" current=" << var_time <<
" previous=" << last_var_time
376 <<
". current value should be greater than previous time.";
378 last_var_time = var_time;
382 m_time_variables.add(var_info);
395 for( Integer iz=0, izs=m_init_variables.size(); iz<izs; ++iz ){
398 info() <<
"Hdf5VariableReader: init for variable name=" << var->
fullName();
399 vi->readVariable(hfile,m_hdf5_file_name,m_types,
String(),var->
data());
406void Hdf5VariableReaderHelper::
407_readAndUpdateVariable(TimeVariableInfoBase* vi,Real wanted_time,
HFile& hfile)
412 Integer current_index = -1;
413 Real begin_time = 0.0;
415 Integer nb_value = time_path_values.size();
416 for( Integer i=0; i<nb_value; ++i ){
417 begin_time = time_path_values[i].timeValue();
418 if (wanted_time<begin_time){
422 if ((i+1)==nb_value){
428 end_time = time_path_values[i+1].timeValue();
429 if (wanted_time>begin_time && wanted_time<end_time){
437 <<
" begin=" << begin_time <<
" end=" << end_time
438 <<
" index=" << current_index;
440 bool need_read = current_index!=vi->m_current_index || vi->m_mesh_timestamp!=mesh_timestamp;
441 if (nb_value==1 || (current_index+1)==nb_value){
447 String begin_path = vi->m_time_path_values[current_index].path();
448 info() <<
"Hdf5VariableReaderHelper:: PATH=" << begin_path;
449 _readVariable(vi->m_begin_variable.variable(),buffer,hfile,begin_path);
450 vi->m_current_index = current_index;
451 vi->m_mesh_timestamp = mesh_timestamp;
454 begin_time = vi->m_time_path_values[current_index].timeValue();
458 Real begin_value = begin_variable[iitem];
459 var[iitem] = begin_value;
461 info() <<
"Value for cell=" << (*iitem).uniqueId() <<
" var_value=" << var[iitem];
467 String begin_path = vi->m_time_path_values[current_index].path();
468 String end_path = vi->m_time_path_values[current_index+1].path();
469 info(4) <<
"Hdf5VariableReaderHelper:: BEGIN_PATH=" << begin_path <<
" END_PATH=" << end_path;
470 _readVariable(vi->m_begin_variable.variable(),buffer,hfile,begin_path);
471 _readVariable(vi->m_end_variable.variable(),buffer,hfile,end_path);
472 vi->m_current_index = current_index;
473 vi->m_mesh_timestamp = mesh_timestamp;
476 begin_time = vi->m_time_path_values[current_index].timeValue();
477 end_time = vi->m_time_path_values[current_index+1].timeValue();
479 fatal() <<
"Hdf5VariableReaderHelper::_readAndUpdateVariable() "
480 <<
" same value for begin and end time (value=" << begin_time <<
")";
481 Real ratio = (wanted_time - begin_time) / (end_time - begin_time);
482 info(4) <<
" RATIO = " << ratio;
487 Real begin_value = begin_variable[iitem];
488 Real end_value = end_variable[iitem];
489 var[iitem] = (end_value-begin_value)*ratio + begin_value;
491 info() <<
"Value for cell=" << (*iitem).uniqueId()
492 <<
" begin=" << begin_value <<
" end_value=" << end_value
493 <<
" var_value=" << var[iitem];
507 for( Integer iz=0, izs=m_time_variables.size(); iz<izs; ++iz ){
509 _readAndUpdateVariable(vi,wanted_time,hfile);
521 for( Integer iz=0, izs=m_time_variables.size(); iz<izs; ++iz ){
548 : m_hdf5_var_info(var), m_current_index(-1), m_mesh_timestamp(-1)
556 IVariable* variable(){
return m_hdf5_var_info->variable(); }
558 Real2 timeInterval()
const
560 Integer n = m_time_path_values.size();
562 return Real2(0.0,0.0);
563 Real x = m_time_path_values[0].timeValue();
564 Real y = m_time_path_values[n-1].timeValue();
577 Ref<IData> m_begin_data;
578 Ref<IData> m_end_data;
600 m_corresponding_hash(512,
true)
604 virtual Int64 getOldUniqueId(Int64 uid,Integer index)
606 ARCANE_UNUSED(index);
610 String::format(
"Can not find corresponding uid item='{0}' group={1}",
611 uid,m_group.fullName()));
612 Int64 old_uid = uid_data->value();
618 m_corresponding_hash.clear();
619 Integer nb_pair = m_corresponding_uids.size() / 2;
620 for( Integer z=0; z<nb_pair; ++z )
621 m_corresponding_hash.add(m_corresponding_uids[z*2],m_corresponding_uids[(z*2)+1]);
645 m_wanted_vars = vars;
654 void open(
bool is_start);
657 void readAndUpdateTimeVariables(Real wanted_time);
660 void notifyRestore();
664 for( Integer i=0, n=m_time_variables.size(); i<n; ++i ){
665 TimeVariableInfoBase* vinfo = m_time_variables[i];
666 if (vinfo->variable()==var)
667 return vinfo->timeInterval();
669 return Real2(0.0,0.0);
676 UniqueArray<IVariable*> m_wanted_vars;
677 ScopedPtrT<IXmlDocumentHolder> m_xml_document_holder;
678 UniqueArray<TimeVariableInfoBase*> m_time_variables;
679 std::map<String,CorrespondanceInfo*> m_correspondance_map;
683 template <
typename DataType>
684 void _readAndUpdateVariable(TimeVariableInfoBase* vi,Real wanted_time,HFile& hfile);
685 bool _isWanted(
const String& var_name,
const String& var_family);
686 void _checkCreateCorrespondance(Hdf5VariableInfoBase* var,HFile& file_id,
const String& group_path,
bool is_start);
687 void _createCorrespondance(IVariable* var,CorrespondanceInfo* ci,Int64ConstArrayView saved_uids,Real3ConstArrayView saved_centers);
695Hdf5VariableReaderHelper2::
696Hdf5VariableReaderHelper2(IMesh* mesh,
const String& hdf5_file_name)
697: Hdf5VariableReaderHelperBase(mesh)
699 m_hdf5_file_name = hdf5_file_name;
705Hdf5VariableReaderHelper2::
706~Hdf5VariableReaderHelper2()
708 for( Integer i=0, n=m_time_variables.size(); i<n; ++i )
709 delete m_time_variables[i];
710 m_time_variables.clear();
719 if (m_hdf5_file_name.
null())
727 file_id.openRead(m_hdf5_file_name);
731 info(5) <<
"XML_DATA len=" << xml_bytes.
size() <<
" data=" << xml_bytes <<
"__EOF";
735 m_xml_document_holder = io_mng->
parseXmlBuffer(xml_bytes,m_hdf5_file_name);
736 if (!m_xml_document_holder.get())
737 ARCANE_FATAL(
"Can not XML data from file '{0}'",m_hdf5_file_name);
739 XmlNode root_element = m_xml_document_holder->documentNode().documentElement();
743 for(
const auto& elem : variables_elem ){
744 String var_name = elem.attrValue(
"name",
true);
745 String var_family = elem.attrValue(
"family",
true);
746 info(4) <<
"TIME_VARIABLE: name=" << var_name <<
" family=" << var_family;
747 if (!_isWanted(var_name,var_family))
754 String group_path = index_path +
"/Groups/" + group_name;
755 _checkCreateCorrespondance(var_info,file_id,group_path,is_start);
759 XmlNodeList times_elem = elem.children(
"time-value");
760 Real last_var_time = -1.0;
761 for(
const auto& time_elem : times_elem ){
762 String var_path = time_elem.attrValue(
"path",
true);
763 XmlNode var_time_node = time_elem.
attr(
"global-time",
true);
765 if (var_time<=last_var_time){
767 <<
" current=" << var_time <<
" previous=" << last_var_time
768 <<
". current value should be greater than previous time.";
770 last_var_time = var_time;
771 time_var_info->m_time_path_values.
add(
TimePathPair(var_time,var_path));
774 m_time_variables.add(time_var_info);
781void Hdf5VariableReaderHelper2::
787 CorrespondanceInfo* ci = 0;
788 std::map<String,CorrespondanceInfo*>::const_iterator iter = m_correspondance_map.find(group.
fullName());
789 if (iter==m_correspondance_map.end()){
790 ci =
new CorrespondanceInfo(group);
794 var_info->readGroupInfo(file_id,m_types,group_path,saved_uids,saved_centers);
795 _createCorrespondance(var,ci,saved_uids,saved_centers);
798 m_correspondance_map.insert(std::make_pair(group.
fullName(),ci));
802 var_info->setCorrespondanceFunctor(ci);
824void Hdf5VariableReaderHelper2::
828 IMesh* mesh = var->meshHandle().mesh();
829 ItemGroup group = var->itemGroup();
830 IParallelMng* pm = mesh->parallelMng();
833 Integer nb_orig_item = saved_uids.size();
837 ItemUniqueId item_uid = (*iitem).uniqueId();
838 if ((*iitem).isItemWithNodes()){
839 ItemWithNodes item = (*iitem).toItemWithNodes();
842 Integer nb_node = item.nbNode();
843 for( NodeLocalId inode : item.nodeIds() ){
844 item_center += nodes_coords[inode];
846 item_center /= nb_node;
849 Node node = (*iitem).toNode();
850 item_center = nodes_coords[node];
854 Real min_dist = FloatInfo<Real>::maxValue();
856 for( Integer z=0; z<nb_orig_item; ++z ){
857 Real d = (item_center - saved_centers[z]).squareNormL2();
864 throw FatalErrorException(A_FUNCINFO,
"Can not find old unique id");
865 info() <<
"FIND NEAREST my_uid=" << item_uid <<
" orig_uid=" << saved_uids[min_index]
866 <<
" d^2=" << min_dist;
867 corresponding_uids.add(item_uid);
868 corresponding_uids.add(saved_uids[min_index]);
879 pm->allGatherVariable(corresponding_uids,global_uids);
880 ci->m_corresponding_uids.
resize(global_uids.size());
881 ci->m_corresponding_uids.copy(global_uids);
887bool Hdf5VariableReaderHelper2::
888_isWanted(
const String& var_name,
const String& var_family)
890 Integer nb_var = m_wanted_vars.size();
893 for( Integer i=0, n=m_wanted_vars.size(); i<n; ++i ){
894 IVariable* v = m_wanted_vars[i];
895 if (v->name()==var_name && v->itemFamilyName()==var_family)
904template <
typename DataType>
905void Hdf5VariableReaderHelper2::
906_readAndUpdateVariable(TimeVariableInfoBase* vi,Real wanted_time,HFile& hfile)
910 ConstArrayView<TimePathPair> time_path_values(vi->m_time_path_values.view());
912 Real begin_time = 0.0;
914 Integer nb_value = time_path_values.size();
915 for( Integer i=0; i<nb_value; ++i ){
916 begin_time = time_path_values[i].timeValue();
917 if (wanted_time<begin_time){
921 if ((i+1)==nb_value){
929 end_time = time_path_values[i+1].timeValue();
930 if (wanted_time>begin_time && wanted_time<end_time){
939 IVariable* variable = vi->variable();
940 Int64 mesh_timestamp = variable->meshHandle().mesh()->timestamp();
944 bool need_read = current_index!=vi->m_current_index || vi->m_mesh_timestamp!=mesh_timestamp;
948 String ids_hpath = String(
"Index1/Groups/") + variable->itemGroupName() +
"_Ids";
949 info(4) <<
" FIND TIME: current=" << wanted_time <<
" begin=" << begin_time <<
" end=" << end_time
950 <<
" index=" << current_index <<
"ids_path=" << ids_hpath <<
" var=" << variable->fullName();
951 Hdf5VariableInfoBase* var_info = vi->hdf5Info();
952 IArrayDataT<DataType>* true_begin_data =
dynamic_cast<IArrayDataT<DataType>*
>(vi->m_begin_data.get());
953 IArrayDataT<DataType>* true_end_data =
dynamic_cast<IArrayDataT<DataType>*
>(vi->m_end_data.get());
954 IArrayDataT<DataType>* true_data =
dynamic_cast<IArrayDataT<DataType>*
>(variable->data());
955 info(4) <<
"DATA: begin=" << vi->m_begin_data.get() <<
" end=" << vi->m_end_data.get() <<
" current=" << variable->data();
956 info(4) <<
"TRUEDATA: begin=" << true_begin_data <<
" end=" << true_end_data <<
" current=" << true_data;
957 if (!true_data || !true_end_data || !true_begin_data){
958 throw FatalErrorException(A_FUNCINFO,
"variable data can not be cast to type IArrayDataT");
960 bool is_partial = variable->isPartial();
963 String begin_path = vi->m_time_path_values[current_index].path();
964 String end_path = vi->m_time_path_values[current_index+1].path();
965 info(4) <<
"Hdf5VariableReaderHelper2:: Reading new index BEGIN_PATH=" << begin_path <<
" END_PATH=" << end_path;
966 var_info->setPath(begin_path);
967 var_info->readVariable(hfile,m_hdf5_file_name,m_types,ids_hpath,vi->m_begin_data.get());
968 var_info->setPath(end_path);
969 var_info->readVariable(hfile,m_hdf5_file_name,m_types,ids_hpath,vi->m_end_data.get());
972 vi->m_current_index = current_index;
973 vi->m_mesh_timestamp = mesh_timestamp;
975 begin_time = vi->m_time_path_values[current_index].timeValue();
976 end_time = vi->m_time_path_values[current_index+1].timeValue();
978 throw FatalErrorException(A_FUNCINFO,
979 String::format(
"same value for begin and end time (value={0})",
981 Real ratio = (wanted_time - begin_time) / (end_time - begin_time);
982 info(4) <<
" BeginTime=" << begin_time <<
" wanted=" << wanted_time <<
" end_time=" << end_time
983 <<
" ratio = " << ratio;
985 ConstArrayView<DataType> begin_values_view = true_begin_data->view();
986 ConstArrayView<DataType> end_values_view = true_end_data->view();
987 ArrayView<DataType> values_view = true_data->view();
989 Int32 lid = (is_partial) ? iitem.index() : iitem.itemLocalId();
990 DataType begin_value = begin_values_view[lid];
991 DataType end_value = end_values_view[lid];
992 values_view[lid] = (end_value-begin_value)*ratio + begin_value;
994 info() <<
"Value for cell=" << (*iitem).uniqueId()
995 <<
" begin=" << begin_value <<
" end_value=" << end_value
996 <<
" var_value=" << values_view[lid];
1011 for( Integer iz=0, izs=m_time_variables.size(); iz<izs; ++iz ){
1016 _readAndUpdateVariable<Real>(vi,wanted_time,hfile);
1019 _readAndUpdateVariable<Real3>(vi,wanted_time,hfile);
1022 throw NotSupportedException(A_FUNCINFO,
"Bad variable datatype (only Real and Real3 are supported)");
1035 for( Integer iz=0, izs=m_time_variables.size(); iz<izs; ++iz ){
1050:
public ArcaneHdf5VariableReaderObject
1059 void build()
override
1063 void onTimeLoopStartInit()
override
1066 for( Integer i=0, is=m_readers.size(); i<is; ++i ){
1067 m_readers[i]->readInit();
1070 void onTimeLoopContinueInit()
override
1075 void onTimeLoopEndLoop()
override {}
1076 void onTimeLoopRestore()
override
1078 for( Integer i=0, is=m_readers.size(); i<is; ++i ){
1079 m_readers[i]->notifyRestore();
1082 void onTimeLoopBeginLoop()
override
1084 Real current_time = subDomain()->commonVariables().globalTime();
1085 for( Integer i=0, is=m_readers.size(); i<is; ++i ){
1086 m_readers[i]->readAndUpdateTimeVariables(current_time);
1092 void _load(
bool is_start)
1094 IMeshMng* mm = subDomain()->meshMng();
1095 for( Integer i=0, is=options()->read.size(); i<is; ++i ){
1096 String file_name = options()->read[i]->fileName();
1097 String mesh_name = options()->read[i]->meshName();
1098 info() <<
"Hdf5VariableReader: FILE_INFO: mesh=" << mesh_name <<
" file_name=" << file_name;
1105 info() <<
"Hdf5VariableReader: Nb reader =" << m_readers.size();
1106 for( Integer i=0, is=m_readers.size(); i<is; ++i ){
1107 m_readers[i]->open(is_start);
1120: ArcaneHdf5VariableReaderObject(sbi)
1128~Hdf5VariableReader()
1130 for( Integer i=0, is=m_readers.size(); i<is; ++i )
1131 delete m_readers[i];
1165 pwarning() <<
"Reading variable from HDF5 file does not work with mesh load balancing";
1166 if (m_base_file_name.
null())
1167 m_base_file_name =
"data";
1168 String file_name = m_base_file_name +
".h5";
1173 m_helper->
open(is_start);
1183 m_directory_name = path;
1188 m_base_file_name = path;
1194 m_variables.add(*ivar);
1198 arcaneCheckNull(m_helper);
1199 arcaneCheckNull(var);
1200 return m_helper->timeInterval(var);
1213ManualHdf5VariableReader::
1214ManualHdf5VariableReader(
const ServiceBuildInfo& sbi)
1217, m_directory_name(
".")
1218, m_base_file_name(
"data")
1225ManualHdf5VariableReader::
1226~ManualHdf5VariableReader()
1275 m_directory_name = path;
1280 m_base_file_name = path;
1285 ARCANE_UNUSED(vars);
1297 void _load(
bool is_start)
1299 ARCANE_UNUSED(is_start);
1302 String file_name = dir.file(m_base_file_name);
1304 info() <<
"OldManualHdf5VariableReader: FILE_INFO: file_name=" << file_name;
1311 Hdf5VariableReaderHelper* m_reader;
1312 String m_directory_name;
1313 String m_base_file_name;
1320ARCANE_REGISTER_SERVICE_HDF5VARIABLEREADER(Hdf5VariableReader,
1321 Hdf5VariableReader);
1328 ServiceProperty(
"OldManualHdf5VariableReader",
ST_SubDomain),
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
#define ARCANE_SERVICE_INTERFACE(ainterface)
Macro pour déclarer une interface lors de l'enregistrement d'un service.
Classe de base de service lié à un sous-domaine.
Classe gérant un répertoire.
virtual String file(const String &file_name) const
Retourne le chemin complet du fichier file_name dans le répertoire.
Encapsule un hid_t pour un fichier.
Encapsule un dataset simple d'un fichier HDF5 qui représente un tableau.
void directRead(StandardTypes &st, Array< DataType > &buffer)
Lit le dataset d'un tableau 1D.
Définition des types standards Arcane pour hdf5.
Fonctor pour faire la correspondance entre une entité du maillage courant et celle du maillage sauveg...
void setPath(const String &path)
Positionne le chemin dans le fichier Hdf5 contenant la valeur de la variable.
Infos de correspondance entre les uids sauvés et ceux du maillage courant pour le groupe group.
Int64 m_mesh_timestamp
Temps du maillage auquel on a lu cet index.
Integer m_current_index
Contient l'indice dans le tableau des temps du temps actuellement lu.
Lecture de variables au format HDF5.
void readAndUpdateTimeVariables(Real wanted_time)
Lecture et mise à jour des variables.
void setVariables(ConstArrayView< IVariable * > vars)
Spécifie les variables qu'on souhaite relire.
void notifyRestore()
Notification d'un retout-arrière.
void open(bool is_start)
Ouvre le fichier contenant les informations de lecture.
Integer m_current_index
Contient l'indice dans le tableau des temps du temps actuellement lu.
Int64 m_mesh_timestamp
Temps du maillage auquel on a lu cet index.
Lecture de variables au format HDF5.
void notifyRestore()
Notification d'un retout-arrière.
void readInit()
Lit les informations.
void open(bool is_start)
Ouvre le fichier contenant les informations de lecture.
void readAndUpdateTimeVariables(Real wanted_time)
Lecture et mise à jour des variables.
Lecture de variables au format HDF5.
virtual Ref< IData > cloneRef()=0
Clone la donnée.
Interface du gestionnaire des entrées sorties.
virtual IXmlDocumentHolder * parseXmlFile(const String &filename, const String &schemaname=String())=0
Lit et analyse le fichier XML filename.
virtual IXmlDocumentHolder * parseXmlBuffer(Span< const Byte > buffer, const String &name)=0
Lit et analyse le fichier XML contenu dans le buffer buffer.
Interface d'une famille d'entités.
virtual String name() const =0
Nom de la famille.
virtual IVariable * findVariable(const String &name, bool throw_exception=false)=0
Recherche la variable de nom name associée à cette famille.
virtual IItemFamily * findItemFamily(eItemKind ik, const String &name, bool create_if_needed=false, bool register_modifier_if_created=false)=0
Retourne la famille de nom name.
Interface du gestionnaire des maillages.
virtual MeshHandle * findMeshHandle(const String &name, bool throw_exception)=0
Recherche le maillage de nom name.
virtual IParallelMng * parallelMng()=0
Gestionnaire de parallèlisme.
virtual Int64 timestamp()=0
Compteur indiquant le temps de dernière modification du maillage.
Interface du gestionnaire de parallélisme pour un sous-domaine.
virtual void broadcastMemoryBuffer(ByteArray &bytes, Int32 rank)=0
Effectue un broadcast d'une zone mémoire.
virtual bool isMasterIO() const =0
true si l'instance est un gestionnaire maître des entrées/sorties.
virtual IIOMng * ioMng() const =0
Gestionnaire des entrées/sorties.
virtual Integer masterIORank() const =0
Rang de l'instance gérant les entrées/sorties (pour laquelle isMasterIO() est vrai)
virtual IMesh * defaultMesh()=0
Maillage par défaut.
virtual eDataType dataType() const =0
Type de la donnée gérée par la variable (Real, Integer, ...)
virtual String fullName() const =0
Nom complet de la variable (avec le préfixe de la famille)
@ PNoDump
Indique que la variable ne doit pas être sauvegardée.
virtual eItemKind itemKind() const =0
Type des entités du maillage sur lequel repose la variable.
virtual IData * data()=0
Données associées à la variable.
virtual ItemGroup itemGroup() const =0
Groupe du maillage associé.
virtual IItemFamily * itemFamily() const =0
Famille d'entité associée.
virtual String itemGroupName() const =0
Nom du groupe d'entité associée.
virtual MeshHandle meshHandle() const =0
Maillage auquel est associé la variable.
virtual String name() const =0
Nom de la variable.
Groupe d'entités de maillage.
const String & fullName() const
Nom du groupe.
eItemKind itemKind() const
Genre du groupe. Il s'agit du genre de ses éléments.
IMesh * mesh() const
Maillage auquel appartient ce groupe (0 pour le group nul)
Lecture de variables au format HDF5.
virtual void updateVariables(Real wanted_time)
Mise à jour des variables pour le temps wanted_time.
virtual void setBaseFileName(const String &path)
Positionne le nom du fichier contenant les données.
virtual void setBaseDirectoryName(const String &path)
Positionne le chemin du répertoire contenant les données.
virtual void setVariables(VariableCollection vars)
.Positionne la liste des variables qu'on souhaite relire. Cet appel doit avoir lieu avant initialize(...
virtual void initialize(bool is_start)
Initialise le lecteur.
virtual Real2 timeInterval(IVariable *var)
Interval de temps des valeurs pour la variable var. Les données de la variable var existent pour les ...
virtual void build()
Construction de niveau build du service.
IMesh * mesh() const
Maillage associé.
Lecture de variables au format HDF5 via un descripteur XML.
virtual void build()
Construction de niveau build du service.
virtual void setBaseDirectoryName(const String &path)
Positionne le chemin du répertoire contenant les données.
virtual void setVariables(VariableCollection vars)
.Positionne la liste des variables qu'on souhaite relire. Cet appel doit avoir lieu avant initialize(...
virtual void updateVariables(Real wanted_time)
Mise à jour des variables pour le temps wanted_time.
virtual void setBaseFileName(const String &path)
Positionne le nom du fichier contenant les données.
virtual void initialize(bool is_start)
Initialise le lecteur.
virtual Real2 timeInterval(IVariable *var)
Interval de temps des valeurs pour la variable var. Les données de la variable var existent pour les ...
Classe gérant un vecteur de réel de dimension 2.
Encapsulation d'un pointeur qui se détruit automatiquement.
Structure contenant les informations pour créer un service.
Paramètres nécessaires à la construction d'une variable.
IVariable * variable() const
Variable associée.
String name() const
Nom de la variable.
Liste de noeuds d'un arbre DOM.
XmlNode attr(const String &name, bool throw_exception=false) const
Retourne l'attribut de nom name.
String xpathFullName() const
Nom XPath du noeud avec ces ancêtres.
String attrValue(const String &name, bool throw_exception=false) const
Valeur de l'attribut name.
Real valueAsReal(bool throw_exception=false) const
Valeur du noeud convertie en réel. Si la conversion échoue, si throw_exception vaut false retourne 0....
XmlNodeList children(const String &name) const
Ensemble des noeuds fils de ce noeud ayant pour nom name.
Integer size() const
Nombre d'éléments du vecteur.
Classe de base des vecteurs 1D de données.
void resize(Int64 s)
Change le nombre d'éléments du tableau à s.
void add(ConstReferenceType val)
Ajoute l'élément val à la fin du tableau.
Vue constante d'un tableau de type T.
Exception lorsqu'une erreur fatale est survenue.
Chaîne de caractères unicode.
bool null() const
Retourne true si la chaîne est nulle.
Classe d'accès aux traces.
TraceMessage fatal() const
Flot pour un message d'erreur fatale.
TraceMessage warning() const
Flot pour un message d'avertissement.
ITraceMng * traceMng() const
Gestionnaire de trace.
TraceMessage info() const
Flot pour un message d'information.
TraceMessage pwarning() const
Vecteur 1D de données avec sémantique par valeur (style STL).
#define ARCANE_REGISTER_SERVICE(aclass, a_service_property,...)
Macro pour enregistrer un service.
MeshVariableScalarRefT< Cell, Real > VariableCellReal
Grandeur au centre des mailles de type réel.
ItemVariableScalarRefT< Real > VariableItemReal
Grandeur de type réel.
MeshVariableScalarRefT< Node, Real3 > VariableNodeReal3
Grandeur au noeud de type coordonnées.
constexpr __host__ __device__ bool isEqual(const _Type &a, const _Type &b)
Teste l'égalité bit à bit entre deux valeurs.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Integer arcaneCheckArraySize(unsigned long long size)
Vérifie que size peut être converti dans un 'Integer' pour servir de taille à un tableau....
ConstArrayView< Real3 > Real3ConstArrayView
Equivalent C d'un tableau à une dimension de Real3.
UniqueArray< Int64 > Int64UniqueArray
Tableau dynamique à une dimension d'entiers 64 bits.
ArrayView< Integer > IntegerArrayView
Equivalent C d'un tableau à une dimension d'entiers.
@ ST_SubDomain
Le service s'utilise au niveau du sous-domaine.
UniqueArray< Int32 > Int32UniqueArray
Tableau dynamique à une dimension d'entiers 32 bits.
UniqueArray< Real > RealUniqueArray
Tableau dynamique à une dimension de réels.
Array< Real > RealArray
Tableau dynamique à une dimension de réels.
@ DT_Real3
Donnée de type vecteur 3.
@ DT_Real
Donnée de type réel.
ConstArrayView< Int64 > Int64ConstArrayView
Equivalent C d'un tableau à une dimension d'entiers 64 bits.
ArrayView< Real > RealArrayView
Equivalent C d'un tableau à une dimension de réels.
double Real
Type représentant un réel.
Int32 Integer
Type représentant un entier.