Lines Matching refs:prefix

84 PetscErrorCode PetscObjectSetOptionsPrefix(PetscObject obj, const char prefix[])  in PetscObjectSetOptionsPrefix()  argument
88 if (prefix) { in PetscObjectSetOptionsPrefix()
89 PetscAssertPointer(prefix, 2); in PetscObjectSetOptionsPrefix()
90 …PetscCheck(prefix[0] != '-', PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Options prefix should not begi… in PetscObjectSetOptionsPrefix()
91 if (prefix != obj->prefix) { in PetscObjectSetOptionsPrefix()
94 PetscCall(PetscFree(obj->prefix)); in PetscObjectSetOptionsPrefix()
95 PetscCall(PetscStrlen(prefix, &len)); in PetscObjectSetOptionsPrefix()
96 if (len) PetscCall(PetscStrallocpy(prefix, &obj->prefix)); in PetscObjectSetOptionsPrefix()
98 } else PetscCall(PetscFree(obj->prefix)); in PetscObjectSetOptionsPrefix()
119 PetscErrorCode PetscObjectAppendOptionsPrefix(PetscObject obj, const char prefix[]) in PetscObjectAppendOptionsPrefix() argument
125 if (!prefix) PetscFunctionReturn(PETSC_SUCCESS); in PetscObjectAppendOptionsPrefix()
126 if (!obj->prefix) { in PetscObjectAppendOptionsPrefix()
127 PetscCall(PetscObjectSetOptionsPrefix(obj, prefix)); in PetscObjectAppendOptionsPrefix()
130 …PetscCheck(prefix[0] != '-', PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Options prefix should not begi… in PetscObjectAppendOptionsPrefix()
132 PetscCall(PetscStrlen(obj->prefix, &len1)); in PetscObjectAppendOptionsPrefix()
133 PetscCall(PetscStrlen(prefix, &len2)); in PetscObjectAppendOptionsPrefix()
135 PetscCall(PetscRealloc(new_len * sizeof(*obj->prefix), &obj->prefix)); in PetscObjectAppendOptionsPrefix()
136 PetscCall(PetscStrncpy(obj->prefix + len1, prefix, len2 + 1)); in PetscObjectAppendOptionsPrefix()
154 PetscErrorCode PetscObjectGetOptionsPrefix(PetscObject obj, const char *prefix[]) in PetscObjectGetOptionsPrefix() argument
158 PetscAssertPointer(prefix, 2); in PetscObjectGetOptionsPrefix()
159 *prefix = obj->prefix; in PetscObjectGetOptionsPrefix()
180 PetscErrorCode PetscObjectPrependOptionsPrefix(PetscObject obj, const char prefix[]) in PetscObjectPrependOptionsPrefix() argument
187 if (!prefix) PetscFunctionReturn(PETSC_SUCCESS); in PetscObjectPrependOptionsPrefix()
188 if (!obj->prefix) { in PetscObjectPrependOptionsPrefix()
189 PetscCall(PetscObjectSetOptionsPrefix(obj, prefix)); in PetscObjectPrependOptionsPrefix()
192 …PetscCheck(prefix[0] != '-', PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Options prefix should not begi… in PetscObjectPrependOptionsPrefix()
194 PetscCall(PetscStrlen(prefix, &len1)); in PetscObjectPrependOptionsPrefix()
195 PetscCall(PetscStrlen(obj->prefix, &len2)); in PetscObjectPrependOptionsPrefix()
196 buf = obj->prefix; in PetscObjectPrependOptionsPrefix()
198 PetscCall(PetscMalloc1(new_len, &obj->prefix)); in PetscObjectPrependOptionsPrefix()
199 PetscCall(PetscStrncpy(obj->prefix, prefix, len1 + 1)); in PetscObjectPrependOptionsPrefix()
200 PetscCall(PetscStrncpy(obj->prefix + len1, buf, len2 + 1)); in PetscObjectPrependOptionsPrefix()