Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
9d9a615c
Unverified
Commit
9d9a615c
authored
5 years ago
by
Simon Heybrock
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #26804 from mantidproject/v20_nexus_geometry_parser_fixes
V20 nexus geometry parser fixes
parents
8f975cf8
f900f905
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Framework/NexusGeometry/src/NexusGeometryParser.cpp
+14
-3
14 additions, 3 deletions
Framework/NexusGeometry/src/NexusGeometryParser.cpp
with
14 additions
and
3 deletions
Framework/NexusGeometry/src/NexusGeometryParser.cpp
+
14
−
3
View file @
9d9a615c
...
@@ -155,10 +155,21 @@ private:
...
@@ -155,10 +155,21 @@ private:
auto
nCharacters
=
dataType
.
getSize
();
auto
nCharacters
=
dataType
.
getSize
();
std
::
vector
<
char
>
value
(
nCharacters
);
std
::
vector
<
char
>
value
(
nCharacters
);
data
.
read
(
value
.
data
(),
dataType
,
data
.
getSpace
());
data
.
read
(
value
.
data
(),
dataType
,
data
.
getSpace
());
return
std
::
string
(
value
.
begin
(),
value
.
end
());
auto
str
=
std
::
string
(
value
.
begin
(),
value
.
end
());
str
.
erase
(
std
::
find
(
str
.
begin
(),
str
.
end
(),
'\0'
),
str
.
end
());
return
str
;
}
}
}
}
// Provided to support invalid or null-termination character strings
std
::
string
readOrSubsitute
(
const
std
::
string
&
dataset
,
const
Group
&
group
,
std
::
string
&
substitue
)
{
auto
read
=
get1DStringDataset
(
dataset
,
group
);
if
(
read
.
empty
())
read
=
substitue
;
return
read
;
}
/** Open subgroups of parent group
/** Open subgroups of parent group
* If firstEntryOnly=true, only the first match is returned as a vector of
* If firstEntryOnly=true, only the first match is returned as a vector of
* size 1.
* size 1.
...
@@ -589,7 +600,7 @@ private:
...
@@ -589,7 +600,7 @@ private:
Group
sourceGroup
=
utilities
::
findGroupOrThrow
(
instrumentGroup
,
NX_SOURCE
);
Group
sourceGroup
=
utilities
::
findGroupOrThrow
(
instrumentGroup
,
NX_SOURCE
);
std
::
string
sourceName
=
"Unspecfied"
;
std
::
string
sourceName
=
"Unspecfied"
;
if
(
utilities
::
findDataset
(
sourceGroup
,
"name"
))
if
(
utilities
::
findDataset
(
sourceGroup
,
"name"
))
sourceName
=
get1DStringDataset
(
"name"
,
sourceGroup
);
sourceName
=
readOrSubsitute
(
"name"
,
sourceGroup
,
sourceName
);
auto
sourceTransformations
=
getTransformations
(
file
,
sourceGroup
);
auto
sourceTransformations
=
getTransformations
(
file
,
sourceGroup
);
auto
defaultPos
=
Eigen
::
Vector3d
(
0.0
,
0.0
,
0.0
);
auto
defaultPos
=
Eigen
::
Vector3d
(
0.0
,
0.0
,
0.0
);
builder
.
addSource
(
sourceName
,
sourceTransformations
*
defaultPos
);
builder
.
addSource
(
sourceName
,
sourceTransformations
*
defaultPos
);
...
@@ -605,7 +616,7 @@ private:
...
@@ -605,7 +616,7 @@ private:
sampleTransforms
*
Eigen
::
Vector3d
(
0.0
,
0.0
,
0.0
);
sampleTransforms
*
Eigen
::
Vector3d
(
0.0
,
0.0
,
0.0
);
std
::
string
sampleName
=
"Unspecified"
;
std
::
string
sampleName
=
"Unspecified"
;
if
(
utilities
::
findDataset
(
sampleGroup
,
"name"
))
if
(
utilities
::
findDataset
(
sampleGroup
,
"name"
))
sampleName
=
get1DStringDataset
(
"name"
,
sampleGroup
);
sampleName
=
readOrSubsitute
(
"name"
,
sampleGroup
,
sampleName
);
builder
.
addSample
(
sampleName
,
samplePos
);
builder
.
addSample
(
sampleName
,
samplePos
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment